Changed: #1275 Create an OpenGL ES driver

This commit is contained in:
kervala 2012-05-13 15:27:20 +02:00
parent a7d6082d49
commit 61d7295efa
7 changed files with 75 additions and 68 deletions

View file

@ -1398,7 +1398,8 @@ void CDriverGL::setupSpecularPass(uint pass)
// We have to do it in 2 passes
// For Both Pass, setup correct Env.
if( pass == 0 )
{ // Just display the texture
{
// Just display the texture
_DriverGLStates.enableBlend(false);
_DriverGLStates.activeTextureARB(1);
_DriverGLStates.setTextureMode(CDriverGLStates::TextureDisabled);

View file

@ -705,8 +705,6 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode)
}
}
// ***************************************************************************
void CDriverGLStates::resetTextureMode()
{

View file

@ -1613,7 +1613,7 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex)
// This maps the CMaterial::TTexOperator
static const GLenum OperatorLUT[9]= { GL_REPLACE, GL_MODULATE, GL_ADD,
#ifdef USE_OPENGLES
GL_ADD_SIGNED, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE
GL_ADD_SIGNED, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE
#else
GL_ADD_SIGNED_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_BUMP_ENVMAP_ATI
#endif
@ -1986,7 +1986,6 @@ void CDriverGL::forceActivateTexEnvMode(uint stage, const CMaterial::CTexEnv &
{
// Operator.
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, OperatorLUT[env.Env.OpRGB] );
// Arg0.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, SourceLUT[env.Env.SrcArg0RGB] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, OperandLUT[env.Env.OpArg0RGB]);
@ -2038,7 +2037,6 @@ void CDriverGL::forceActivateTexEnvMode(uint stage, const CMaterial::CTexEnv &
{
// Operator.
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, OperatorLUT[env.Env.OpAlpha] );
// Arg0.
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, SourceLUT[env.Env.SrcArg0Alpha] );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, OperandLUT[env.Env.OpArg0Alpha]);

View file

@ -103,10 +103,10 @@ bool CVertexArrayRangeNVidia::allocate(uint32 size, CVertexBuffer::TPreferredM
H_AUTO_OGL(CVertexArrayRangeNVidia_allocate)
nlassert(_VertexArrayPtr==NULL);
#ifdef NL_OS_WINDOWS
// try to allocate AGP or VRAM data.
switch(vbType)
{
#ifdef NL_OS_WINDOWS
case CVertexBuffer::AGPPreferred:
_VertexArrayPtr= nwglAllocateMemoryNV(size, 0, 0, 0.5f);
break;
@ -116,12 +116,9 @@ bool CVertexArrayRangeNVidia::allocate(uint32 size, CVertexBuffer::TPreferredM
else
_VertexArrayPtr= nwglAllocateMemoryNV(size, 0, 0, 0.5f);
break;
default:
break;
}
#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
switch(vbType)
{
#elif defined(NL_OS_MAC)
// TODO: implement for Mac OS X
#elif defined(NL_OS_UNIX)
case CVertexBuffer::AGPPreferred:
_VertexArrayPtr= nglXAllocateMemoryNV(size, 0, 0, 0.5f);
break;
@ -131,11 +128,10 @@ bool CVertexArrayRangeNVidia::allocate(uint32 size, CVertexBuffer::TPreferredM
else
_VertexArrayPtr= nglXAllocateMemoryNV(size, 0, 0, 0.5f);
break;
#endif // NL_OS_WINDOWS
default:
break;
}
#endif // NL_OS_WINDOWS
// init the allocator.
if(_VertexArrayPtr)
@ -175,7 +171,9 @@ void CVertexArrayRangeNVidia::free()
#ifdef NL_OS_WINDOWS
// Free special memory.
nwglFreeMemoryNV(_VertexArrayPtr);
#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
#elif defined(NL_OS_MAC)
// TODO: implement for Mac OS X
#elif defined(NL_OS_UNIX)
nglXFreeMemoryNV(_VertexArrayPtr);
#endif // NL_OS_WINDOWS

View file

@ -106,7 +106,7 @@ bool GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
H_AUTO_OGL(DriverGL_WndProc)
H_AUTO_OGL(DriverGL_WndProc);
// Get the driver pointer..
CDriverGL *pDriver=(CDriverGL*)GetWindowLongPtr (hWnd, GWLP_USERDATA);

View file

@ -1,3 +1,15 @@
FIND_PACKAGE(OpenGLES)
IF(NOT WIN32)
IF(APPLE)
FIND_LIBRARY(CARBON NAMES Carbon)
FIND_LIBRARY(COCOA NAMES Cocoa)
ELSE(APPLE)
FIND_PACKAGE(X11)
FIND_PACKAGE(XF86VidMode)
ENDIF(APPLE)
ENDIF(NOT WIN32)
SET(SOURCE_DIR ${CMAKE_SOURCE_DIR}/nel/src/3d/driver/opengl)
FILE(GLOB SRC ${SOURCE_DIR}/*.cpp ${SOURCE_DIR}/*.h ${SOURCE_DIR}/*.def)
@ -8,6 +20,8 @@ IF(APPLE)
SET_SOURCE_FILES_PROPERTIES(${SRC} PROPERTIES COMPILE_FLAGS "-x objective-c++")
ENDIF(APPLE)
INCLUDE_DIRECTORIES(${SOURCE_DIR} ${OPENGLES_INCLUDE_DIR})
ADD_DEFINITIONS(-DUSE_OPENGLES)
IF(WIN32)
@ -18,9 +32,7 @@ ENDIF(WIN32)
NL_TARGET_DRIVER(${NLDRV_OGLES_LIB} ${SRC})
INCLUDE_DIRECTORIES(${OPENGLES_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} nel3d nelmisc ${OPENGL_gles_LIBRARY})
TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} nel3d nelmisc ${OPENGLES_LIBRARIES})
NL_DEFAULT_PROPS(${NLDRV_OGLES_LIB} "NeL, Driver, Video: OpenGL ES")
NL_ADD_LIB_SUFFIX(${NLDRV_OGLES_LIB})
NL_ADD_RUNTIME_FLAGS(${NLDRV_OGLES_LIB})
@ -28,7 +40,7 @@ NL_ADD_RUNTIME_FLAGS(${NLDRV_OGLES_LIB})
IF(WIN32)
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
ADD_DEFINITIONS(/DDRIVER_OPENGL_EXPORTS)
ADD_DEFINITIONS(/DDRIVER_OPENGLES_EXPORTS)
ENDIF(WIN32)
IF(APPLE)