PDA

View Full Version : why glGenLists return 0???



rusik
02-28-2005, 01:24 AM
may be i must initialize something???

here piece of code:

PixmapRGB texture;
if(texture.readBMPfile(filename) ==1)
MessageBox(NULL,"texture is readed","Debug",MB_OK);

texture.setTexture(textureName_);
textureName =textureName_;
float cx;
float cy;
int loop;

base =glGenLists(256); //here base is ZERO!!!???
glBindTexture(GL_TEXTURE_2D, textureName_);
for(loop =0; loop <256; loop++){
cx =float(loop%16)/16.0f;
cy =float(loop/16)/16.0f;
glNewList(base +loop,GL_COMPILE);
glBegin(GL_QUADS);
glTexCoord2f(cx,1-cy-0.0625f);
glVertex2i(0,0);
glTexCoord2f(cx+0.0625f,1-cy-25f);
glVertex2i(16,0);
glTexCoord2f(cx+0.0625f,1-cy);
glVertex2i(16,16);
glTexCoord2f(cx,1-cy);
glVertex2i(0,16);
glEnd();
glTranslated(10.0f, 0.0f, 0.0f);
glEndList();

Relic
02-28-2005, 02:19 AM
Do you have an OpenGL current at this time?
If not all OpenGL commands are ignored.

Do not use glTranslated() if you use floats as parameters, use glTranslatef().
Be aware that calling these display lists have sideeffects on your current transformation.
Probably because this is a fixed font, isn't it? But why are the vertices 16 apart, but the translates only 10?

rusik
02-28-2005, 02:53 AM
To All:
I found my problem...thanks!
Translatef -> i ll change it also 10 ...
thanks