Browse Source

gl: do not enable or disable GL_TEXTURE_2D with GLES 2.0, it's now illegal.

legacy
Sam Hocevar sam 14 years ago
parent
commit
bc331e0116
2 changed files with 20 additions and 0 deletions
  1. +10
    -0
      src/debug/quad.cpp
  2. +10
    -0
      src/scene.cpp

+ 10
- 0
src/debug/quad.cpp View File

@@ -162,7 +162,9 @@ void DebugQuad::TickDraw(float deltams)
data->shader[i] = NULL; data->shader[i] = NULL;


/* Checkerboard texture */ /* Checkerboard texture */
#if !defined HAVE_GLES_2X
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
#endif
glBindTexture(GL_TEXTURE_2D, data->texture[0]); glBindTexture(GL_TEXTURE_2D, data->texture[0]);
for (int j = 0; j < TEX_SIZE; j++) for (int j = 0; j < TEX_SIZE; j++)
for (int i = 0; i < TEX_SIZE; i++) for (int i = 0; i < TEX_SIZE; i++)
@@ -303,7 +305,9 @@ void DebugQuad::TickDraw(float deltams)
* animated distorted checkerboard. * animated distorted checkerboard.
*/ */
#if defined HAVE_GLBEGIN || defined USE_GLEW #if defined HAVE_GLBEGIN || defined USE_GLEW
#if !defined HAVE_GLES_2X
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
#endif
glBindTexture(GL_TEXTURE_2D, data->texture[0]); glBindTexture(GL_TEXTURE_2D, data->texture[0]);
glColor3f(1.0f, 1.0f, 1.0f); glColor3f(1.0f, 1.0f, 1.0f);
glBegin(GL_TRIANGLES); glBegin(GL_TRIANGLES);
@@ -327,7 +331,9 @@ void DebugQuad::TickDraw(float deltams)
glTexCoord2f(texcoords[10], texcoords[11]); glTexCoord2f(texcoords[10], texcoords[11]);
glVertex3f(data->aa.x, data->bb.y, 0.0f); glVertex3f(data->aa.x, data->bb.y, 0.0f);
glEnd(); glEnd();
#if !defined HAVE_GLES_2X
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
#endif
#endif #endif


Advance(); Advance();
@@ -1077,7 +1083,9 @@ void DebugQuad::ResetState()
glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
#endif #endif


#if !defined HAVE_GLES_2X
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
#endif
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
#if defined HAVE_GLBEGIN || defined USE_GLEW || defined __CELLOS_LV2__ #if defined HAVE_GLBEGIN || defined USE_GLEW || defined __CELLOS_LV2__
glClientActiveTexture(GL_TEXTURE0); glClientActiveTexture(GL_TEXTURE0);
@@ -1085,7 +1093,9 @@ void DebugQuad::ResetState()
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ #if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__
glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_FALSE); glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_FALSE);
#endif #endif
#if !defined HAVE_GLES_2X
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
#endif


glDisable(GL_BLEND); glDisable(GL_BLEND);
#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__ #if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined __native_client__


+ 10
- 0
src/scene.cpp View File

@@ -137,7 +137,9 @@ void Scene::Render() // XXX: rename to Blit()
{ {
#if !defined __CELLOS_LV2__ #if !defined __CELLOS_LV2__
stdshader = Shader::Create( stdshader = Shader::Create(
#if !defined HAVE_GLES_2X
"#version 130\n" "#version 130\n"
#endif
"\n" "\n"
#if defined HAVE_GLES_2X #if defined HAVE_GLES_2X
"attribute vec3 in_Position;\n" "attribute vec3 in_Position;\n"
@@ -162,7 +164,11 @@ void Scene::Render() // XXX: rename to Blit()
#endif #endif
"}\n", "}\n",


#if !defined HAVE_GLES_2X
"#version 130\n" "#version 130\n"
#else
"precision mediump float;\n"
#endif
"\n" "\n"
"uniform sampler2D in_Texture;\n" "uniform sampler2D in_Texture;\n"
#if defined HAVE_GLES_2X #if defined HAVE_GLES_2X
@@ -317,7 +323,9 @@ void Scene::Render() // XXX: rename to Blit()
//cgGLSetParameter1i((CGparameter)(intptr_t)uni_tex, 0); //cgGLSetParameter1i((CGparameter)(intptr_t)uni_tex, 0);
#endif #endif


#if !defined HAVE_GLES_2X
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
#endif
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL); glDepthFunc(GL_LEQUAL);
#if defined HAVE_GL_2X && !defined __APPLE__ #if defined HAVE_GL_2X && !defined __APPLE__
@@ -405,7 +413,9 @@ void Scene::Render() // XXX: rename to Blit()
data->tiles = 0; data->tiles = 0;
data->ntiles = 0; data->ntiles = 0;


#if !defined HAVE_GLES_2X
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
#endif
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
#if defined HAVE_GL_2X && !defined __APPLE__ #if defined HAVE_GL_2X && !defined __APPLE__
glDisable(GL_ALPHA_TEST); glDisable(GL_ALPHA_TEST);


Loading…
Cancel
Save