opengl: changing color bit depth in game
I''m having some trouble changing the color bit depth once the game has started (using fullscreen, straight Win32 function calls). When I specify it at start up, I can go at 16 bit or 32 bit fine, but trying to change it in game is causing a lot of problems. I''ve tried a number of different approaches, including calling wglDeleteContext and then creating a new Context, but all my methods so far just end up in a blank grey screen (although the program still appears to run). I''ve looked around, but all the info I''ve found only sets up for the initial bit depth.
I don''t seem to have a problem changing resolutions, though, although I''m not sure if I''m doing this correctly either. Basically, to change resolution, I''m just doing a SetWindowPos() to change the window to the new resolution size, and using ChangeDisplaySettings with the updated DEVMODE info.
Any suggestions would be appreciated, since I''ve run out of ideas on my own.
Take a look at NeHe''s OpenGL tutorial lesson 1. There is the code for how to change screen resolution and bitdepth.
Also when changing resolution in-game, you should first release HDC''s and HGLRC''s like you would with a normal window shutdown. Then initialize them again like you do when first starting the game.
Also when changing resolution in-game, you should first release HDC''s and HGLRC''s like you would with a normal window shutdown. Then initialize them again like you do when first starting the game.
Thanks a lot, I got it working.
I''d checked out NeHe''s tutorial before, it didn''t really have changing resolution/bit-depth in-game, just at startup.
Your tip about releasing HDC''s and HGLRC''s got me on the right track though. I''d tried that before, but I tried again, this time going all the way to destroying the window and re-creating it. This seemed to be what I needed to do, which I kind of find non-intuitive. Maybe I fixed something else that I had left broken and didn''t realize it.
But regardless, thanks again, because all seems well now. This messageboard is pretty cool, I''ve posted my first two questions in the last week, and got great answers on both of them.
I''d checked out NeHe''s tutorial before, it didn''t really have changing resolution/bit-depth in-game, just at startup.
Your tip about releasing HDC''s and HGLRC''s got me on the right track though. I''d tried that before, but I tried again, this time going all the way to destroying the window and re-creating it. This seemed to be what I needed to do, which I kind of find non-intuitive. Maybe I fixed something else that I had left broken and didn''t realize it.
But regardless, thanks again, because all seems well now. This messageboard is pretty cool, I''ve posted my first two questions in the last week, and got great answers on both of them.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement