Finally finished cleaning the OpenGL ES stuff.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent e44b663bdb
commit 7f0ae42a40

@ -1474,9 +1474,7 @@ void CDriverGL3::setMatrix2DForTextureOffsetAddrMode(const uint stage, const flo
nlassert(stage < inlGetNumTextStages() ); nlassert(stage < inlGetNumTextStages() );
_DriverGLStates.activeTextureARB(stage); _DriverGLStates.activeTextureARB(stage);
#ifndef USE_OPENGLES
glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, mat); glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, mat);
#endif
} }
@ -1487,7 +1485,6 @@ void CDriverGL3::enableNVTextureShader(bool enabled)
if (enabled != _NVTextureShaderEnabled) if (enabled != _NVTextureShaderEnabled)
{ {
#ifndef USE_OPENGLES
if (enabled) if (enabled)
{ {
glEnable(GL_TEXTURE_SHADER_NV); glEnable(GL_TEXTURE_SHADER_NV);
@ -1496,7 +1493,6 @@ void CDriverGL3::enableNVTextureShader(bool enabled)
{ {
glDisable(GL_TEXTURE_SHADER_NV); glDisable(GL_TEXTURE_SHADER_NV);
} }
#endif
_NVTextureShaderEnabled = enabled; _NVTextureShaderEnabled = enabled;
} }
} }
@ -1558,10 +1554,8 @@ void CDriverGL3::setBlendConstantColor(NLMISC::CRGBA col)
if(!_Extensions.EXTBlendColor) if(!_Extensions.EXTBlendColor)
return; return;
#ifndef USE_OPENGLES
static const float OO255= 1.0f/255; static const float OO255= 1.0f/255;
nglBlendColorEXT(col.R*OO255, col.G*OO255, col.B*OO255, col.A*OO255); nglBlendColorEXT(col.R*OO255, col.G*OO255, col.B*OO255, col.A*OO255);
#endif
} }
// *************************************************************************** // ***************************************************************************

@ -759,11 +759,7 @@ private:
TCursorMap _Cursors; TCursorMap _Cursors;
#ifdef USE_OPENGLES #if defined(NL_OS_WINDOWS)
EGLDisplay _EglDisplay;
EGLContext _EglContext;
EGLSurface _EglSurface;
#elif defined(NL_OS_WINDOWS)
HGLRC _hRC; HGLRC _hRC;
HDC _hDC; HDC _hDC;
PIXELFORMATDESCRIPTOR _pfd; PIXELFORMATDESCRIPTOR _pfd;

@ -1655,7 +1655,7 @@ bool registerGlXExtensions(CGlExtensions &ext, Display *dpy, sint screen)
return true; return true;
} }
#endif // USE_OPENGLES #endif
#ifdef NL_STATIC #ifdef NL_STATIC
} // NLDRIVERGL/ES } // NLDRIVERGL/ES

