Jump to content
  • Advertisement
Sign in to follow this  
Sean H

problems with nehe's lesson 6

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

Im having some problems compiling lesson 6 under vse on my vista machine. I have the platform sdk installed properly and I have already successfully compiled a number of glut and general opengl apps successfully. I also made sure to copy the 'data' folder to the same folder where the new executable is created. Still, whenever I run the program I get a non-descriptive run time error. The precompiled exe that it comes with works fine, but my created executable(which is twice as big for some reason) just refuses to work. Anyone experience this problem with visual studio express? edit: I forgot to mention that I didn't make any changes to the project or code, I just opened it and attempted to compile it. It compiled fine on the first try with no errors. also I'm using the visual c++ version of the lesson, not the .NET version. any help would be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Have you tried stepping through with the debugger to see where the run time error occurs?

Share this post


Link to post
Share on other sites
I didn't think to try that. I just did it and I got the message:

"Unhandled exception at 0x00401064 in lesson6.exe: 0xC0000005: Access violation reading location 0x00000000."

I'm not sure what this means, but it says it was unable to write out the source code.

Share this post


Link to post
Share on other sites
Check out the libraries that are included. I believe they are something like glut32.lib etc etc lol. Maybe the version has changed?
-durfy

Share this post


Link to post
Share on other sites
well this tutorial doesn't use glut. glut.lib isnt one of the files linked into the project so I dont think it's looking for that.

Share this post


Link to post
Share on other sites
You're dereferencing a NULL pointer. You should check the return of all functions that return a pointer and make sure it's not 0. Also you might wish to enable debugging information in the project settings - this would allow the debugger to give you an exact line of the source code on which the null pointer dereference occurs.

Share this post


Link to post
Share on other sites
Lets see:

Under project properties look at C/C++->General->Debug Information Format

and make sure that's set to something other than Disabled - Program Database for Edit and Continue is probably best

Also Linker->Debugging->Generate Debug Info should be yes

Then just make sure you run it from the IDE by clicking start debugging rather than start without debugging and you should break to the debugger when the violation occurs

Share this post


Link to post
Share on other sites
OK I'm getting close to figuring out the problem. thanks to cshowe, I was able to pinpoint the problematic line:

"glBindTexture(GL_TEXTURE_2D, texture[0]);"

I'm not sure why this line is causing an error since it isn't using a pointer. it looks like texture[0] is being set properly:

"glGenTextures(1, texture);"

where texture is being defined as:

"GLuint *texture;"

the funny thing is that this code works fine when compiled under vc6, but vse chokes on it. I'll see if I can figure this out. If I do, I'll post my findings. also it's worthy to note that I've since downloaded other lessons from nehe and they compile and work fine. it looks like it's just this lesson that's causing an error.

Share this post


Link to post
Share on other sites
OK I was able to get the lesson 6 nehe tutorial to run properly after commenting out two occurences of the same line:

"glBindTexture(GL_TEXTURE_2D, texture[0]);"

after removing all occurences of this line, the program runs fine with correct texture mapping. anyone care to guess what the problem is and why this line causes an error?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!