Browse Source

debug: make the GL test compile on Android.

legacy
Sam Hocevar sam 13 years ago
parent
commit
66102168e3
1 changed files with 13 additions and 5 deletions
  1. +13
    -5
      src/debug/quad.cpp

+ 13
- 5
src/debug/quad.cpp View File

@@ -81,7 +81,7 @@ void DebugQuad::TickDraw(float deltams)


if (!data->initialised && !IsDestroying()) if (!data->initialised && !IsDestroying())
{ {
#if !defined __CELLOS_LV2__
#if !defined __CELLOS_LV2__ && !defined ANDROID_NDK
glGenVertexArrays(NUM_ARRAYS, data->array); glGenVertexArrays(NUM_ARRAYS, data->array);
#endif #endif
glGenBuffers(NUM_BUFFERS, data->buffer); glGenBuffers(NUM_BUFFERS, data->buffer);
@@ -111,7 +111,7 @@ void DebugQuad::TickDraw(float deltams)
} }
else if (data->initialised && IsDestroying()) else if (data->initialised && IsDestroying())
{ {
#if !defined __CELLOS_LV2__
#if !defined __CELLOS_LV2__ && !defined ANDROID_NDK
glDeleteVertexArrays(NUM_ARRAYS, data->array); glDeleteVertexArrays(NUM_ARRAYS, data->array);
#endif #endif
glDeleteBuffers(NUM_BUFFERS, data->buffer); glDeleteBuffers(NUM_BUFFERS, data->buffer);
@@ -353,6 +353,7 @@ void DebugQuad::TickDraw(float deltams)
#endif #endif
#endif #endif


#if !defined ANDROID_NDK
/* /*
* Test #7: vertex buffer + per-vertex coloring * Test #7: vertex buffer + per-vertex coloring
* *
@@ -377,6 +378,7 @@ void DebugQuad::TickDraw(float deltams)


Advance(); Advance();
ResetState(); ResetState();
#endif


/* /*
* Test #8: vertex buffer + per-vertex coloring + texture * Test #8: vertex buffer + per-vertex coloring + texture
@@ -384,6 +386,7 @@ void DebugQuad::TickDraw(float deltams)
* Renders a multicolored square with varying colors multiplied with an * Renders a multicolored square with varying colors multiplied with an
* animated distorted checkerboard. * animated distorted checkerboard.
*/ */
#if !defined ANDROID_NDK
GLfloat const vertices2[] = { data->aa.x, data->bb.y, 0.0f, GLfloat const vertices2[] = { data->aa.x, data->bb.y, 0.0f,
data->bb.x, data->bb.y, 0.0f, data->bb.x, data->bb.y, 0.0f,
data->bb.x, data->aa.y, 0.0f, data->bb.x, data->aa.y, 0.0f,
@@ -409,6 +412,7 @@ void DebugQuad::TickDraw(float deltams)


Advance(); Advance();
ResetState(); ResetState();
#endif


/* /*
* Test #9: vertex buffer + texture & color in 1.10 fragment shader * Test #9: vertex buffer + texture & color in 1.10 fragment shader
@@ -416,7 +420,7 @@ void DebugQuad::TickDraw(float deltams)
* Renders a multicolored square with varying colors xored with an * Renders a multicolored square with varying colors xored with an
* animated distorted checkerboard. * animated distorted checkerboard.
*/ */
#if !defined __CELLOS_LV2__
#if !defined __CELLOS_LV2__ && !defined ANDROID_NDK
if (!data->shader[3]) if (!data->shader[3])
data->shader[3] = Shader::Create( data->shader[3] = Shader::Create(
"#version 110\n" "#version 110\n"
@@ -471,7 +475,7 @@ void DebugQuad::TickDraw(float deltams)
* Renders a multicolored square with varying colors xored with an * Renders a multicolored square with varying colors xored with an
* animated distorted checkerboard. * animated distorted checkerboard.
*/ */
#if !defined __CELLOS_LV2__
#if !defined __CELLOS_LV2__ && !defined ANDROID_NDK
if (!data->shader[4]) if (!data->shader[4])
{ {
data->shader[4] = Shader::Create( data->shader[4] = Shader::Create(
@@ -547,7 +551,7 @@ void DebugQuad::TickDraw(float deltams)
* Renders a multicolored square with varying colors xored with an * Renders a multicolored square with varying colors xored with an
* animated distorted checkerboard. * animated distorted checkerboard.
*/ */
#if !defined __CELLOS_LV2__
#if !defined __CELLOS_LV2__ && !defined ANDROID_NDK
if (!data->shader[5]) if (!data->shader[5])
{ {
data->shader[5] = Shader::Create( data->shader[5] = Shader::Create(
@@ -621,14 +625,18 @@ void DebugQuad::TickDraw(float deltams)
void DebugQuad::ResetState() void DebugQuad::ResetState()
{ {
/* Reset GL states to something reasonably safe */ /* Reset GL states to something reasonably safe */
#if defined HAVE_GLBEGIN || defined USE_GLEW
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
#endif


glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
#if defined HAVE_GLBEGIN || defined USE_GLEW
glClientActiveTexture(GL_TEXTURE0); glClientActiveTexture(GL_TEXTURE0);
#endif
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);


glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0);


Loading…
Cancel
Save