GL Rendering Context

If my program fails to create a GL Rendering context, what can I do to fix it?

-Adrian

You have to make sure that the Pixelformat has been set correctly and that you rendering context exits too.

if (!hDC =GetDC(hwnd))
error;

if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd)))
error! This one means that your video card doesn’t support the pixel format you asked. You’ll have to change some parameters

if(!SetPixelFormat(hDC,PixelFormat,&pfd))
error again.

Then if this ok, maybe it’s the window fault.

These are the things you have to be sure of:

when you make the window class, you must have CS_OWNDC for the style.

If that is all ok, well I must say I don’t know, and let’s hope somebody else has an answer.

[This message has been edited by Gorg (edited 03-27-2000).]

i’ve got problems with the RC when going fullscreen ( == program crashes!! )…
all the tutorials from nehe and stuff can’t create a RC…has it to do with win2000 ??

Oh no!.. that doesn’t sound good!.. Have you tried on win9x too?.. And it works there?..

Hopefully its a driver problem. Does the card you have have win2000 drivers?. Check that!

hi,
a few hours ago i visited a friend of mine,
carrying a disk with openGL stuff in my pocket…
he’s got the same graphics card (ATI Rage pro) and same 'puter ,with win98…
We couldn’t get this stuff to work,too!
It MUST have to do with the ATI crap…

Oh I see… Have you tried running other OpenGL apps?.. Like Quake or something?.

nope,i don’t have quake or something…
i also have NO time :frowning: to code some openGL stuff.

a little question: when i create a window (in Windows…) with the argument WS_POPUP(with no other params,like WS_SIZEBOX),
am i fullscreen then? if i am,my own code works, if not,could you tell me how to do it?

i think i will study some code now…

holy_moly

hehe, i gots windows 2000, my ATI Rage IIc card does the nehe stuff fine (under 98 partition)… I haven’t tried it under 2k… I don’t go on 2k much, becuase I have a cheap korean sound card, which refuses to make 2000 drivers.

I have a voodoo 2 and an ATI Rage IIc, and I seem to be having a similar problem.

When I try to run Nehe’s first windows tutorial fullscreen, it dies on
hRC=wglCreateContext(hDC).
However, the program works fine when I run it in a normal window.
If I put
PixelFormat=ChoosePixelFormat(hDC,&pfd)
before
hRC=wglCreateContext(hDC).
then the program dies while trying to get the PixelFormat.

If Gorg is right, then I should mess with my pdf settings in hopes of finding a setup that likes my video cards. But so far I haven’t been able to find a working configuration.

Any advice?

Hrm, I again tried moving around chunks of the NeHe code, and now I successfully get through the pfd error checking stuff without any problems. But it still fails when I try hRC=wglCreateContext(hDC).
So now I really have no idea were the problem is.

Take 3dfxgl32.dll put in program dir, rename to opengl32.dll, everything works.

I really should have figured that out earlier :P.