help with NEHE outline fonts - lesson 14

i am tryin to use the code that was put up on nehe. i have a whole bunch of numerical values (increase sequentially) to display. when i use a for loop to display i get an overflow message. my code looks like :

glNewList 102, lstCompileAndExecute
glPushMatrix
For intI = 0 To 10
dblXpoints = dblScaleX * intI
glTranslated dblXMin, dblYMin +
dblScaleY, -dblZMin
glScalef 500, 500, 500
glPrint dblXpoints
Next intI
glPopMatrix
glEndList

i think the opengl matrix is getting overflowed. is there any other way around this problem?

You’re scaling by 500, 250000, 125000000, 62500000000, … Are you sure you want that instead of

glNewList 102, lstCompileAndExecute
For intI = 0 To 10
dblXpoints = dblScaleX * intI
glPushMatrix
glTranslated dblXMin, dblYMin +
dblScaleY, -dblZMin
glScalef 500, 500, 500
glPrint dblXpoints
glPopMatrix
Next intI
glEndList

Originally posted by Relic:
[b]You’re scaling by 500, 250000, 125000000, 62500000000, … Are you sure you want that instead of

glNewList 102, lstCompileAndExecute
For intI = 0 To 10
dblXpoints = dblScaleX * intI
glPushMatrix
glTranslated dblXMin, dblYMin +
dblScaleY, -dblZMin
glScalef 500, 500, 500
glPrint dblXpoints
glPopMatrix
Next intI
glEndList[/b]

im not scaling by multiples of 500, it is alwayz scaled by 500 and its the points are being plotted on a scale, actually being translated.

No, with the push/pop matrix outside of the for loop, you only scale by 500 the first time through the loop. The second time you scale by 500500 (as well as adding to your former translations). The second time it’s 500500*500, etc…

You have to remember that OpenGL is a state machine. Each time you do a glTranslate/glScale/glRotate, etc. It multiplies that translate/scale/rotate to the current matrix. Without restoring the matrix to its former state within that loop via something like a push/pop matrix, your translations/scales/rotates are all cumulating.

Originally posted by Deiussum:
[b]No, with the push/pop matrix outside of the for loop, you only scale by 500 the first time through the loop. The second time you scale by 500500 (as well as adding to your former translations). The second time it’s 500500*500, etc…

You have to remember that OpenGL is a state machine. Each time you do a glTranslate/glScale/glRotate, etc. It multiplies that translate/scale/rotate to the current matrix. Without restoring the matrix to its former state within that loop via something like a push/pop matrix, your translations/scales/rotates are all cumulating.[/b]

so what do i do now?

Originally posted by mithun_daa:
so what do i do now?

awriteeeee, i fixed it. thanx a lot Deiussum for ur help. i really appreciate it.

No problem. But it was really Relic who found it first. He even gave you the solution of moving your glPushMatrix/glPopMatrix inside the for loop.