PDA

View Full Version : Can't glClear()!?!



Punchey
03-07-2001, 07:31 AM
Does anyone here know why the following line of code would suddenly, without ANY changes to my code, start causing my app to infinitely hang on a G450?



glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


It was working fine on one minute, and then, without me making any changes whatsoever, it started hanging on this line! Help!

Deiussum
03-07-2001, 10:09 AM
Do you have MS Office installed? I think sometimes that paper clip guy messes with your code while you're not looking.

Tim Stirling
03-07-2001, 10:12 AM
I know waht you feel, I find this all the time you simply add a small addition (like glClear) and then nothing works. Sometimes you can then remove that line you added, recompile and find it still doesn't work!
Sorry no answers

Humus
03-07-2001, 11:36 AM
Originally posted by Punchey:
Does anyone here know why the following line of code would suddenly, without ANY changes to my code, start causing my app to infinitely hang on a G450?



glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


It was working fine on one minute, and then, without me making any changes whatsoever, it started hanging on this line! Help!

Maybe it's the same bug as I encountered some time ago. It seams that if you call glClear() more than once before you do a SwapBuffers() it'll either hang, kill performance or something else. I've seen that happend on many cards.

john
03-07-2001, 04:00 PM
quoting:

I know waht you feel, I find this all the time you simply add a small addition (like glClear) and then nothing works. Sometimes you can then remove that line you added, recompile and find it still doesn't work!
Sorry no answers

hello. well, it could very well be a non-opengl related issue, althogether. It might be something seriously wrong with some other part of your code thats effects are trickling down. Now, I know that sounds very x-filesish and freaky, but it IS possible. an example, if you will. consider the code fragment:

int i, arr[10], j;

for(i=0; i<=10; i++) arr[i]=0;

now, the bug is that it should be i<10, not i<=10. but, this code might work in this case because its setting the array to 0, but then stomping all over the j value (because the int decl is placing 12 integers onto the stack, and although arr[0]=arr[0], its very likely that &(arr[-1])==&i and &(arr[10])==&j). but this WILL compile and it will more than likely run without side-effects. but, suppose you come back a millenia later, and change the decl so the code now reads:

int j, arr[10], i;

for(i=0; i<=10; i++) arr[i]=0;

you'll likely find that your code hangs at the for loop. (see... arr+10=&i... which is the loop counter=)

my point is: by changing some other part of the code, you'll find that your errornous code ELSEWEHRE in the program will start behaving differently.

but, this isn't to say that glClear is buggy, but that if you start changing your code, the memory alignment might be screwed up in JUST the unfortnate case to start screwing around with working parts of yor program. windows isn't the most protected o/s in the known market, after all. true, it seems more unlikely given that glClear lives in a DLL somewhere, but... its POSSIBLE.

cheers,
John

Punchey
03-09-2001, 09:27 AM
Well, after rebooting, it fixes the problem. But then, if I have to do some run-time debugging, sometimes it'll start doing it again. Then I have to reboot again. I think it's this stinking G450. It's OpenGL drivers _SUCK_!!! Also, sometimes when this happens, I'll try running another OpenGL app and it either fixes it, or that app also crashes (usually crashing my entire machine with it). On the one hand, I can see why it would crash too if a bug has crept into the G450's drivers, however, I'd like very much to know why in some instances it fixes the problem. Is there a GL call that these apps might be making that clears something in the drivers?

danoon
03-09-2001, 09:58 AM
Does your computer/app only become unstable after you debug/stop the app or it crashes without properly releasing the openGL window?

Punchey
03-09-2001, 10:55 AM
I believe that is always the case. I guessed it probably had something to do with not properly releasing OpenGL resources. Is there any way to free these up before trying to use them again?

[This message has been edited by Punchey (edited 03-09-2001).]

Deiussum
03-09-2001, 10:57 AM
I'm telling you that the paper-clip guy is messing with you. He is evil! http://www.opengl.org/discussion_boards/ubb/smile.gif

Seriously, though. It does sound like something is messed up in your drivers. Have you tried re-installing them?

Tim Stirling
03-11-2001, 02:13 AM
John, I wasn't implying that it was opengl, most of the time it is just my c++ code that is screwing it up. http://www.opengl.org/discussion_boards/ubb/smile.gif