nothing happens immediately. But if I then do a glClear, then display another page of bitmapped text, the translation appears to have worked. What’s the glClear doing to make the translation work?
what do you like to scroll ?
the text ?
what about the current matrix ? have you set the
proper matrix to scrol the text ?
your problem sounds like a matrix mistake…
I’ve got bitmapped text covering the entire display. It’s like somebody used printf’s but it’s done drawing bitmapped text to the window instead. I was able to do this with a simple program using Linux, but now that I’ve moved over to Windows 2K, it doesn’t work the same (it doesn’t work at all).
I’ve seen other posts on this forum that suggest setting the Matrix mode to GL_MODELVIEW or GL_PROJECTION. I’ve tried both of those with the same bad results. Do I have to Push and Pop the matrix stack too? Like:
A quick thought: maybe it’s because it depends on the current raster position. But I don’t remeber how you translate the raster pos. I rememeber only glRasterPos* which sets it.
This leads me to believe I’m trying to do something that’s impossible. I’m trying to translate the c-u-r-r-e-n-t contents of the whole window up or down along the y axis. I’m trying to do this:
draw some bitmapped text.
glTranslate along the y-axis.
watch it scroll up or down.
Is it possible that glTranslate affects only the NEXT things that are drawn? Maybe I’m 'spozed to do this?:
You have to apply the transformations before drawing what it is that’s supposed to be translated.
like so:
glTranslatef();
draw();
that explains why you saw the translate after you cleared:
you cleared and redrew your scene with the translate in place from the previous frame. (you weren’t pushing/popping the matrix at that point).
glTranslatef() modifies the current modelview matrix which in turn affects how your vertices are transformed before they are drawn.
applying a translate after you have drawn your vertices obviously has no effect.
Right - I was just now trying to do what you said. What’s an easy way to do that? I want to
read what’s already there, glTranslate, then draw it back again.
why are you copying pixels?
that’s an expensive operation.
if you want to move the contents of the entire window, erase the window, and draw everything in the window again with the transformation you want.
(in this case a glTranslatef(0,whatever,0)
I’ve got a couple of functions called WriteLine() and WriteXY(). WriteLine(char* text) draws bitmapped text in a printf-style format, 1 line after another. WriteXY(char* text, int x, int y) draws bitmapped text at specific spots on the display as defined by the caller. The problem is that the caller uses these two functions to draw whatever text he/she wants, and I am not able to recreate them (? can the last display list be re-played?). That’s why I was trying to use the current contents of the framebuffer to re-draw after doing glClear, glTranslate.
Yes, you can recall the last list via glCallLists().
if you’re generating a new list each frame then you’re defeating the purpose of using display lists anyway…
so, you capture a string from the user and then render it, correct?
why not store the string? That way you know what you’re rendering at least.
if the scroll is to happen in response to a scroll bar, clear the screen and redraw the string and other content as mentioned before…
if you’re finding yourself having to use glReadPixels for reasons other than absolutely needing the contents of the frame buffer in system memory, you’re most likely doing something fishy…
Right - I capture a string from the user and then render it. The scroll happens in response to thumb pressure on a button.
I’m such a novice at this, I suspect I do fishy OpenGL things every day! But it’s nice to have your guidance. If I ever become as expert as yourself, I will try to convey accurate information to newbies.
But back to my problem. Which method do you favor for redrawing after having glCleared/glTranslated?
Storing the string sounds like a great idea, one that I hadn’t considered yet.