소스 검색

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

legacy
Sam Hocevar sam 13 년 전
부모
커밋
bc331e0116
2개의 변경된 파일20개의 추가작업 그리고 0개의 파일을 삭제
  1. +10
    -0
      src/debug/quad.cpp
  2. +10
    -0
      src/scene.cpp

+ 10
- 0
src/debug/quad.cpp 파일 보기

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

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

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

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

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


+ 10
- 0
src/scene.cpp 파일 보기

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

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

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

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


불러오는 중...
취소
저장