Problem with setting up GLES


mft

Still Fresh
Joined
Oct 13, 2010
Messages
4
Hi, I'm running in to a problem with my project.


I'm trying to get an OpenGL context, but the program freezes my Pandora to a point that I can only move my mouse and needs a hard-reset.


I've setup DJWillis' Cross Compiler (http://blogs.distant-earth.com/wp/?p=109) in Virtual Box (+Ubuntu 11.04) and my project compiles without a problem.


I use the code from the wiki (http://pandorawiki.org/Combining_OpenGL_ES_1.1_and_SDL_to_create_a_window_on_the_Pandora) to setup a window. (I call InitOpenGL(); directly after SDL_SetVideoMode(800, 480, 0, SDL_SWSURFACE | SDL_FULLSCREEN); )


I've found that my program doesn't crash if I remove SDL_GL_SwapBuffers(); from my code.


Is there something I'm missing?


Thanks in advance.
 
I've found that my program doesn't crash if I remove SDL_GL_SwapBuffers(); from my code.


Is there something I'm missing?

in the stock SDL library SDL_GL* do nothing for OpenGL-ES. You have to use EGL and as mcobit suggested the eglport code with allow you to use SDL with EGL. Your SDL_SetVideoMode is correct.
 
Thanks for the quick replies.

I've found that my program doesn't crash if I remove SDL_GL_SwapBuffers(); from my code.


Is there something I'm missing?

in the stock SDL library SDL_GL* do nothing for OpenGL-ES. You have to use EGL and as mcobit suggested the eglport code with allow you to use SDL with EGL. Your SDL_SetVideoMode is correct.

My mistake I meant EGL_SwapBuffers(); as I use:



Code:
void OS_swapBuffer(){

	#ifdef _GLES

	EGL_SwapBuffers();

	#else

	SDL_GL_SwapBuffers();

	#endif

}

It didn't crash if I removed the call to that function form my main loop. Thus I thought that there was the problem.



I'm now trying compile with eglport, but I get a compile error:



Code:
../MGP/Source/OS/GLES/eglport.cpp: In function ‘void EGL_Destroy()’:

../MGP/Source/OS/GLES/eglport.cpp:73: error: ‘close’ was not declared in this scope

from this chunk of code:



Code:
void EGL_Destroy(){

    ...

    /* Pandora VSync */

    close(fbdev); //73

    fbdev = -1;

    /* Pandora VSync End */

}

Do I need to add an #include?
 
Thanks for the quick replies.



Code:
../MGP/Source/OS/GLES/eglport.cpp: In function ‘void EGL_Destroy()’:

../MGP/Source/OS/GLES/eglport.cpp:73: error: ‘close’ was not declared in this scope


Do I need to add an #include?
#include <unistd.h>
 
Thanks a lot for the help.


Everything seems to run fine now, until I call SDL_Quit();


At the end of the program it first quits the SDL video sub system:



Code:
	EGL_Destroy();


	if(SDL_WasInit(SDL_INIT_VIDEO)){


		SDL_QuitSubSystem(SDL_INIT_VIDEO);

	}


and after that SDL_Quit(), which will freeze the OS (except for the mouse).


If I comment out SDL_Quit() the OS won't freeze.


The OS also freezes if I comment out SDL_QuitSubSystem(SDL_INIT_VIDEO) (and leave SDL_Quit() in).


SDL_GetError() doesn't give anything before SDL_Quit().


The program works as expected in Ubuntu32bit (without the EGL/GLES stuff).


Is it safe to leave out the SDL_Quit(), Or should I try to find the problem?
 
I tried calling EGL_Destroy() after SDL_Quit() and removing EGL_Destroy() completely, but it has no effect.


I was googling and found this:

Unless we disable threads, the timer code will use them, creating some nasty and hard-to-track freezes in SDL_Quit().
from http://ipl.derpapst.eu/wiki/Building_SDL#iPod_build

Just a guess based on gdb output:



Code:
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

I do use SDL_Init(SDL_INIT_TIMER) and SDL_GetTicks(), could that be the problem?
 
I tried calling EGL_Destroy() after SDL_Quit() and removing EGL_Destroy() completely, but it has no effect.


I was googling and found this:

Unless we disable threads, the timer code will use them, creating some nasty and hard-to-track freezes in SDL_Quit().
from http://ipl.derpapst...._SDL#iPod_build

Just a guess based on gdb output:



Code:
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

I do use SDL_Init(SDL_INIT_TIMER) and SDL_GetTicks(), could that be the problem?
SDL_threads are used by SDL_mixer, and works fine on pandora, most games use SDL_GetTicks and isnt a problem, even on pandora (btw, SDL always start the timer even if you dont explicitly ask for).


the gdb messages are a know problem on the current OS and have nothing to do with your code : gdb is just saying you he will only debug main thread. all SDL apps are threaded and gdb will always display this on sdl apps on our curent OS.


Check this, to know where the EGL_* calls have to be in your code.
 
Back
Top