glut Issues

Ok… I’m having a bit of a problem with glut (and Borland c++ builder 5.0). For some reason, it will run just fine, and then when recompiling, it will just crash with the error “Project Project2.exe raised exception class EAccessViolation with message ‘Access violation at address 1000BBAE. Read of address FFFFFFFF’. Process stopped. Use Step or Run to continue.”, and the line it shows having caused the error isn’t one that i changed, in any way since the previous compile.

If i comment out that line, then the next one causes the same error, and so on. So, if i comment out the line before all of this, it causes an error at a completely different section of code, although it is still the same error (with a different address in the “Access violation at address 1000BBAE” part).

There is an image online at http://www.dollsap.com/derivative/error.gif of what the error screen looks like, including the error message, and the line of code that it finds the error at.

If anyone can help me on this matter, i’d be really really appreciative.

Also, i’m using glut 3.7.6

email me at derive @ telusplanet . net

Why you calling glInit?

He probably calls glInit to setup some states, like enable depth test, create textures, and so on, before the rendering starts.

Anyways, the first thing you should do before calling any other GLUT function, is to call glutInit with proper parameters.

does your glutResize function return void and take two integers? aside from seeing the rest of your code, that’s all i could see.

b

ok, but he can create a glut window without calling it though…

Ok, a few things that i should have said, as well.

Firstly, the code is nearly an exact copy & paste of some demo code i got for a library that uses glut. The only parts that have changed are not in the main function.

Secondly, I didn’t even realize that it didn’t have the glutInit() function is part of it. However, having just tried putting that in there, it didn’t solve the problem. it still crashes at the same point.

Also, all the functions for the glutResizeFunc() and so on, afaik, if they didn’t take the proper parameters, i should get a compile time error - i think.

Either way, it does have the proper parameters.

If it would help, i just posted the code online, at http://www.dollsap.com/derivative/code.txt

Thanks.

I can compile and execute that without any problems. The only differences I have are the headers :

#include <stdio.h>
#include <stdlib.h>
#include <GL/glut.h>
#include “glTexFont.h”

and I’m using the straight font.tga that Nate provides with his source. Couldn’t imagine that would be the problem though.

You could try running a debugger through the code and have a look at the call stack when it crahses to see what went wrong. It may be a graphics card issue.

Yeah, and the differences in headers is just from where i’m putting mine. Hrm…

And as i did say, its compiled just fine for me before, too. Just for whatever reason, it decided to start giving me that error. I’ll try the debugger thing, though. see where that gets me…

Thanks.

Can you just get the window ok, without the fonts etc…?