Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

elgransan

Problem with pixel format SDL

This topic is 5394 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

hi Im working in a 2d game-style with SDL & ogl, the game is working very well when i set the windows in 32bits color depth but, when I change to 16bits the 250 fps slow down to only one!!! So, I thought that was because my textures have 32bits color GL_RGBA pixelformat. Ok, I converted my pictures to GL_RGBA to GL_RGBA4 (4bits per color), but... all the images went white I thought that, that was because i didnt set in SDL the pixelformat so i set it: SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 4 ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 4 ); SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 4 ); SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 4 ); // Si activo fullscreen... if (bFullScreen) // ... inicializo la pantalla en fullscreen return (SDL_SetVideoMode(iWidth, iHeight, iBpp, SDL_OPENGL|SDL_FULLSCREEN) != 0); else // ... inicializo la pantalla sin fullscreen return (SDL_SetVideoMode(iWidth, iHeight, iBpp, SDL_OPENGL) != 0); Well, I cant solve the problem, so i put this code: int cantb; SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &cantb ); cout << "R= " << cantb << " bits" << endl; SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &cantb ); cout << "G= " << cantb << " bits" << endl; SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &cantb ); cout << "B= " << cantb << " bits" << endl; SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &cantb ); cout << "A= " << cantb << " bits" << endl; And the results were: R= 5 bits G= 6 bits B= 5 bits A= 0 bits Why SDL cant understand my commands?... Can I set 16bit mode to: R= 4 bits G= 4 bits B= 4 bits A= 4 bits or is only a dream?? Sorry my english... Im a disaster Santiago - from Argentina

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Can I set the Alpha channel in a 16-bit mode? (this had to be my first question)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!