Browse Source

ps3: some compilation fixes to accomodate for recent debug additions.

legacy
Sam Hocevar sam 13 years ago
parent
commit
6ef55ca61f
2 changed files with 24 additions and 1 deletions
  1. +20
    -1
      src/debug/quad.cpp
  2. +4
    -0
      src/shader/shader.cpp

+ 20
- 1
src/debug/quad.cpp View File

@@ -45,7 +45,9 @@ private:


int initialised; int initialised;
float time; float time;
#if !defined __CELLOS_LV2__
GLuint array[NUM_ARRAYS]; GLuint array[NUM_ARRAYS];
#endif
GLuint buffer[NUM_BUFFERS]; GLuint buffer[NUM_BUFFERS];
Shader *shader[NUM_SHADERS]; Shader *shader[NUM_SHADERS];
GLuint attr[NUM_ATTRS]; GLuint attr[NUM_ATTRS];
@@ -79,7 +81,9 @@ void DebugQuad::TickDraw(float deltams)


if (!data->initialised && !IsDestroying()) if (!data->initialised && !IsDestroying())
{ {
#if !defined __CELLOS_LV2__
glGenVertexArrays(NUM_ARRAYS, data->array); glGenVertexArrays(NUM_ARRAYS, data->array);
#endif
glGenBuffers(NUM_BUFFERS, data->buffer); glGenBuffers(NUM_BUFFERS, data->buffer);
glGenTextures(NUM_TEXTURES, data->texture); glGenTextures(NUM_TEXTURES, data->texture);
for (int i = 0; i < NUM_SHADERS; i++) for (int i = 0; i < NUM_SHADERS; i++)
@@ -107,7 +111,9 @@ void DebugQuad::TickDraw(float deltams)
} }
else if (data->initialised && IsDestroying()) else if (data->initialised && IsDestroying())
{ {
#if !defined __CELLOS_LV2__
glDeleteVertexArrays(NUM_ARRAYS, data->array); glDeleteVertexArrays(NUM_ARRAYS, data->array);
#endif
glDeleteBuffers(NUM_BUFFERS, data->buffer); glDeleteBuffers(NUM_BUFFERS, data->buffer);
glDeleteTextures(NUM_TEXTURES, data->texture); glDeleteTextures(NUM_TEXTURES, data->texture);


@@ -215,6 +221,7 @@ void DebugQuad::TickDraw(float deltams)
* *
* Renders a static, coloured and tiled pattern. * Renders a static, coloured and tiled pattern.
*/ */
#if !defined __CELLOS_LV2__
if (!data->shader[0]) if (!data->shader[0])
data->shader[0] = Shader::Create( data->shader[0] = Shader::Create(
"#version 110\n" "#version 110\n"
@@ -246,6 +253,7 @@ void DebugQuad::TickDraw(float deltams)


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


/* /*
* Test #5: glBegin + pass vertex coord from vertex shader to fragment * Test #5: glBegin + pass vertex coord from vertex shader to fragment
@@ -253,6 +261,7 @@ void DebugQuad::TickDraw(float deltams)
* *
* Renders a multicolored square with varying colors. * Renders a multicolored square with varying colors.
*/ */
#if !defined __CELLOS_LV2__
if (!data->shader[1]) if (!data->shader[1])
data->shader[1] = Shader::Create( data->shader[1] = Shader::Create(
"#version 110\n" "#version 110\n"
@@ -288,11 +297,11 @@ void DebugQuad::TickDraw(float deltams)
glTexCoord3f(f1, f2, f3); glTexCoord3f(f1, f2, f3);
glVertex3f(data->aa.x, data->bb.y, 0.0f); glVertex3f(data->aa.x, data->bb.y, 0.0f);
glEnd(); glEnd();
glEnd();
glUseProgram(0); glUseProgram(0);


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


/* /*
* Test #6: glBegin + apply texture in fragment shader * Test #6: glBegin + apply texture in fragment shader
@@ -303,6 +312,7 @@ void DebugQuad::TickDraw(float deltams)
* Note: there is no need to glEnable(GL_TEXTURE_2D) when the * Note: there is no need to glEnable(GL_TEXTURE_2D) when the
* texture lookup is done in a shader. * texture lookup is done in a shader.
*/ */
#if !defined __CELLOS_LV2__
if (!data->shader[2]) if (!data->shader[2])
data->shader[2] = Shader::Create( data->shader[2] = Shader::Create(
"#version 110\n" "#version 110\n"
@@ -340,6 +350,7 @@ void DebugQuad::TickDraw(float deltams)


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


/* /*
@@ -405,6 +416,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 (!data->shader[3]) if (!data->shader[3])
data->shader[3] = Shader::Create( data->shader[3] = Shader::Create(
"#version 110\n" "#version 110\n"
@@ -451,6 +463,7 @@ void DebugQuad::TickDraw(float deltams)


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


/* /*
* Test #10: vertex buffer + texture & color in 1.20 fragment shader * Test #10: vertex buffer + texture & color in 1.20 fragment shader
@@ -458,6 +471,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 (!data->shader[4]) if (!data->shader[4])
{ {
data->shader[4] = Shader::Create( data->shader[4] = Shader::Create(
@@ -525,6 +539,7 @@ void DebugQuad::TickDraw(float deltams)


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


/* /*
* Test #11: vertex buffer + texture & color in 1.30 fragment shader * Test #11: vertex buffer + texture & color in 1.30 fragment shader
@@ -532,6 +547,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 (!data->shader[5]) if (!data->shader[5])
{ {
data->shader[5] = Shader::Create( data->shader[5] = Shader::Create(
@@ -599,6 +615,7 @@ void DebugQuad::TickDraw(float deltams)


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


void DebugQuad::ResetState() void DebugQuad::ResetState()
@@ -615,7 +632,9 @@ void DebugQuad::ResetState()
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);


glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0);
#if !defined __CELLOS_LV2__
glUseProgram(0); glUseProgram(0);
#endif
} }


void DebugQuad::Advance() void DebugQuad::Advance()


+ 4
- 0
src/shader/shader.cpp View File

@@ -24,6 +24,8 @@
#include "core.h" #include "core.h"
#include "lolgl.h" #include "lolgl.h"


using namespace std;

namespace lol namespace lol
{ {


@@ -174,6 +176,7 @@ int ShaderData::GetVersion()
{ {
static int version = 0; static int version = 0;


#if !defined __CELLOS_LV2__
if (!version) if (!version)
{ {
char buf[4096]; char buf[4096];
@@ -210,6 +213,7 @@ int ShaderData::GetVersion()


glDeleteShader(id); glDeleteShader(id);
} }
#endif


return version; return version;
} }


Loading…
Cancel
Save