I am working with SDL and OpenGL, I create the SDL_Surface and SDL_SetVideoMode:
SDL_Init(SDL_INIT_EVERYTHING);
const SDL_VideoInfo * dinfo = SDL_GetVideoInfo();
// Setup the surface of SDL
if(configurer::fullscreened){
data::Wnd_Surface = SDL_SetVideoMode(configurer::window_width,configurer::window_height,dinfo->vfmt->BitsPerPixel,SDL_FULLSCREEN | SDL_OPENGL);
}else{
data::Wnd_Surface = SDL_SetVideoMode(configurer::window_width,configurer::window_height,16,SDL_OPENGL);
}
if(data::Wnd_Surface==0){
return -1;
}
SDL_WM_SetCaption("Test", "Test");
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
// Initialize GLEW
if(glewInit()!=0){
cout << "Failed to start glew";
return -1;
}
I init it in my main function, then I have the following (on the main function):
while(!data::terminate){
AscMainLoop();
SDL_Delay(80);
}
return 0;
Everything fine. My AscMainLoop function:
int timerelapse = SDL_GetTicks();
//Check for key events
/* BLA BLA BLA *(
AscUpdateComponents(); // Update matrixes and bla bla bla...
AscRender();// Paint
// Fps Counter Update
/* BLA BLA BLA */
SDL_GL_SwapBuffers();// Swap the buffers of our screen
Ok, I am having an issue, I run the application, but the screen does not answer, I think the problem is the while loop on the main.
The window opens, but I can’t drag it, resize it, it’s like a wait status on the window (With the funny “please wait” cursor of windows 7) activates.
I already tried to put the main loop in a thread. I don’t know what’s happening…
Edit: It’s like a freez status caused by the loop at the main function
You need to process your
SDL_Events either in yourwhileor in yourAscMainLoopby doing something like: