Archived

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

Changing pixel depths

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

I want to change the pixel depth while my program is running. So, Wwat steps must be taken to change the pixel depth after SetPixelFormat has been called and after a rendering context has already been created with a different pixel depth? Do I have to destroy the entire window, or just the delete the render context? I''ve tried both, and the program just crashes.

Share this post


Link to post
Share on other sites
You set the pixeldepth of a DEVICE context. SO when you create a rendercontext it grabs the pixeldepht of the device context it''s created on.

Now, _changing_ the pixeldepth of a device context while there is a valid rendercontext is wrong, since when you do that, the rendercontext and the device context have different pixeldepths.

To change it at runtime, you have to delete the rendercontexts present, THEN change the pixeldepth of the device context of the window and THEN re-create the rendercontexts and re-upload all your textures. (that''s why Quake3arena for example re-loads all content when you change the screendepth)

In D3d this is more easier, but in OpenGL its not

--

Get productive, Get DemoGL: http://www.demogl.com

Share this post


Link to post
Share on other sites
Ah, I read something wrong. I was thinking window, not device context.

This paragraph under SetPixelFormat in the MSDN got my attention:

"If hdc references a window, calling the SetPixelFormat function also changes
the pixel format of the window. Setting the pixel format of a window more than
once can lead to significant complications for the Window Manager and for
multithread applications, so it is not allowed. An application can only set
the pixel format of a window one time. Once a window''s pixel format is set,
it cannot be changed."

But it says "window", not "device context", so I think it is ok.

Share this post


Link to post
Share on other sites