Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Fullscreen display colors and blends incorrectly

This topic is 4545 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This could possibly be an SDL issue, as I am using SDL to set up an OpenGL rendering context. Anyway, I have been testing an application in windowed mode until today. Unfortunately, when I entered fullscreen mode the colorating and blending seem to be functioning incorrectly. Windowed example: Fullscreen example: I thought that it might be texture related, but rendering a three colored triangle displays the same poor effects. My SDL initialization code is:
  SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 );
  SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 );
  SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );
  SDL_GL_SetAttribute( SDL_GL_BUFFER_SIZE, 32 );
  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );                                               
  // SDL_OPENGLBLIT allows SDL to draw alongside OpenGL
  // Use SDL_OPENGL if OpenGL exclusive application
  Uint32 flags = SDL_OPENGL | SDL_HWSURFACE;
  if ( _fullscreen ) {
    flags |= SDL_FULLSCREEN;

  _screen = SDL_SetVideoMode( _windowWidth, _windowHeight, 16,                  flags );

  if ( !_screen ) {
    printf( "ERROR: Unable to initialize SDL screen: %s", SDL_GetError( )); 
    return false;
  if ( !( _screen->flags & SDL_HWSURFACE )) {
    printf( "WARNING: Can't get hardware surface\n" );

I get the warning when in windowed mode so I believe that to be the source of the issue. Thanks in advance.

Share this post

Link to post
Share on other sites
That param to SDL_SetVideoMode should be 32, not 16. I was too focused on the set attribute functions. Thanks.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!