Archived

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

QBRADQ

Problems with wglCreateContext()

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
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