@ -26,12 +26,8 @@
namespace NL3D { namespace NL3D {
#ifdef NL_STATIC #ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL3 { namespace NLDRIVERGL3 {
#endif #endif
#endif
// *************************************************************************** // ***************************************************************************
/// The extensions used by NL3D. /// The extensions used by NL3D.
@ -254,10 +250,7 @@ public:
// *************************************************************************** // ***************************************************************************
#ifdef USE_OPENGLES #if defined(NL_OS_WINDOWS)
/// This function will test and register EGL functions before than the gl context is created
bool registerEGlExtensions(CGlExtensions &ext, EGLDisplay dpy);
#elif defined(NL_OS_WINDOWS)
/// This function will test and register WGL functions before than the gl context is created /// This function will test and register WGL functions before than the gl context is created
bool registerWGlExtensions(CGlExtensions &ext, HDC hDC); bool registerWGlExtensions(CGlExtensions &ext, HDC hDC);
#elif defined(NL_OS_MAC) #elif defined(NL_OS_MAC)
@ -284,48 +277,6 @@ void registerGlExtensions(CGlExtensions &ext);
NB: we do it for all (EXT, NV, ARB extension) even it should be useful only for ARB ones. NB: we do it for all (EXT, NV, ARB extension) even it should be useful only for ARB ones.
*/ */
#ifdef USE_OPENGLES
// OES_mapbuffer.
//===============
extern NEL_PFNGLMAPBUFFEROESPROC nglMapBufferOES;
extern NEL_PFNGLUNMAPBUFFEROESPROC nglUnmapBufferOES;
extern NEL_PFNGLGETBUFFERPOINTERVOESPROC nglGetBufferPointervOES;
extern NEL_PFNGLBUFFERSUBDATAPROC nglBufferSubData;
extern PFNGLDRAWTEXFOESPROC nglDrawTexfOES;
// GL_OES_framebuffer_object
extern NEL_PFNGLISRENDERBUFFEROESPROC nglIsRenderbufferOES;
extern NEL_PFNGLBINDRENDERBUFFEROESPROC nglBindRenderbufferOES;
extern NEL_PFNGLDELETERENDERBUFFERSOESPROC nglDeleteRenderbuffersOES;
extern NEL_PFNGLGENRENDERBUFFERSOESPROC nglGenRenderbuffersOES;
extern NEL_PFNGLRENDERBUFFERSTORAGEOESPROC nglRenderbufferStorageOES;
extern NEL_PFNGLGETRENDERBUFFERPARAMETERIVOESPROC nglGetRenderbufferParameterivOES;
extern NEL_PFNGLISFRAMEBUFFEROESPROC nglIsFramebufferOES;
extern NEL_PFNGLBINDFRAMEBUFFEROESPROC nglBindFramebufferOES;
extern NEL_PFNGLDELETEFRAMEBUFFERSOESPROC nglDeleteFramebuffersOES;
extern NEL_PFNGLGENFRAMEBUFFERSOESPROC nglGenFramebuffersOES;
extern NEL_PFNGLCHECKFRAMEBUFFERSTATUSOESPROC nglCheckFramebufferStatusOES;
extern NEL_PFNGLFRAMEBUFFERRENDERBUFFEROESPROC nglFramebufferRenderbufferOES;
extern NEL_PFNGLFRAMEBUFFERTEXTURE2DOESPROC nglFramebufferTexture2DOES;
extern NEL_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC nglGetFramebufferAttachmentParameterivOES;
extern NEL_PFNGLGENERATEMIPMAPOESPROC nglGenerateMipmapOES;
// GL_OES_texture_cube_map
extern NEL_PFNGLTEXGENFOESPROC nglTexGenfOES;
extern NEL_PFNGLTEXGENFVOESPROC nglTexGenfvOES;
extern NEL_PFNGLTEXGENIOESPROC nglTexGeniOES;
extern NEL_PFNGLTEXGENIVOESPROC nglTexGenivOES;
extern NEL_PFNGLTEXGENXOESPROC nglTexGenxOES;
extern NEL_PFNGLTEXGENXVOESPROC nglTexGenxvOES;
extern NEL_PFNGLGETTEXGENFVOESPROC nglGetTexGenfvOES;
extern NEL_PFNGLGETTEXGENIVOESPROC nglGetTexGenivOES;
extern NEL_PFNGLGETTEXGENXVOESPROC nglGetTexGenxvOES;
#else
// ARB_multitexture // ARB_multitexture
//================= //=================
extern NEL_PFNGLACTIVETEXTUREARBPROC nglActiveTextureARB; extern NEL_PFNGLACTIVETEXTUREARBPROC nglActiveTextureARB;
@ -778,7 +729,5 @@ extern NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC nglRenderbufferStorageMul
// GL_ARB_multisample // GL_ARB_multisample
extern NEL_PFNGLSAMPLECOVERAGEARBPROC nglSampleCoverageARB; extern NEL_PFNGLSAMPLECOVERAGEARBPROC nglSampleCoverageARB;
#endif // USE_OPENGLES
#endif // NL_OPENGL_EXTENSION_H #endif // NL_OPENGL_EXTENSION_H

@ -24,68 +24,6 @@
extern "C" { extern "C" {
#endif #endif
#ifdef USE_OPENGLES
// OES_mapbuffer
//==============
typedef void* (APIENTRY * NEL_PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
typedef GLboolean (APIENTRY * NEL_PFNGLUNMAPBUFFEROESPROC) (GLenum target);
typedef void (APIENTRY * NEL_PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void** params);
typedef void (APIENTRY * NEL_PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
// GL_OES_framebuffer_object
//==================================
typedef GLboolean (APIENTRY * NEL_PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer);
typedef void (APIENTRY * NEL_PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer);
typedef void (APIENTRY * NEL_PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint* renderbuffers);
typedef void (APIENTRY * NEL_PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint* renderbuffers);
typedef void (APIENTRY * NEL_PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (APIENTRY * NEL_PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint* params);
typedef GLboolean (APIENTRY * NEL_PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer);
typedef void (APIENTRY * NEL_PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer);
typedef void (APIENTRY * NEL_PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint* framebuffers);
typedef void (APIENTRY * NEL_PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint* framebuffers);
typedef GLenum (APIENTRY * NEL_PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target);
typedef void (APIENTRY * NEL_PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
typedef void (APIENTRY * NEL_PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef void (APIENTRY * NEL_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
typedef void (APIENTRY * NEL_PFNGLGENERATEMIPMAPOESPROC) (GLenum target);
// GL_OES_texture_cube_map
//==================================
typedef void (APIENTRY * NEL_PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param);
typedef void (APIENTRY * NEL_PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param);
typedef void (APIENTRY * NEL_PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params);
typedef void (APIENTRY * NEL_PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param);
typedef void (APIENTRY * NEL_PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params);
typedef void (APIENTRY * NEL_PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
#define GL_MULTISAMPLE_ARB GL_MULTISAMPLE
#define GL_TEXTURE_CUBE_MAP_ARB GL_TEXTURE_CUBE_MAP_OES
#define GL_NONE 0
#define GL_MAX_TEXTURE_UNITS_ARB GL_MAX_TEXTURE_UNITS
#define GL_REFLECTION_MAP_ARB GL_REFLECTION_MAP_OES
#define GL_RGB_SCALE_EXT GL_RGB_SCALE
#define GL_REFLECTION_MAP_ARB GL_REFLECTION_MAP_OES
#define GL_PREVIOUS_EXT GL_PREVIOUS
#define GL_PRIMARY_COLOR_EXT GL_PRIMARY_COLOR
#define GL_CONSTANT_EXT GL_CONSTANT
#define GL_ADD_SIGNED_EXT GL_ADD_SIGNED
#define GL_INTERPOLATE_EXT GL_INTERPOLATE
#define GL_BUMP_ENVMAP_ATI GL_INTERPOLATE
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES
#else
// *************************************************************************** // ***************************************************************************
// *************************************************************************** // ***************************************************************************
// The NEL Functions Typedefs. // The NEL Functions Typedefs.
@ -461,8 +399,6 @@ typedef void (APIENTRY * NEL_PFNGLXFREEMEMORYNVPROC) (void *pointer);
#endif // NL_OS_MAC #endif // NL_OS_MAC
#endif // USE_OPENGLES
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

@ -38,13 +38,12 @@ static void convBlend(CMaterial::TBlend blend, GLenum& glenum)
case CMaterial::invsrcalpha:glenum=GL_ONE_MINUS_SRC_ALPHA; break; case CMaterial::invsrcalpha:glenum=GL_ONE_MINUS_SRC_ALPHA; break;
case CMaterial::srccolor: glenum=GL_SRC_COLOR; break; case CMaterial::srccolor: glenum=GL_SRC_COLOR; break;
case CMaterial::invsrccolor:glenum=GL_ONE_MINUS_SRC_COLOR; break; case CMaterial::invsrccolor:glenum=GL_ONE_MINUS_SRC_COLOR; break;
// Extended Blend modes. // Extended Blend modes.
#ifndef USE_OPENGLES
case CMaterial::blendConstantColor: glenum=GL_CONSTANT_COLOR_EXT; break; case CMaterial::blendConstantColor: glenum=GL_CONSTANT_COLOR_EXT; break;
case CMaterial::blendConstantInvColor: glenum=GL_ONE_MINUS_CONSTANT_COLOR_EXT; break; case CMaterial::blendConstantInvColor: glenum=GL_ONE_MINUS_CONSTANT_COLOR_EXT; break;
case CMaterial::blendConstantAlpha: glenum=GL_CONSTANT_ALPHA_EXT; break; case CMaterial::blendConstantAlpha: glenum=GL_CONSTANT_ALPHA_EXT; break;
case CMaterial::blendConstantInvAlpha: glenum=GL_ONE_MINUS_CONSTANT_ALPHA_EXT; break; case CMaterial::blendConstantInvAlpha: glenum=GL_ONE_MINUS_CONSTANT_ALPHA_EXT; break;
#endif
default: nlstop; default: nlstop;
} }

@ -643,14 +643,10 @@ void CDriverGLStates3::setTexGenMode (uint stage, GLint mode)
if(mode==0) if(mode==0)
{ {
#ifdef USE_OPENGLES
glDisable(GL_TEXTURE_GEN_STR_OES);
#else
glDisable( GL_TEXTURE_GEN_S ); glDisable( GL_TEXTURE_GEN_S );
glDisable( GL_TEXTURE_GEN_T ); glDisable( GL_TEXTURE_GEN_T );
glDisable( GL_TEXTURE_GEN_R ); glDisable( GL_TEXTURE_GEN_R );
glDisable( GL_TEXTURE_GEN_Q ); glDisable( GL_TEXTURE_GEN_Q );
#endif
} }
else else
{ {

@ -23,12 +23,8 @@
namespace NL3D { namespace NL3D {
#ifdef NL_STATIC #ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL3 { namespace NLDRIVERGL3 {
#endif #endif
#endif
// *************************************************************************** // ***************************************************************************
/** /**

@ -49,12 +49,8 @@ using namespace NLMISC;
namespace NL3D { namespace NL3D {
#ifdef NL_STATIC #ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL3 { namespace NLDRIVERGL3 {
#endif #endif
#endif
// *************************************************************************** // ***************************************************************************
@ -282,12 +278,8 @@ bool CDriverGL3::renderLines(CMaterial& mat, uint32 firstIndex, uint32 nlines)
} }
else else
{ {
#ifdef USE_OPENGLES
nlerror("not available in OpenGL ES 1.0, only use 16 bits indices");
#else
nlassert(_LastIB._Format == CIndexBuffer::Indices32); nlassert(_LastIB._Format == CIndexBuffer::Indices32);
glDrawElements(GL_LINES,2*nlines,GL_UNSIGNED_INT,((uint32 *) _LastIB._Values)+firstIndex); glDrawElements(GL_LINES,2*nlines,GL_UNSIGNED_INT,((uint32 *) _LastIB._Values)+firstIndex);
#endif
} }
} }
} }
@ -342,12 +334,8 @@ bool CDriverGL3::renderTriangles(CMaterial& mat, uint32 firstIndex, uint32 ntris
} }
else else
{ {
#ifdef USE_OPENGLES
nlerror("not available in OpenGL ES 1.0, only use 16 bits indices");
#else
nlassert(_LastIB._Format == CIndexBuffer::Indices32); nlassert(_LastIB._Format == CIndexBuffer::Indices32);
glDrawElements(GL_TRIANGLES,3*ntris,GL_UNSIGNED_INT, ((uint32 *) _LastIB._Values)+firstIndex); glDrawElements(GL_TRIANGLES,3*ntris,GL_UNSIGNED_INT, ((uint32 *) _LastIB._Values)+firstIndex);
#endif
} }
} }
} }
@ -390,12 +378,8 @@ bool CDriverGL3::renderSimpleTriangles(uint32 firstTri, uint32 ntris)
} }
else else
{ {
#ifdef USE_OPENGLES
nlerror("not available in OpenGL ES 1.0, only use 16 bits indices");
#else
nlassert(_LastIB._Format == CIndexBuffer::Indices32); nlassert(_LastIB._Format == CIndexBuffer::Indices32);
glDrawElements(GL_TRIANGLES,3*ntris,GL_UNSIGNED_INT, ((uint32 *) _LastIB._Values)+firstTri); glDrawElements(GL_TRIANGLES,3*ntris,GL_UNSIGNED_INT, ((uint32 *) _LastIB._Values)+firstTri);
#endif
} }
// Profiling. // Profiling.
@ -622,9 +606,6 @@ bool CDriverGL3::renderRawQuads(CMaterial& mat, uint32 startIndex, uint32 numQua
} }
else else
{ {
#ifdef USE_OPENGLES
nlerror("not available in OpenGL ES 1.0, only use 16 bits indices");
#else
// indices fits on 32 bits // indices fits on 32 bits
GLint indices[QUAD_BATCH_SIZE]; GLint indices[QUAD_BATCH_SIZE];
GLint *curr = indices; GLint *curr = indices;
@ -642,7 +623,6 @@ bool CDriverGL3::renderRawQuads(CMaterial& mat, uint32 startIndex, uint32 numQua
} }
while(curr != end); while(curr != end);
glDrawElements(GL_TRIANGLES, 6 * numQuadsToDraw, GL_UNSIGNED_INT, indices); glDrawElements(GL_TRIANGLES, 6 * numQuadsToDraw, GL_UNSIGNED_INT, indices);
#endif
} }
numLeftQuads -= numQuadsToDraw; numLeftQuads -= numQuadsToDraw;
currIndex += 4 * numQuadsToDraw; currIndex += 4 * numQuadsToDraw;
@ -683,12 +663,11 @@ void CDriverGL3::setupUVPtr(uint stage, CVertexBufferInfo &VB, uint uvId)
// Setup ATI VBHard or std ptr. // Setup ATI VBHard or std ptr.
switch(VB.VBMode) switch(VB.VBMode)
{ {
#ifndef USE_OPENGLES
case CVertexBufferInfo::HwATI: case CVertexBufferInfo::HwATI:
nglArrayObjectATI(GL_TEXTURE_COORD_ARRAY, numTexCoord, GL_FLOAT, VB.VertexSize, VB.VertexObjectId, nglArrayObjectATI(GL_TEXTURE_COORD_ARRAY, numTexCoord, GL_FLOAT, VB.VertexSize, VB.VertexObjectId,
(ptrdiff_t) VB.ValuePtr[CVertexBuffer::TexCoord0+uvId]); (ptrdiff_t) VB.ValuePtr[CVertexBuffer::TexCoord0+uvId]);
break; break;
#endif
case CVertexBufferInfo::HwARB: case CVertexBufferInfo::HwARB:
_DriverGLStates.bindARBVertexBuffer(VB.VertexObjectId); _DriverGLStates.bindARBVertexBuffer(VB.VertexObjectId);
// with arb buffers, position is relative to the start of the stream // with arb buffers, position is relative to the start of the stream
@ -831,21 +810,6 @@ const uint CDriverGL3::NumCoordinatesType[CVertexBuffer::NumType]=
// *************************************************************************** // ***************************************************************************
const uint CDriverGL3::GLType[CVertexBuffer::NumType]= const uint CDriverGL3::GLType[CVertexBuffer::NumType]=
{ {
#ifdef USE_OPENGLES
GL_FLOAT, // Double1
GL_FLOAT, // Float1
GL_SHORT, // Short1
GL_FLOAT, // Double2
GL_FLOAT, // Float2
GL_SHORT, // Short2
GL_FLOAT, // Double3
GL_FLOAT, // Float3
GL_SHORT, // Short3
GL_FLOAT, // Double4
GL_FLOAT, // Float4
GL_SHORT, // Short4
GL_UNSIGNED_BYTE // UChar4
#else
GL_DOUBLE, // Double1 GL_DOUBLE, // Double1
GL_FLOAT, // Float1 GL_FLOAT, // Float1
GL_SHORT, // Short1 GL_SHORT, // Short1
@ -859,7 +823,6 @@ const uint CDriverGL3::GLType[CVertexBuffer::NumType]=
GL_FLOAT, // Float4 GL_FLOAT, // Float4
GL_SHORT, // Short4 GL_SHORT, // Short4
GL_UNSIGNED_BYTE // UChar4 GL_UNSIGNED_BYTE // UChar4
#endif
}; };
// *************************************************************************** // ***************************************************************************
@ -962,7 +925,7 @@ void CDriverGL3::setupGlArraysStd(CVertexBufferInfo &vb)
} }
} }
break; break;
#ifndef USE_OPENGLES
case CVertexBufferInfo::HwATI: case CVertexBufferInfo::HwATI:
{ {
// setup vertex ptr. // setup vertex ptr.
@ -1005,7 +968,7 @@ void CDriverGL3::setupGlArraysStd(CVertexBufferInfo &vb)
} }
} }
break; break;
#endif
default: default:
nlassert(0); nlassert(0);
break; break;
@ -1075,9 +1038,8 @@ void CDriverGL3::toggleGlArraysForARBVertexProgram()
// If last was a VertexProgram setup, and now it is a standard GL array setup. // If last was a VertexProgram setup, and now it is a standard GL array setup.
if( _LastSetupGLArrayVertexProgram && !isVertexProgramEnabled () ) if( _LastSetupGLArrayVertexProgram && !isVertexProgramEnabled () )
{ {
#ifndef USE_OPENGLES
if (_Extensions.ATITextureEnvCombine3) if (_Extensions.ATITextureEnvCombine3)
#endif
{ {
// fix for ATI : when switching from Vertex Program to fixed Pipe, must clean texture, otherwise texture may be disabled in next render // fix for ATI : when switching from Vertex Program to fixed Pipe, must clean texture, otherwise texture may be disabled in next render
// (seems to be a driver bug) // (seems to be a driver bug)
@ -1089,14 +1051,13 @@ void CDriverGL3::toggleGlArraysForARBVertexProgram()
activateTexture(stage, NULL); activateTexture(stage, NULL);
} }
#ifndef USE_OPENGLES
glBegin(GL_QUADS); glBegin(GL_QUADS);
glVertex4f(0.f, 0.f, 0.f, 1.f); glVertex4f(0.f, 0.f, 0.f, 1.f);
glVertex4f(0.f, 0.f, 0.f, 1.f); glVertex4f(0.f, 0.f, 0.f, 1.f);
glVertex4f(0.f, 0.f, 0.f, 1.f); glVertex4f(0.f, 0.f, 0.f, 1.f);
glVertex4f(0.f, 0.f, 0.f, 1.f); glVertex4f(0.f, 0.f, 0.f, 1.f);
glEnd(); glEnd();
#endif
for(uint stage=0 ; stage<inlGetNumTextStages() ; stage++) for(uint stage=0 ; stage<inlGetNumTextStages() ; stage++)
{ {
@ -1231,9 +1192,7 @@ void CDriverGL3::setupGlArraysForNVVertexProgram(CVertexBufferInfo &vb)
{ {
// Secondary color // Secondary color
_DriverGLStates.enableSecondaryColorArray(true); _DriverGLStates.enableSecondaryColorArray(true);
#ifndef USE_OPENGLES
nglSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, vb.VertexSize, vb.ValuePtr[value]); nglSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, vb.VertexSize, vb.ValuePtr[value]);
#endif
} }
} }
else else
@ -1247,9 +1206,7 @@ void CDriverGL3::setupGlArraysForNVVertexProgram(CVertexBufferInfo &vb)
// Active this value // Active this value
_DriverGLStates.enableVertexAttribArray(glIndex, true); _DriverGLStates.enableVertexAttribArray(glIndex, true);
#ifndef USE_OPENGLES
nglVertexAttribPointerNV (glIndex, NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]); nglVertexAttribPointerNV (glIndex, NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
#endif
} }
} }
// Else normal case, can't do anything for other values with UChar4.... // Else normal case, can't do anything for other values with UChar4....
@ -1257,9 +1214,7 @@ void CDriverGL3::setupGlArraysForNVVertexProgram(CVertexBufferInfo &vb)
{ {
// Active this value // Active this value
_DriverGLStates.enableVertexAttribArray(glIndex, true); _DriverGLStates.enableVertexAttribArray(glIndex, true);
#ifndef USE_OPENGLES
nglVertexAttribPointerNV (glIndex, NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]); nglVertexAttribPointerNV (glIndex, NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
#endif
} }
} }
else else
@ -1315,7 +1270,6 @@ void CDriverGL3::setupGlArraysForARBVertexProgram(CVertexBufferInfo &vb)
_DriverGLStates.bindARBVertexBuffer(vb.VertexObjectId); _DriverGLStates.bindARBVertexBuffer(vb.VertexObjectId);
} }
#ifndef USE_OPENGLES
// special case if the buffer is an ATI_vertex_array_object // special case if the buffer is an ATI_vertex_array_object
if (vb.VBMode == CVertexBufferInfo::HwATI) if (vb.VBMode == CVertexBufferInfo::HwATI)
{ {
@ -1349,7 +1303,6 @@ void CDriverGL3::setupGlArraysForARBVertexProgram(CVertexBufferInfo &vb)
} }
} }
else else
#endif
{ {
// For each value // For each value
for (uint value=0; value<CVertexBuffer::NumValue; value++) for (uint value=0; value<CVertexBuffer::NumValue; value++)
@ -1371,11 +1324,7 @@ void CDriverGL3::setupGlArraysForARBVertexProgram(CVertexBufferInfo &vb)
{ {
mustNormalize = ARBVertexProgramMustNormalizeAttrib[value]; mustNormalize = ARBVertexProgramMustNormalizeAttrib[value];
} }
#ifdef USE_OPENGLES
glVertexPointer(NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
#else
nglVertexAttribPointerARB(glIndex, NumCoordinatesType[type], GLType[type], mustNormalize, vb.VertexSize, vb.ValuePtr[value]); nglVertexAttribPointerARB(glIndex, NumCoordinatesType[type], GLType[type], mustNormalize, vb.VertexSize, vb.ValuePtr[value]);
#endif
} }
else else
{ {
@ -1423,7 +1372,7 @@ void CDriverGL3::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb)
if (flags & flag & drvInfo->UsedVertexComponents) if (flags & flag & drvInfo->UsedVertexComponents)
{ {
_DriverGLStates.enableVertexAttribArrayForEXTVertexShader(glIndex, true, drvInfo->Variants); _DriverGLStates.enableVertexAttribArrayForEXTVertexShader(glIndex, true, drvInfo->Variants);
#ifndef USE_OPENGLES
// use variant or open gl standard array // use variant or open gl standard array
if (vb.VBMode == CVertexBufferInfo::HwATI) if (vb.VBMode == CVertexBufferInfo::HwATI)
{ {
@ -1496,7 +1445,6 @@ void CDriverGL3::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb)
} }
} }
else else
#endif
{ {
switch(value) switch(value)
{ {
@ -1509,9 +1457,7 @@ void CDriverGL3::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb)
case CVertexBuffer::Weight: // skin weight case CVertexBuffer::Weight: // skin weight
{ {
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
#ifndef USE_OPENGLES
nglVariantPointerEXT(drvInfo->Variants[CDriverGL3::EVSSkinWeightVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]); nglVariantPointerEXT(drvInfo->Variants[CDriverGL3::EVSSkinWeightVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
#endif
} }
break; break;
case CVertexBuffer::Normal: // normal case CVertexBuffer::Normal: // normal
@ -1530,27 +1476,21 @@ void CDriverGL3::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb)
{ {
// implemented using a variant, as not available with EXTVertexShader // implemented using a variant, as not available with EXTVertexShader
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
#ifndef USE_OPENGLES
nglVariantPointerEXT(drvInfo->Variants[CDriverGL3::EVSSecondaryColorVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]); nglVariantPointerEXT(drvInfo->Variants[CDriverGL3::EVSSecondaryColorVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
#endif
} }
break; break;
case CVertexBuffer::Fog: // fog coordinate case CVertexBuffer::Fog: // fog coordinate
{ {
// implemented using a variant // implemented using a variant
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
#ifndef USE_OPENGLES
nglVariantPointerEXT(drvInfo->Variants[CDriverGL3::EVSFogCoordsVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]); nglVariantPointerEXT(drvInfo->Variants[CDriverGL3::EVSFogCoordsVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
#endif
} }
break; break;
case CVertexBuffer::PaletteSkin: // palette skin case CVertexBuffer::PaletteSkin: // palette skin
{ {
// implemented using a variant // implemented using a variant
nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported
#ifndef USE_OPENGLES
nglVariantPointerEXT(drvInfo->Variants[CDriverGL3::EVSPaletteSkinVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]); nglVariantPointerEXT(drvInfo->Variants[CDriverGL3::EVSPaletteSkinVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
#endif
} }
break; break;
case CVertexBuffer::Empty: // empty case CVertexBuffer::Empty: // empty
@ -1807,7 +1747,6 @@ void CDriverGL3::fenceOnCurVBHardIfNeeded(IVertexBufferHardGL *newVBHard)
{ {
H_AUTO_OGL(CDriverGL3_fenceOnCurVBHardIfNeeded); H_AUTO_OGL(CDriverGL3_fenceOnCurVBHardIfNeeded);
#ifndef USE_OPENGLES
// If old is not a VBHard, or if not a NVidia VBHard, no-op. // If old is not a VBHard, or if not a NVidia VBHard, no-op.
if( _CurrentVertexBufferHard==NULL || !_CurrentVertexBufferHard->VBType == IVertexBufferHardGL::NVidiaVB) if( _CurrentVertexBufferHard==NULL || !_CurrentVertexBufferHard->VBType == IVertexBufferHardGL::NVidiaVB)
return; return;
@ -1836,7 +1775,6 @@ void CDriverGL3::fenceOnCurVBHardIfNeeded(IVertexBufferHardGL *newVBHard)
vbHardNV->GPURenderingAfterFence= false; vbHardNV->GPURenderingAfterFence= false;
} }
} }
#endif
} }
// *************************************************************************** // ***************************************************************************

@ -27,12 +27,8 @@ using namespace NLMISC;
namespace NL3D { namespace NL3D {
#ifdef NL_STATIC #ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL3 { namespace NLDRIVERGL3 {
#endif #endif
#endif
// *************************************************************************** // ***************************************************************************
// *************************************************************************** // ***************************************************************************
@ -73,8 +69,6 @@ IVertexBufferHardGL::~IVertexBufferHardGL()
H_AUTO_OGL(IVertexBufferHardGL_IVertexBufferHardGLDtor) H_AUTO_OGL(IVertexBufferHardGL_IVertexBufferHardGLDtor)
} }
#ifndef USE_OPENGLES
// *************************************************************************** // ***************************************************************************
// *************************************************************************** // ***************************************************************************
// *************************************************************************** // ***************************************************************************
@ -1135,9 +1129,6 @@ void CVertexArrayRangeMapObjectATI::updateLostBuffers()
} }
#endif #endif
#endif // USE_OPENGLES
// *************************************************************************** // ***************************************************************************
// *************************************************************************** // ***************************************************************************
// *************************************************************************** // ***************************************************************************
@ -1213,36 +1204,20 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff
GLuint vertexBufferID; GLuint vertexBufferID;
glGetError(); glGetError();
#ifdef USE_OPENGLES
glGenBuffers(1, &vertexBufferID);
#else
nglGenBuffersARB(1, &vertexBufferID); nglGenBuffersARB(1, &vertexBufferID);
#endif
if (glGetError() != GL_NO_ERROR) return NULL; if (glGetError() != GL_NO_ERROR) return NULL;
_Driver->_DriverGLStates.forceBindARBVertexBuffer(vertexBufferID); _Driver->_DriverGLStates.forceBindARBVertexBuffer(vertexBufferID);
switch(_VBType) switch(_VBType)
{ {
case CVertexBuffer::AGPPreferred: case CVertexBuffer::AGPPreferred:
#ifdef USE_OPENGLES
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
#else
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB); nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
#endif
break; break;
case CVertexBuffer::StaticPreferred: case CVertexBuffer::StaticPreferred:
if (_Driver->getStaticMemoryToVRAM()) if (_Driver->getStaticMemoryToVRAM())
#ifdef USE_OPENGLES
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STATIC_DRAW);
#else
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STATIC_DRAW_ARB); nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STATIC_DRAW_ARB);
#endif
else else
#ifdef USE_OPENGLES
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
#else
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB); nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
#endif
break; break;
default: default:
nlassert(0); nlassert(0);
@ -1250,12 +1225,7 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff
} }
if (glGetError() != GL_NO_ERROR) if (glGetError() != GL_NO_ERROR)
{ {
#ifdef USE_OPENGLES
glDeleteBuffers(1, &vertexBufferID);
#else
nglDeleteBuffersARB(1, &vertexBufferID); nglDeleteBuffersARB(1, &vertexBufferID);
#endif
return NULL; return NULL;
} }
CVertexBufferHardARB *newVbHard= new CVertexBufferHardARB(_Driver, vb); CVertexBufferHardARB *newVbHard= new CVertexBufferHardARB(_Driver, vb);
@ -1297,13 +1267,8 @@ void CVertexArrayRangeARB::updateLostBuffers()
{ {
nlassert((*it)->_VertexObjectId); nlassert((*it)->_VertexObjectId);
GLuint id = (GLuint) (*it)->_VertexObjectId; GLuint id = (GLuint) (*it)->_VertexObjectId;
#ifdef USE_OPENGLES
nlassert(glIsBuffer(id));
glDeleteBuffers(1, &id);
#else
nlassert(nglIsBufferARB(id)); nlassert(nglIsBufferARB(id));
nglDeleteBuffersARB(1, &id); nglDeleteBuffersARB(1, &id);
#endif
(*it)->_VertexObjectId = 0; (*it)->_VertexObjectId = 0;
(*it)->VB->setLocation(CVertexBuffer::NotResident); (*it)->VB->setLocation(CVertexBuffer::NotResident);
} }
@ -1331,11 +1296,6 @@ CVertexBufferHardARB::CVertexBufferHardARB(CDriverGL3 *drv, CVertexBuffer *vb) :
_Unmapping = false; _Unmapping = false;
#endif #endif
#ifdef USE_OPENGLES
_Buffer = NULL;
_BufferSize = 0;
_LastBufferSize = 0;
#endif
} }
// *************************************************************************** // ***************************************************************************
@ -1352,13 +1312,8 @@ CVertexBufferHardARB::~CVertexBufferHardARB()
if (_VertexObjectId) if (_VertexObjectId)
{ {
GLuint id = (GLuint) _VertexObjectId; GLuint id = (GLuint) _VertexObjectId;
#ifdef USE_OPENGLES
nlassert(glIsBuffer(id));
glDeleteBuffers(1, &id);
#else
nlassert(nglIsBufferARB(id)); nlassert(nglIsBufferARB(id));
nglDeleteBuffersARB(1, &id); nglDeleteBuffersARB(1, &id);
#endif
} }
if (_VertexArrayRange) if (_VertexArrayRange)
{ {
@ -1378,13 +1333,6 @@ CVertexBufferHardARB::~CVertexBufferHardARB()
} }
#endif #endif
#ifdef USE_OPENGLES
if (_Buffer)
{
delete [] _Buffer;
_Buffer = NULL;
}
#endif
} }
// *************************************************************************** // ***************************************************************************
@ -1403,11 +1351,7 @@ void *CVertexBufferHardARB::lock()
// recreate a vb // recreate a vb
GLuint vertexBufferID; GLuint vertexBufferID;
#ifdef USE_OPENGLES
glGenBuffers(1, &vertexBufferID);
#else
nglGenBuffersARB(1, &vertexBufferID); nglGenBuffersARB(1, &vertexBufferID);
#endif
if (glGetError() != GL_NO_ERROR) if (glGetError() != GL_NO_ERROR)
{ {
@ -1419,25 +1363,13 @@ void *CVertexBufferHardARB::lock()
switch(_MemType) switch(_MemType)
{ {
case CVertexBuffer::AGPPreferred: case CVertexBuffer::AGPPreferred:
#ifdef USE_OPENGLES
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
#else
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB); nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
#endif
break; break;
case CVertexBuffer::StaticPreferred: case CVertexBuffer::StaticPreferred:
if (_Driver->getStaticMemoryToVRAM()) if (_Driver->getStaticMemoryToVRAM())
#ifdef USE_OPENGLES
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STATIC_DRAW);
#else
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STATIC_DRAW_ARB); nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STATIC_DRAW_ARB);
#endif
else else
#ifdef USE_OPENGLES
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
#else
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB); nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
#endif
break; break;
default: default:
nlassert(0); nlassert(0);
@ -1446,11 +1378,7 @@ void *CVertexBufferHardARB::lock()
if (glGetError() != GL_NO_ERROR) if (glGetError() != GL_NO_ERROR)
{ {
_Driver->incrementResetCounter(); _Driver->incrementResetCounter();
#ifdef USE_OPENGLES
glDeleteBuffers(1, &vertexBufferID);
#else
nglDeleteBuffersARB(1, &vertexBufferID); nglDeleteBuffersARB(1, &vertexBufferID);
#endif
return &_DummyVB[0];; return &_DummyVB[0];;
} }
_VertexObjectId = vertexBufferID; _VertexObjectId = vertexBufferID;
@ -1467,38 +1395,7 @@ void *CVertexBufferHardARB::lock()
} }
_Driver->_DriverGLStates.bindARBVertexBuffer(_VertexObjectId); _Driver->_DriverGLStates.bindARBVertexBuffer(_VertexObjectId);
#ifdef USE_OPENGLES
if (_Driver->_Extensions.OESMapBuffer)
{
_VertexPtr = nglMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES);
if (!_VertexPtr)
{
nglUnmapBufferOES(GL_ARRAY_BUFFER);
nlassert(glIsBuffer(_VertexObjectId));
invalidate();
return &_DummyVB[0];
}
}
else
{
const uint size = VB->getNumVertices() * VB->getVertexSize();
if (size > _BufferSize)
{
if (_Buffer) delete [] _Buffer;
_Buffer = new uint8[size+3];
_BufferSize = size;
}
uint8 offset = (size_t)_Buffer % 4;
if (offset > 0) offset = 4 - offset;
_VertexPtr = _Buffer + offset;
_LastBufferSize = size;
}
#else
_VertexPtr = nglMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); _VertexPtr = nglMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
if (!_VertexPtr) if (!_VertexPtr)
{ {
@ -1507,7 +1404,6 @@ void *CVertexBufferHardARB::lock()
invalidate(); invalidate();
return &_DummyVB[0]; return &_DummyVB[0];
} }
#endif
#ifdef NL_DEBUG #ifdef NL_DEBUG
_VertexArrayRange->_MappedVBList.push_front(this); _VertexArrayRange->_MappedVBList.push_front(this);
@ -1544,14 +1440,7 @@ void CVertexBufferHardARB::unlock()
#endif #endif
GLboolean unmapOk = GL_FALSE; GLboolean unmapOk = GL_FALSE;
#ifdef USE_OPENGLES
if (_Driver->_Extensions.OESMapBuffer)
{
unmapOk = nglUnmapBufferOES(GL_ARRAY_BUFFER);
}
#else
unmapOk = nglUnmapBufferARB(GL_ARRAY_BUFFER_ARB); unmapOk = nglUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
#endif
#ifdef NL_DEBUG #ifdef NL_DEBUG
_Unmapping = false; _Unmapping = false;

@ -23,12 +23,8 @@
namespace NL3D { namespace NL3D {
#ifdef NL_STATIC #ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL3 { namespace NLDRIVERGL3 {
#endif #endif
#endif
class CDriverGL; class CDriverGL;
class IVertexBufferHardGL; class IVertexBufferHardGL;
@ -117,8 +113,6 @@ protected:
bool _Invalid; bool _Invalid;
}; };
#ifndef USE_OPENGLES
// *************************************************************************** // ***************************************************************************
// *************************************************************************** // ***************************************************************************
// NVidia implementation // NVidia implementation
@ -460,8 +454,6 @@ public:
#endif #endif
}; };
#endif
// *************************************************************************** // ***************************************************************************
// *************************************************************************** // ***************************************************************************
// ARB_vertex_buffer_object implementation // ARB_vertex_buffer_object implementation
@ -559,11 +551,7 @@ private:
CVertexArrayRangeARB *_VertexArrayRange; CVertexArrayRangeARB *_VertexArrayRange;
CVertexBuffer::TPreferredMemory _MemType; CVertexBuffer::TPreferredMemory _MemType;
void *_VertexPtr; // pointer on current datas. Null if not locked void *_VertexPtr; // pointer on current datas. Null if not locked
#ifdef USE_OPENGLES
uint8 *_Buffer;
uint32 _BufferSize;
uint32 _LastBufferSize;
#endif
// if buffer has been invalidated, returns a dummy memory block and silently fails rendering // if buffer has been invalidated, returns a dummy memory block and silently fails rendering
std::vector<uint8> _DummyVB; std::vector<uint8> _DummyVB;
// for use by CVertexArrayRangeARB // for use by CVertexArrayRangeARB

@ -33,12 +33,8 @@ using namespace NLMISC;
namespace NL3D { namespace NL3D {
#ifdef NL_STATIC #ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL3 { namespace NLDRIVERGL3 {
#endif #endif
#endif
// *************************************************************************** // ***************************************************************************
CVertexProgamDrvInfosGL3::CVertexProgamDrvInfosGL3 (CDriverGL3 *drv, ItVtxPrgDrvInfoPtrList it) : IVertexProgramDrvInfos (drv, it) CVertexProgamDrvInfosGL3::CVertexProgamDrvInfosGL3 (CDriverGL3 *drv, ItVtxPrgDrvInfoPtrList it) : IVertexProgramDrvInfos (drv, it)
@ -51,7 +47,6 @@ CVertexProgamDrvInfosGL3::CVertexProgamDrvInfosGL3 (CDriverGL3 *drv, ItVtxPrgDrv
|| drv->_Extensions.ARBVertexProgram || drv->_Extensions.ARBVertexProgram
); );
#ifndef USE_OPENGLES
if (drv->_Extensions.NVVertexProgram) // NVIDIA implemntation if (drv->_Extensions.NVVertexProgram) // NVIDIA implemntation
{ {
// Generate a program // Generate a program
@ -65,7 +60,6 @@ CVertexProgamDrvInfosGL3::CVertexProgamDrvInfosGL3 (CDriverGL3 *drv, ItVtxPrgDrv
{ {
ID = nglGenVertexShadersEXT(1); // ATI implementation ID = nglGenVertexShadersEXT(1); // ATI implementation
} }
#endif
} }
@ -90,7 +84,6 @@ bool CDriverGL3::activeNVVertexProgram (CVertexProgram *program)
{ {
H_AUTO_OGL(CVertexProgamDrvInfosGL_activeNVVertexProgram); H_AUTO_OGL(CVertexProgamDrvInfosGL_activeNVVertexProgram);
#ifndef USE_OPENGLES
// Setup or unsetup ? // Setup or unsetup ?
if (program) if (program)
{ {
@ -200,13 +193,10 @@ bool CDriverGL3::activeNVVertexProgram (CVertexProgram *program)
// Ok // Ok
return true; return true;
} }
#endif
return false; return false;
} }
// *************************************************************************** // ***************************************************************************
#ifndef USE_OPENGLES
static static
inline GLenum convSwizzleToGLFormat(CVPSwizzle::EComp comp, bool negate) inline GLenum convSwizzleToGLFormat(CVPSwizzle::EComp comp, bool negate)
{ {
@ -243,7 +233,6 @@ inline GLenum convSwizzleToGLFormat(CVPSwizzle::EComp comp, bool negate)
} }
} }
} }
#endif
// *************************************************************************** // ***************************************************************************
/** Convert an output register to a EXTVertexShader register /** Convert an output register to a EXTVertexShader register
@ -252,7 +241,6 @@ static GLuint convOutputRegisterToEXTVertexShader(CVPOperand::EOutputRegister r)
{ {
H_AUTO_OGL(convOutputRegisterToEXTVertexShader); H_AUTO_OGL(convOutputRegisterToEXTVertexShader);
#ifndef USE_OPENGLES
switch (r) switch (r)
{ {
case CVPOperand::OHPosition: return GL_OUTPUT_VERTEX_EXT; case CVPOperand::OHPosition: return GL_OUTPUT_VERTEX_EXT;
@ -280,7 +268,6 @@ static GLuint convOutputRegisterToEXTVertexShader(CVPOperand::EOutputRegister r)
nlstop; nlstop;
break; break;
} }
#endif
return 0; return 0;
} }
@ -334,7 +321,6 @@ static void doSwizzle(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum ou
{ {
H_AUTO_OGL(doSwizzle); H_AUTO_OGL(doSwizzle);
#ifndef USE_OPENGLES
nglSwizzleEXT(res, in, outX, outY, outZ, outW); nglSwizzleEXT(res, in, outX, outY, outZ, outW);
#ifdef DEBUG_SETUP_EXT_VERTEX_SHADER #ifdef DEBUG_SETUP_EXT_VERTEX_SHADER
std::string swzStr = "Swizzle : "; std::string swzStr = "Swizzle : ";
@ -378,7 +364,6 @@ static void doSwizzle(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum ou
} }
EVS_INFO(swzStr.c_str()); EVS_INFO(swzStr.c_str());
#endif #endif
#endif
} }
// Perform write mask and output de bug information // Perform write mask and output de bug information
@ -386,7 +371,6 @@ static void doWriteMask(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum
{ {
H_AUTO_OGL(doWriteMask); H_AUTO_OGL(doWriteMask);
#ifndef USE_OPENGLES
nglWriteMaskEXT(res, in, outX, outY, outZ, outW); nglWriteMaskEXT(res, in, outX, outY, outZ, outW);
#ifdef DEBUG_SETUP_EXT_VERTEX_SHADER #ifdef DEBUG_SETUP_EXT_VERTEX_SHADER
nlinfo("3D: Write Mask : %c%c%c%c", nlinfo("3D: Write Mask : %c%c%c%c",
@ -396,7 +380,6 @@ static void doWriteMask(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum
outW ? 'w' : '-' outW ? 'w' : '-'
); );
#endif #endif
#endif
} }
// *************************************************************************** // ***************************************************************************
@ -406,7 +389,6 @@ bool CDriverGL3::setupEXTVertexShader(const CVPParser::TProgram &program, GLuint
{ {
H_AUTO_OGL(CDriverGL3_setupEXTVertexShader); H_AUTO_OGL(CDriverGL3_setupEXTVertexShader);
#ifndef USE_OPENGLES
// counter to see what is generated // counter to see what is generated
uint numOp = 0; uint numOp = 0;
uint numOpIndex = 0; uint numOpIndex = 0;
@ -1187,9 +1169,6 @@ bool CDriverGL3::setupEXTVertexShader(const CVPParser::TProgram &program, GLuint
#endif #endif
return true; return true;
#else
return false;
#endif
} }
//================================================================================================= //=================================================================================================
@ -1346,7 +1325,6 @@ bool CDriverGL3::setupARBVertexProgram (const CVPParser::TProgram &inParsedProgr
{ {
H_AUTO_OGL(CDriverGL3_setupARBVertexProgram); H_AUTO_OGL(CDriverGL3_setupARBVertexProgram);
#ifndef USE_OPENGLES
// tmp // tmp
CVPParser::TProgram parsedProgram = inParsedProgram; CVPParser::TProgram parsedProgram = inParsedProgram;
// //
@ -1481,9 +1459,6 @@ bool CDriverGL3::setupARBVertexProgram (const CVPParser::TProgram &inParsedProgr
#endif #endif
return true; return true;
#else
return false;
#endif
} }
@ -1493,7 +1468,6 @@ bool CDriverGL3::activeARBVertexProgram (CVertexProgram *program)
{ {
H_AUTO_OGL(CDriverGL3_activeARBVertexProgram); H_AUTO_OGL(CDriverGL3_activeARBVertexProgram);
#ifndef USE_OPENGLES
// Setup or unsetup ? // Setup or unsetup ?
if (program) if (program)
{ {
@ -1557,9 +1531,6 @@ bool CDriverGL3::activeARBVertexProgram (CVertexProgram *program)
_VertexProgramEnabled = false; _VertexProgramEnabled = false;
} }
return true; return true;
#else
return false;
#endif
} }
// *************************************************************************** // ***************************************************************************
@ -1567,7 +1538,6 @@ bool CDriverGL3::activeEXTVertexShader (CVertexProgram *program)
{ {
H_AUTO_OGL(CDriverGL3_activeEXTVertexShader); H_AUTO_OGL(CDriverGL3_activeEXTVertexShader);
#ifndef USE_OPENGLES
// Setup or unsetup ? // Setup or unsetup ?
if (program) if (program)
{ {
@ -1635,9 +1605,6 @@ bool CDriverGL3::activeEXTVertexShader (CVertexProgram *program)
_VertexProgramEnabled = false; _VertexProgramEnabled = false;
} }
return true; return true;
#else
return false;
#endif
} }
// *************************************************************************** // ***************************************************************************
@ -1669,7 +1636,6 @@ void CDriverGL3::setConstant (uint index, float f0, float f1, float f2, float f3
{ {
H_AUTO_OGL(CDriverGL3_setConstant); H_AUTO_OGL(CDriverGL3_setConstant);
#ifndef USE_OPENGLES
// Vertex program exist ? // Vertex program exist ?
if (_Extensions.NVVertexProgram) if (_Extensions.NVVertexProgram)
{ {
@ -1685,7 +1651,6 @@ void CDriverGL3::setConstant (uint index, float f0, float f1, float f2, float f3
float datas[] = { f0, f1, f2, f3 }; float datas[] = { f0, f1, f2, f3 };
nglSetInvariantEXT(_EVSConstantHandle + index, GL_FLOAT, datas); nglSetInvariantEXT(_EVSConstantHandle + index, GL_FLOAT, datas);
} }
#endif
} }
@ -1695,7 +1660,6 @@ void CDriverGL3::setConstant (uint index, double d0, double d1, double d2, doubl
{ {
H_AUTO_OGL(CDriverGL3_setConstant); H_AUTO_OGL(CDriverGL3_setConstant);
#ifndef USE_OPENGLES
// Vertex program exist ? // Vertex program exist ?
if (_Extensions.NVVertexProgram) if (_Extensions.NVVertexProgram)
{ {
@ -1711,7 +1675,6 @@ void CDriverGL3::setConstant (uint index, double d0, double d1, double d2, doubl
double datas[] = { d0, d1, d2, d3 }; double datas[] = { d0, d1, d2, d3 };
nglSetInvariantEXT(_EVSConstantHandle + index, GL_DOUBLE, datas); nglSetInvariantEXT(_EVSConstantHandle + index, GL_DOUBLE, datas);
} }
#endif
} }
@ -1721,7 +1684,6 @@ void CDriverGL3::setConstant (uint index, const NLMISC::CVector& value)
{ {
H_AUTO_OGL(CDriverGL3_setConstant); H_AUTO_OGL(CDriverGL3_setConstant);
#ifndef USE_OPENGLES
// Vertex program exist ? // Vertex program exist ?
if (_Extensions.NVVertexProgram) if (_Extensions.NVVertexProgram)
{ {
@ -1737,7 +1699,6 @@ void CDriverGL3::setConstant (uint index, const NLMISC::CVector& value)
float datas[] = { value.x, value.y, value.z, 0 }; float datas[] = { value.x, value.y, value.z, 0 };
nglSetInvariantEXT(_EVSConstantHandle + index, GL_FLOAT, datas); nglSetInvariantEXT(_EVSConstantHandle + index, GL_FLOAT, datas);
} }
#endif
} }
@ -1747,7 +1708,6 @@ void CDriverGL3::setConstant (uint index, const NLMISC::CVectorD& value)
{ {
H_AUTO_OGL(CDriverGL3_setConstant); H_AUTO_OGL(CDriverGL3_setConstant);
#ifndef USE_OPENGLES
// Vertex program exist ? // Vertex program exist ?
if (_Extensions.NVVertexProgram) if (_Extensions.NVVertexProgram)
{ {
@ -1763,7 +1723,6 @@ void CDriverGL3::setConstant (uint index, const NLMISC::CVectorD& value)
double datas[] = { value.x, value.y, value.z, 0 }; double datas[] = { value.x, value.y, value.z, 0 };
nglSetInvariantEXT(_EVSConstantHandle + index, GL_DOUBLE, datas); nglSetInvariantEXT(_EVSConstantHandle + index, GL_DOUBLE, datas);
} }
#endif
} }
@ -1772,7 +1731,6 @@ void CDriverGL3::setConstant (uint index, uint num, const float *src)
{ {
H_AUTO_OGL(CDriverGL3_setConstant); H_AUTO_OGL(CDriverGL3_setConstant);
#ifndef USE_OPENGLES
// Vertex program exist ? // Vertex program exist ?
if (_Extensions.NVVertexProgram) if (_Extensions.NVVertexProgram)
{ {
@ -1792,7 +1750,6 @@ void CDriverGL3::setConstant (uint index, uint num, const float *src)
nglSetInvariantEXT(_EVSConstantHandle + index + k, GL_FLOAT, (void *) (src + 4 * k)); nglSetInvariantEXT(_EVSConstantHandle + index + k, GL_FLOAT, (void *) (src + 4 * k));
} }
} }
#endif
} }
// *************************************************************************** // ***************************************************************************
@ -1800,7 +1757,6 @@ void CDriverGL3::setConstant (uint index, uint num, const double *src)
{ {
H_AUTO_OGL(CDriverGL3_setConstant); H_AUTO_OGL(CDriverGL3_setConstant);
#ifndef USE_OPENGLES
// Vertex program exist ? // Vertex program exist ?
if (_Extensions.NVVertexProgram) if (_Extensions.NVVertexProgram)
{ {
@ -1820,7 +1776,6 @@ void CDriverGL3::setConstant (uint index, uint num, const double *src)
nglSetInvariantEXT(_EVSConstantHandle + index + k, GL_DOUBLE, (void *) (src + 4 * k)); nglSetInvariantEXT(_EVSConstantHandle + index + k, GL_DOUBLE, (void *) (src + 4 * k));
} }
} }
#endif
} }
// *************************************************************************** // ***************************************************************************
@ -1829,11 +1784,7 @@ const uint CDriverGL3::GLMatrix[IDriver::NumMatrix]=
{ {
GL_MODELVIEW, GL_MODELVIEW,
GL_PROJECTION, GL_PROJECTION,
#ifdef USE_OPENGLES
GL_MODELVIEW
#else
GL_MODELVIEW_PROJECTION_NV GL_MODELVIEW_PROJECTION_NV
#endif
}; };
@ -1841,17 +1792,10 @@ const uint CDriverGL3::GLMatrix[IDriver::NumMatrix]=
const uint CDriverGL3::GLTransform[IDriver::NumTransform]= const uint CDriverGL3::GLTransform[IDriver::NumTransform]=
{ {
#ifdef USE_OPENGLES
0,
0,
0,
0
#else
GL_IDENTITY_NV, GL_IDENTITY_NV,
GL_INVERSE_NV, GL_INVERSE_NV,
GL_TRANSPOSE_NV, GL_TRANSPOSE_NV,
GL_INVERSE_TRANSPOSE_NV GL_INVERSE_TRANSPOSE_NV
#endif
}; };
@ -1861,7 +1805,6 @@ void CDriverGL3::setConstantMatrix (uint index, IDriver::TMatrix matrix, IDriver
{ {
H_AUTO_OGL(CDriverGL3_setConstantMatrix); H_AUTO_OGL(CDriverGL3_setConstantMatrix);
#ifndef USE_OPENGLES
// Vertex program exist ? // Vertex program exist ?
if (_Extensions.NVVertexProgram) if (_Extensions.NVVertexProgram)
{ {
@ -1931,7 +1874,6 @@ void CDriverGL3::setConstantMatrix (uint index, IDriver::TMatrix matrix, IDriver
nglSetInvariantEXT(_EVSConstantHandle + index + 3, GL_FLOAT, matDatas + 12); nglSetInvariantEXT(_EVSConstantHandle + index + 3, GL_FLOAT, matDatas + 12);
} }
} }
#endif
} }
// *************************************************************************** // ***************************************************************************
@ -1949,7 +1891,6 @@ void CDriverGL3::enableVertexProgramDoubleSidedColor(bool doubleSided)
{ {
H_AUTO_OGL(CDriverGL3_enableVertexProgramDoubleSidedColor); H_AUTO_OGL(CDriverGL3_enableVertexProgramDoubleSidedColor);
#ifndef USE_OPENGLES
// Vertex program exist ? // Vertex program exist ?
if (_Extensions.NVVertexProgram) if (_Extensions.NVVertexProgram)
{ {
@ -1967,7 +1908,6 @@ void CDriverGL3::enableVertexProgramDoubleSidedColor(bool doubleSided)
else else
glDisable (GL_VERTEX_PROGRAM_TWO_SIDE_ARB); glDisable (GL_VERTEX_PROGRAM_TWO_SIDE_ARB);
} }
#endif
} }

@ -49,12 +49,8 @@ using namespace NLMISC;
namespace NL3D { namespace NL3D {
#ifdef NL_STATIC #ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL3 { namespace NLDRIVERGL3 {
#endif #endif
#endif
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
@ -451,7 +447,6 @@ bool CDriverGL3::unInit()
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#ifndef USE_OPENGLES
// Off-screen rendering ? // Off-screen rendering ?
if (_PBuffer) if (_PBuffer)
{ {
@ -459,7 +454,6 @@ bool CDriverGL3::unInit()
nwglDestroyPbufferARB(_PBuffer); nwglDestroyPbufferARB(_PBuffer);
_PBuffer = NULL; _PBuffer = NULL;
} }
#endif
if (_Registered && !UnregisterClassW(L"NLClass", GetModuleHandle(NULL))) if (_Registered && !UnregisterClassW(L"NLClass", GetModuleHandle(NULL)))
{ {
@ -615,11 +609,9 @@ bool CDriverGL3::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool r
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
// Init pointers // Init pointers
#ifndef USE_OPENGLES
_PBuffer = NULL; _PBuffer = NULL;
_hRC = NULL; _hRC = NULL;
_hDC = NULL; _hDC = NULL;
#endif
// Driver caps. // Driver caps.
//============= //=============
@ -705,11 +697,7 @@ bool CDriverGL3::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool r
} }
// Register WGL functions // Register WGL functions
#ifdef USE_OPENGLES
registerEGlExtensions (_Extensions, tempHDC);
#else
registerWGlExtensions (_Extensions, tempHDC); registerWGlExtensions (_Extensions, tempHDC);
#endif
HDC hdc = wglGetCurrentDC (); HDC hdc = wglGetCurrentDC ();
@ -868,19 +856,11 @@ bool CDriverGL3::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool r
_CurrentMode.Depth = uint8(GetDeviceCaps (_hDC, BITSPIXEL)); _CurrentMode.Depth = uint8(GetDeviceCaps (_hDC, BITSPIXEL));
// Destroy the temp gl context // Destroy the temp gl context
#ifdef USE_OPENGLES
if (!eglDestroyContext(_EglDisplay, _EglContext);)
{
DWORD error = GetLastError ();
nlwarning ("CDriverGL3::setDisplay: wglDeleteContext failed: 0x%x", error);
}
#else
if (!wglDeleteContext (tempGLRC)) if (!wglDeleteContext (tempGLRC))
{ {
DWORD error = GetLastError (); DWORD error = GetLastError ();
nlwarning ("CDriverGL3::setDisplay: wglDeleteContext failed: 0x%x", error); nlwarning ("CDriverGL3::setDisplay: wglDeleteContext failed: 0x%x", error);
} }
#endif
// Destroy the temp windows // Destroy the temp windows
if (!DestroyWindow (tmpHWND)) if (!DestroyWindow (tmpHWND))
@ -894,13 +874,9 @@ bool CDriverGL3::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool r
DWORD error = GetLastError (); DWORD error = GetLastError ();
nlwarning ("CDriverGL3::setDisplay: wglMakeCurrent failed: 0x%x", error); nlwarning ("CDriverGL3::setDisplay: wglMakeCurrent failed: 0x%x", error);
#ifdef USE_OPENGLES
eglDestroyContext(_EglDisplay, _EglContext);
#else
wglDeleteContext (_hRC); wglDeleteContext (_hRC);
nwglReleasePbufferDCARB( _PBuffer, _hDC ); nwglReleasePbufferDCARB( _PBuffer, _hDC );
nwglDestroyPbufferARB( _PBuffer ); nwglDestroyPbufferARB( _PBuffer );
#endif
DestroyWindow (tmpHWND); DestroyWindow (tmpHWND);
_PBuffer = NULL; _PBuffer = NULL;
@ -1607,19 +1583,7 @@ bool CDriverGL3::destroyWindow()
std::vector<NLMISC::CBitmap> bitmaps; std::vector<NLMISC::CBitmap> bitmaps;
setWindowIcon(bitmaps); setWindowIcon(bitmaps);
#ifdef USE_OPENGLES #if defined(NL_OS_WINDOWS)
if (_EglDisplay && _EglContext)
{
eglMakeCurrent(_EglDisplay, _EglSurface, _EglSurface, _EglContext);
if (_DestroyWindow)
{
eglDestroyContext(_EglDisplay, _EglContext);
}
}
#elif defined(NL_OS_WINDOWS)
// Then delete. // Then delete.
// wglMakeCurrent(NULL,NULL); // wglMakeCurrent(NULL,NULL);
@ -2377,106 +2341,7 @@ emptyProc CDriverGL3::getWindowProc()
// -------------------------------------------------- // --------------------------------------------------
bool CDriverGL3::createContext() bool CDriverGL3::createContext()
{ {
#ifdef USE_OPENGLES #if defined(NL_OS_WINDOWS)
uint samples = 0;
if (_CurrentMode.AntiAlias > -1)
{
if (_CurrentMode.AntiAlias == 0)
{
samples = 4;
}
else
{
samples = _CurrentMode.AntiAlias;
}
}
EGLint attribList[] =
{
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, 8,
// EGL_SAMPLE_BUFFERS, _CurrentMode.AntiAlias > -1 ? 1:0,
// EGL_SAMPLES, samples,
EGL_RENDERABLE_TYPE,
EGL_OPENGL_ES_BIT,
EGL_NONE
};
// Get Display
_EglDisplay = EGL_NO_DISPLAY; // eglGetDisplay(_hDC);
if (_EglDisplay == EGL_NO_DISPLAY)
{
_EglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (_EglDisplay == EGL_NO_DISPLAY)
{
nlwarning("3D: failed to get display 0x%x", eglGetError());
return false;
}
}
// Initialize EGL
EGLint majorVersion;
EGLint minorVersion;
if (!eglInitialize(_EglDisplay, &majorVersion, &minorVersion))
{
return EGL_FALSE;
}
const char *extensions = eglQueryString(_EglDisplay, EGL_EXTENSIONS);
// Get configs
EGLint numConfigs;
if (!eglGetConfigs(_EglDisplay, NULL, 0, &numConfigs))
{
return false;
}
// Choose config
EGLConfig config = NULL;
if (!eglChooseConfig(_EglDisplay, attribList, &config, 1, &numConfigs))
{
return false;
}
// Create a surface
_EglSurface = eglCreateWindowSurface(_EglDisplay, config, (EGLNativeWindowType)_win, NULL);
if (_EglSurface == EGL_NO_SURFACE)
{
return false;
}
// Create a GL context
EGLint contextAttribs[] =
{
EGL_CONTEXT_CLIENT_VERSION, 1,
EGL_NONE
};
_EglContext = eglCreateContext(_EglDisplay, config, EGL_NO_CONTEXT, contextAttribs);
if (_EglContext == EGL_NO_CONTEXT)
{
return false;
}
// Make the context current
if (!eglMakeCurrent(_EglDisplay, _EglSurface, _EglSurface, _EglContext))
{
return false;
}
#elif defined(NL_OS_WINDOWS)
_hDC = GetDC(_win); _hDC = GetDC(_win);
_CurrentMode.Depth = uint8(GetDeviceCaps(_hDC,BITSPIXEL)); _CurrentMode.Depth = uint8(GetDeviceCaps(_hDC,BITSPIXEL));
@ -2526,20 +2391,7 @@ bool CDriverGL3::activate()
if (_win == EmptyWindow) if (_win == EmptyWindow)
return false; return false;
#ifdef USE_OPENGLES #if defined(NL_OS_WINDOWS)
EGLContext ctx = eglGetCurrentContext();
if (ctx != _EglContext)
{
// Make the context current
if (!eglMakeCurrent(_EglDisplay, _EglSurface, _EglSurface, _EglContext))
{
return false;
}
}
#elif defined(NL_OS_WINDOWS)
HGLRC hglrc = wglGetCurrentContext(); HGLRC hglrc = wglGetCurrentContext();
@ -2558,7 +2410,7 @@ bool CDriverGL3::activate()
if (nctx != NULL && nctx != _ctx) if (nctx != NULL && nctx != _ctx)
glXMakeCurrent(_dpy, _win, _ctx); glXMakeCurrent(_dpy, _win, _ctx);
#endif // USE_OPENGLES #endif
return true; return true;
} }
@ -2614,14 +2466,11 @@ void CDriverGL3::getWindowSize(uint32 &width, uint32 &height)
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#ifndef USE_OPENGLES
if (_PBuffer) if (_PBuffer)
{ {
nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_WIDTH_ARB, (int*)&width ); nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_WIDTH_ARB, (int*)&width );
nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_HEIGHT_ARB, (int*)&height ); nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_HEIGHT_ARB, (int*)&height );
} }
#endif
#endif #endif
} }
else else

@ -39,26 +39,19 @@
# include <windowsx.h> # include <windowsx.h>
#endif #endif
#ifdef USE_OPENGLES #ifdef NL_OS_WINDOWS
# include "GLES/gl.h" #include <GL/gl.h>
# include "GLES/glext.h" #include "GL/wglext.h"
# include "EGL/egl.h" #elif defined(NL_OS_MAC)
# include "EGL/eglext.h" #define GL_GLEXT_LEGACY
#else #include <OpenGL/gl.h>
# ifdef NL_OS_WINDOWS #elif defined (NL_OS_UNIX)
# include <GL/gl.h> #define GLX_GLXEXT_PROTOTYPES
# include "GL/wglext.h" #include <GL/gl.h>
# elif defined(NL_OS_MAC) #include <GL/glx.h>
# define GL_GLEXT_LEGACY #include "GL/glxext.h"
# include <OpenGL/gl.h>
# elif defined (NL_OS_UNIX)
# define GLX_GLXEXT_PROTOTYPES
# include <GL/gl.h>
# include <GL/glx.h>
# include "GL/glxext.h"
# endif
# include "GL/glext.h"
#endif #endif
#include "GL/glext.h"
#include "nel/misc/common.h" #include "nel/misc/common.h"
#include "nel/misc/debug.h" #include "nel/misc/debug.h"

Loading…
Cancel
Save