PDA

View Full Version : ?!?! NeHe OpenGL Tutorial Les.1 ??!?!?!!



06-20-2001, 05:05 AM
When i wrote the code on the tutorial on how to create an OpenGL Window, it ran perfectly until it came upon a memory error. It said something like 0x..... could not reference 0x00000000. Is this supposed to happen? I'm using Microsoft Visual C++ 6.0 under Win 2000.

06-20-2001, 05:34 AM
The error specifically occurs in this line:
if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd)))
I evaluated hDC in the Watch, and it turned out that it was "unused". What is the problem? I am also running the program on 800x600 mode (won't make a difference with 640x480; same error happens both times).

06-20-2001, 07:07 AM
Uh, anyone wanna help out?

06-20-2001, 07:17 AM
Uh..Is that supposed to be an assignment or a condition? = or ==..just checking..

06-20-2001, 07:19 AM
In the tutorial, they had it as an assignment operator, not a conditional operator. I really don't know what is going on. All I know is that the code seems to be faulty. Here is the link to the tutorial. http://nehe.gamedev.net/tutorials/lesson01.asp

06-20-2001, 07:21 AM
Wait a correction. The actual line of error is:
if(!SetPixelFormat(hDC,PixelFormat,&pfd))
I ran the debugger and after I step over this line, the program crashes (memory error? bad pointer???).