From 37adf506015217f5eeed13c8c86610cbf4c9a1cf Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 1 May 2011 18:27:05 +0200 Subject: [PATCH] Changed: #1275 Create an OpenGL ES driver --- .../3d/driver/opengl/driver_opengl_light.cpp | 5 + .../3d/driver/opengl/driver_opengl_matrix.cpp | 15 ++- .../3d/driver/opengl/driver_opengl_states.cpp | 98 ++++++++++++++++--- .../3d/driver/opengl/driver_opengl_vertex.cpp | 52 +++++++++- .../driver_opengl_vertex_buffer_hard.cpp | 15 ++- 5 files changed, 169 insertions(+), 16 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp index 073d39176..e5c3cff6e 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp @@ -139,8 +139,13 @@ void CDriverGL::setLightInternal(uint8 num, const CLight& light) else { // Deactivate spot properties +#ifdef USE_OPENGLES + glLightf (lightNum, GL_SPOT_CUTOFF, 180.f); + glLightf (lightNum, GL_SPOT_EXPONENT, 0.f); +#else glLighti (lightNum, GL_SPOT_CUTOFF, 180); glLighti (lightNum, GL_SPOT_EXPONENT, 0); +#endif } // Flag this light as dirt. diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp index 0e5cea073..4106c38f2 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp @@ -15,24 +15,35 @@ // along with this program. If not, see . #include "stdopengl.h" - #include "driver_opengl.h" + namespace NL3D { // *************************************************************************** void CDriverGL::setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective) { - H_AUTO_OGL(CDriverGL_setFrustum) + H_AUTO_OGL(CDriverGL_setFrustum); + glMatrixMode(GL_PROJECTION); glLoadIdentity(); + if (perspective) { +#ifdef USE_OPENGLES + glFrustumf(left,right,bottom,top,znear,zfar); +#else glFrustum(left,right,bottom,top,znear,zfar); +#endif } else { +#ifdef USE_OPENGLES + glOrthof(left,right,bottom,top,znear,zfar); +#else glOrtho(left,right,bottom,top,znear,zfar); +#endif } + _ProjMatDirty = true; // Backup znear and zfar for zbias setup diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp index fb4f14dc2..e0c79c504 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp @@ -144,33 +144,62 @@ void CDriverGLStates::forceDefaults(uint nbStages) for(stage=0;stage_Extensions.OESMapBuffer) + { + unmapOk = nglUnmapBufferOES(GL_ARRAY_BUFFER); + } +#else + unmapOk = nglUnmapBufferARB(GL_ARRAY_BUFFER_ARB); +#endif + #ifdef NL_DEBUG _Unmapping = false; #endif