• Advertisement

Archived

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

Problems with wglCreateContext()

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

Here's the code:
    
hRC = wglCreateContext(hDC);
if(hRC == NULL)
{
     MessageBox(NULL, "Can not create the Rendering Context. This application will now close.", "GLCrusader", MB_OK);
     ShowLastError();
//   ShutDown();

     return false;
}
    
Every time the hRC comes back NULL, and all functions taking hRC as an argument fail, but GetLastError() ( held within the function ShowLastError() ) comes back with the error code 0x00000000 ( The function completed successfuly ). Has anyone else had this problem? Does anyone know what might cause wglCreateContext() to fail? //////////// // Update // //////////// My problem was that I forgot to call SetPixelFormat() before hand. This still does not excuse the error code however. [edited by - QBRADQ on December 27, 2002 1:56:41 AM]

Share this post


Link to post
Share on other sites
Advertisement
The reason ShowLastError() showed success was because you called it after calling MessageBox(). It showed the result of that call, rather than the wglCreateContext() call.

Share this post


Link to post
Share on other sites
Is your PixelFormat ok ?

int PixelFormat ChoosePixelFormat(Canvas->Handle,&pfd);
isnt PixelFormat NULL ?
or what does that return ?
SetPixelFormat(Canvas->Handle,PixelFormat,&pfd);

Share this post


Link to post
Share on other sites

  • Advertisement