Bitmap and callList

Started by
4 comments, last by V-man 15 years, 5 months ago
Hi 3d masters. Im trying to store bitmap characters into a callList so i can show text on screen. One problem : those bitmap are called very often so it HAS to be in a calllist. Since the callList is unmodifiable, is there any way as good as the callList that will let me change the color of the characters. I mean they arent going to be always white. Should i store the bitmap in the calllist for every color ill use ? Prolly like 5-10 colors that ill use. Second problem : If i draw something from a callList or something in the glu library, i have to translate it to position it. But the light still show on the object like if it was still at 0,0,0 after the translation. (and no i dont translate the light by mistake with it.)
Advertisement
The standard method is to have our entire text in a texture and render a quad or have the characters in a texture and render each char as a quad.
It should be fast enough.
Dont use unusual things like glBitmap. GPUs dont support bits.

To position a light, sice it is effected by the modelview

glloadidentity
glLight(GL_POSITION, xyzw)

glloadmatrix
DrawObject
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Quote:Original post by V-man
The standard method is to have our entire text in a texture and render a quad or have the characters in a texture and render each char as a quad.
It should be fast enough.
Dont use unusual things like glBitmap. GPUs dont support bits.

To position a light, sice it is effected by the modelview

glloadidentity
glLight(GL_POSITION, xyzw)

glloadmatrix
DrawObject


isnt BindTexture expencive for the CPU ?
wouldnt i also have to use blend so it doesnt show the rest of the quad ?

i saw glPolygonStipple which work same way as glBitmap but for polygons. Would it do the job ?

And i dont see what u mean by GPUs dont support bits. Is there really some implentation of opengl that doesnt support simples and basics bitmap ??
How can they support textures if they doesnt even support basic stuff like that?
Yes glBindTexture can be expensive. All your characters should be in the same texture for that reason.

glPolygonStipple is one of those features that aren't supported by common GPUs.
There are quite a few functions that should not be used in GL.

Quote:And i dont see what u mean by GPUs dont support bits. Is there really some implentation of opengl that doesnt support simples and basics bitmap ??
How can they support textures if they doesnt even support basic stuff like that?


Most common GPUs don't support glBitmap. It converts, makes a texture, then renders a quad with the texture.
That's why in the next version of GL (GL 3.0), they have declared such features as deprecated.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Quote:Original post by V-man
Yes glBindTexture can be expensive. All your characters should be in the same texture for that reason.

glPolygonStipple is one of those features that aren't supported by common GPUs.
There are quite a few functions that should not be used in GL.

Quote:And i dont see what u mean by GPUs dont support bits. Is there really some implentation of opengl that doesnt support simples and basics bitmap ??
How can they support textures if they doesnt even support basic stuff like that?


Most common GPUs don't support glBitmap. It converts, makes a texture, then renders a quad with the texture.
That's why in the next version of GL (GL 3.0), they have declared such features as deprecated.


thanks. that answered my question ^^

EDIT: no wait, for the characters color will i have to store each char for each color in a call list or theres better ? btw i cant use any c++ lib for that since im in java
Make your text white and to color them you can call glColor before you render.
The env mode must be glTexEnvi(...., GL_MODULATE) so that it multiplies the color with the texel colors.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement