Advertisement

Tutorial 1 - Rendering Context

Started by December 23, 2000 05:13 PM
1 comment, last by erjo 23 years, 10 months ago
Hi. Have a problem..(No shit I hear?) I can''t seem to create a Rendering Context(When rewriting the code by hand).. Everything goes great(have checks on EVERYTHING) until this line: if( !(hRC = wglCreateContext(hDC)) ) Where wglCreateContext(hDC) returns false.. I''m sure that hDC is good, but not why the funtion is returning false.. Any help would be apprecíated. ERJO - Merry christmas all you europeans out there!
Merry Christmas!

to your question: What kinda PC do you have? does it support Opengl? did you set up the Pixel format? post some code, that''ll help..
cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states
Visit Rarebyte! and no!, there are NO kangaroos in Austria (I got this question a few times over in the states ;) )
Advertisement
Hi again.
My computer supports OGL - the compiled file of nehes tutorial1 runs fine. However, mine does not.. Here is my pixelformat:

static PIXELFORMATDESCRIPTOR pfd =
{
sizeof(PIXELFORMATDESCRIPTOR), // Size
1, // Version
PFD_SUPPORT_OPENGL | // Must support OpeenGL
PFD_DOUBLEBUFFER, // Must support double buffers.
PFD_TYPE_RGBA, // Request RGBA mode
bits, // Color depth
0, 0, 0, 0, 0, 0, // Color bits ignored
0, // No alpha buffer
0, // Shift bit ignored
0, // No accumulation buffer
0, 0, 0, 0, // Accumulation bits ignored
16, // 16 bit depth buffer
0, // No stencil buffer
0, // No auxilary buffer
PFD_MAIN_PLANE, // Main drawing layer
0, // Reserved
0, 0, 0 // Layer masks ignored
};


Here is the setting of the hDC and loading of the pfd:
if( !(hDC = GetDC(hWnd)) )
{
MessageBox( NULL, "Can''t create a GL DC.", "ERROR", MB_OK | MB_ICONSTOP );
KillGLWindow();
return false;
}

if( !(PixelFormat = ChoosePixelFormat(hDC, &pfd)) )
{
MessageBox( NULL, "Can''t set Pixel Format.", "ERROR", MB_OK | MB_ICONSTOP );
KillGLWindow();
return false;
}

Both of these if checks work. However, the next one goes boom, and thats the creation of the RC.. Strange.

ERJO

This topic is closed to new replies.

Advertisement