Sdl 1.3 Help, No Graphics


MUMBL35

Still Fresh
Joined
Jun 6, 2010
Messages
44
I'm looking for some help on a game I'm working on. I have it set up to compile both on Linux and the Pandora using DJ Willis toolchain. I'm able to build the program on both systems. The only difference between this code is:

#ifdef PANDORA
#include <SDL_Pandora/SDL.h>
#include <SDL_Pandora/SDL_opengles.h>
#else
#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
#endif

Where the SDL_Pandora is the location of the Cpasjuste SDL 1.3 build for pandora.

The other difference is glOrtho vs. glOrthof.

On the pandora the window appears, but nothing is drawn. I have an FPS status at the top and the draw calls are happening, but the window is black.

The progam uses SDL_image to load pngs for the display.

Looking for any tips on what to check.

Here is the code to draw the textures:

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glVertexPointer(2, GL_FLOAT, 0,vertexs);
glTexCoordPointer(2, GL_FLOAT, 0, coords);

glDrawArrays(GL_TRIANGLES,0,quadCount);

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);

and then I use:

SDL_GL_SwapBuffers();
 
Also, here is my initialize code for my 2D view:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrthof(0.0f, (GLfloat)width, 0.0f, (GLfloat)height, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
 
A couple of things:

1. To verify that you have a functioning GL context and buffer swapping works - clear the viewport on every frame, alternating the color every time:

Code:
static float red = 0.f;
*reinterpret_cast< int* >(&red) ^= 0x3f800000;

glClearColor(red, green, blue, alpha);
glClear(GL_COLOR_BUFFER_BIT);

2. To verify that you polygon winding is not off - disable culling:

Code:
glDisable(GL_CULL_FACE);

Extra points to verify, just in case:
1. Make sure depth testing does not interfere with the picture (glDisable(GL_DEPTH_TEST))
2. Make sure scissor testing does not interfere with the picture (glDisable(GL_SCISSOR_TEST))
 
Since it's SDL 1.3, try using SDL_GL_SwapWindow instead of SwapBuffers.

In any case, do tell us when you have a solution.
 
pocak said:
Since it's SDL 1.3, try using SDL_GL_SwapWindow instead of SwapBuffers.

In any case, do tell us when you have a solution.

Well, I wanted to try and go back to an unmodified SDL 1.2 for compatiability. I restored the toolchain to the original settings and I'm able to compile, but when I try to run on the pandora I get the error "Failed loading libGL.so.1" from SDL when I do SDL_CreateWindow. I'm linking the GLES_CM. Any ideas there?

Edit: its acutally SDL_SetVideoMode that creates the error.
 
Last edited by a moderator:
OK now I got it running and I have some graphics, but now all my graphics are just white squares, no textures.
 
Back
Top