PDA

View Full Version : Stumped by EXC_BAD_ACCESS


maaaaark
2005.03.24, 02:03 PM
I have no clue why I am getting a EXC_BAD_ACCESS by a simple glDisable:

Thread 0 Crashed:
0 libGL.dylib 0x90c32c1c glDisable + 0x2c

is there ANY troubleshooting I can do to figure out the real cause?

Edit (5minutes later): Wow, I am a moron :) I think I didn't initialize my context yet. I commeted out a lot of AGL code (to move to NSGL), and was just compiling libraries to see what ran and what didn't. Well, I forgot to add the NSGL context init code ;)

We'll see...

DoG
2005.03.24, 02:54 PM
It's really a big PITA that gl calls crash when you don't have a context. For beginners, this is usually the first thing that gets them stumped. It could give you some sensible information at least.

maaaaark
2005.03.24, 03:59 PM
I just have so many things going on at once ;) Trying to push the Carbon version out of the door, but I want to get the Cocoa version done by the time we support Localized strings.

arekkusu
2005.03.24, 04:15 PM
Crashing is giving you more information than silently doing nothing.

DoG
2005.03.24, 06:19 PM
Crashing is giving you more information than silently doing nothing.
True, but it doesn't tell you what is wrong either. If you are a seasoned OpenGL dev, you will know where to search, but a beginner isn't helped.

Dan Potter
2005.03.24, 08:21 PM
It may also be incorrect OpenGL behavior. Shouldn't it set an error code you can retrieve with glGetError()? It does on Win32 if you try to do that. It's a pretty weird error (the same one you get if you try to do invalid operations inside a glBegin/glEnd) but it does give one.

maaaaark
2005.03.24, 08:30 PM
It's not, I already fixed the problem (listed above). Just a matter of not updated commented out Carbon code to Cocoa code. Now on to mind boggling event stuff... :(

BinarySpike
2005.03.25, 02:11 AM
True, but it doesn't tell you what is wrong either. If you are a seasoned OpenGL dev, you will know where to search, but a beginner isn't helped.


Hmmm.....
In my first game I had trouble with arrays and aglSwapContext.
I over-stepped an array with a while loop and called some glvertex functions...:(
When I call aglSwapContex the video card would freeze (mouse and all would freeze).

I learned a long, long, time ago to check your if, while, for, and arrays for any problems first.
(pointers second)

arekkusu
2005.03.25, 02:19 AM
Shouldn't it set an error code you can retrieve with glGetError()?
You can't ask the context what the last error was if you don't have an active context.