   Problem with opengl+sdl
  I'm making a little engine for my game. I am programming under Kubuntu Linux and i am using SDL for the events, windows creatios, etc. and opengl for rendering.Every part of the engine is divided in shared object(like dlls). And until know it worked.My code should be like this:int result=0;result=SDL_Init(SDL_INIT_VIDEO);if(result!=0)return false;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_DOUBLEBUFFER, 1);result=(int)SDL_SetVideoMode(width, height, 16, SDL_OPENGL|SDL_HWSURFACE);if(result!=0)return false;for(;;){input_device->update();if(input_device->isKeyPressed(SDLK_ESCAPE))break;if(input_device->isKeyPressed(SDLK_q)){glClearColor(r, g, b, 0.0); glClearDepth(1.0); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glFlush();SDL_GL_SwapBuffers()}}This is how it should be if i merge the shared object code with a little test.The problem is that when i press "q" the window just disappear. I have to quit the program with a command in the command line.Why is this?   
  Can anyone help me please?   ;  Have you tried to draw something? From what I see you will not draw anything if you hit 'Q' screen will be cleared to r,g,b values   ;  Well, what i want is precisly that. to clear the screen to one color.And the window just desappears.;  q usually means quit (perhaps theres elsewhere that the q key is being interprated)- though in siuations like this its best to take an example that works ( i think on the sdl site there is one that displays a spinning triangle )+ see if that works, + if it does u can debug the differences;  Aw,come on. I think the code was enogh explicit so you you could see the when i press Esc the program exits succesfully, but when i press q(as if it were any other key) it should clean the screen, but it doesn't.This code was taken from an example.....   ;  Ok, if that is all your code then where are the calls to gluPerspective() or glOrtho I see no glViewPort() you are missing a lot of important setup functions...   ;  Mmm. But I only want to clear the screen!!!. Nothing else. Is it so hard to do that???Also, i am not using GLU nor GLUT nor anything else that isn't SDL or OpenGL.I mean, the problem is NOT that there is nothing drawn, or that everything is black, NOOO,  the problem IS that the window desappears; And that happens when i press Q becuase when i press Q, some commands are executed that should clear the screen.Thats everything i want to do, and i don't know why, this doesn't work.;  Have you stepped through your code in a debugger to find out exactly where it's going wrong?   ;  Consider this code: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_DOUBLEBUFFER, 1);result=(int)SDL_SetVideoMode(width, height, 16, SDL_OPENGL|SDL_HWSURFACE);The problems are most likely in the above code section.You specify you want 5 bits for r, g and b making 15 bits and you request a 16 bit framebuffer. You could try to omit setting these values so the implementation can choose any suitable format. Also you could request a 32 bit surface if your desktop runs in 32 bits. AFAIK the SDL_GL_DOUBLEBUFFER default value is 1 so you can omit this as well. The last problem I see is that you request an SDL_HWSURFACE together with OpenGL. I think this is a bad idea and should not be done. You don't have to write SDL_HWSURFACE to get OpenGL hardware acceleration.Hopefully trying this makes it work.   