On Dec 15, 2006, at 10:06 PM, Laurence Harris wrote:
On Dec 16, 2006, at 12:54 AM, Adam wrote:
I spoke too soon. Whenever I call the function (by way of pressing a key), it invokes the debugger, which says that redisp = 139396. Is there something wrong with the way that I looped my for() statements? Is there some way that redisp could get that high? Or am I misinterpreting the debugger somehow? What is wrong with my code?
for (GLfloat redisp = 0; redisp <= 7; redisp ++) { for (GLfloat redisp2 = 0; redisp2 <= 14; redisp ++)
Don't you want to increment redisp2 in the second one?
Larry
Yeah, that would probably be good. I did that when I was writing it out as well as typing it up. Whoops again...
On Dec 15, 2006, at 10:12 PM, Chris Espinosa wrote:
On Dec 15, 2006, at 10:06 PM, Laurence Harris wrote: I spoke too soon. Whenever I call the function (by way of pressing a key), it invokes the debugger, which says that redisp = 139396. Is there something wrong with the way that I looped my for() statements? Is there some way that redisp could get that high? Or am I misinterpreting the debugger somehow? What is wrong with my code?
for (GLfloat redisp = 0; redisp <= 7; redisp ++) { for (GLfloat redisp2 = 0; redisp2 <= 14; redisp ++)
Don't you want to increment redisp2 in the second one?
The man's got a point there.
And rather than having your program "invoke the debugger" (which is the politest euphemism for "crash" I've ever heard), you may want to start in the debugger, setting a breakpoint at your outer for loop and stepping through with the "Step Over" command. Look at each variable after each line executes to make sure it's changing the way you expect it to.
Chris
Ok, I think I have it now... nope... in this code:
void kybrd(unsigned char key, int x, int y) { switch (key) { //... case 'a': { srand (time(NULL)); for (int looptemp = 0; looptemp <= 5; looptemp++) { arr_tetris_screen[rand()%7][rand()%14] = box; } redisplay(); } default: exit(123); } }
This code keeps giving me "exit code 123" when I press 'a'. Any thoughts? Caps lock is not on... Thank you both for helping!
All help is appreciated and thanks in advance.
~ < [ / Adam-o \ ] > ~
+-------------------------------------------+ | My computer's Stats | | Mac OS 10.4.8 | | 1 Ghz Apple Powerbook G4 | | Xcode v. 2.4.1 | +-------------------------------------------+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Please keep your posts straight and to the point. Also please comment the code you use as I am still learning OpenGL and Xcode and may not yet understand the meaning of the command. Thank you. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|