Can i change the order of these OpenGL / Win32 calls?
- by Adam Naylor
I've been adapting the NeHe ogl/win32 code to be more object orientated and I don't like the way some of the calls are structured.
The example has the following pseudo structure:
Register window class
Change display settings with a DEVMODE
Adjust window rect
Create window
Get DC
Find closest matching pixel format
Set the pixel format to closest match
Create rendering context
Make that context current
Show the window
Set it to foreground
Set it to having focus
Resize the GL scene
Init GL
The points in bold are what I want to move into a rendering class (the rest are what I see being pure win32 calls) but I'm not sure if I can call them after the win32 calls.
Essentially what I'm aiming for is to encapsulate the Win32 calls into a Platform::Initiate() type method and the rest into a sort of Renderer::Initiate() method.
So my question essentially boils down to: "Would OpenGL allow these methods to be called in this order?"
Register window class
Adjust window rect
Create window
Get DC
Show the window
Set it to foreground
Set it to having focus
Change display settings with a DEVMODE
Find closest matching pixel format
Set the pixel format to closest match
Create rendering context
Make that context current
Resize the GL scene
Init GL
(obviously passing through the appropriate window handles and device contexts.)
Thanks in advance.