This is when the window is created (has a valid HWND and DC). When is a good time to create the GL context? On WinNT and its derivatives, it is said that resources are not a problem and it assigns a unique DC per window.įor good practice, I recommend using CS_OWNDC. Since DCs (device contexts) consume resources, the OS does not assign a DC but might share it between multiple windows and GUI elements. This flag is really needed for Win9x systems. If you are using MFC (SDI or MDI project), override PreCreateWindow and add the CS_OWNDC to cs.įor CDialog based project, PreCreateWindow doesn't get called. WNDCLASSEX.style should have the CS_OWNDC If you are doing plain old WinMain coding, RegisterClassEx() takes the WNDCLASSEX structure. What should I do before the window is created? Other compiler/IDE mind need to link with opengl32.a If you use other libs like GLU, add glu32.lib. If you have link errors, then you need to figure out how to link with your specific compiler/IDE.Įxample : with VC++6 (which is very old by now), you go to Project->Settings and click on the links tab.Īdd opengl32.lib to the Object/library modules list. If you get compiler errors pointing to gl.h, this is because there are some things like WINGDI which are used in gl.h but are only defined in some other header files. 7 How many times can I call SetPixelFormat?.3 When is a good time to create the GL context?.2 What should I do before the window is created?.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |