Problem with textures and glList

Started by @, October 07, 2013, 19:49:51

Previous topic - Next topic

@

Sorry to annoy you again, but problems arise again. I have a class that generate glList. The thing is, when i draw it, everything is cool. If i dare to draw it and then (or after) others textures:
-It draws other texture instead of its own list (along the rest of textures).
-Or (depending of the drawing order) other image is drawn with the texture used by inside glList.

It must have a reasonable explanation, just i cant find it. Here is the code i use to draw list:

glEnd();
	glPushMatrix();{
	glTranslatef(x,y,0.f);
	glCallList(listID);
	glTranslatef(-x,-y,0.f);
}glPopMatrix();
glBegin(GL_TRIANGLES);


First thing i do before rendering a thing is to start glBegin, that's why i have to end there. I also call glend wherever an image requieres a new texture binding. This is my code for rendering texture outside lists:

//Some definitions
updateBinding(c.label());
tinting(c.tinting());
//Coords and vertex, nothing more. Inside updateBinding and tinting:
//UpdateBinding:
if(_lastID!=id){
	glEnd();
	_lastID=bind(id);
	glBegin(GL_TRIANGLES);
}
//tinting. Only when a new color is required, i change this.
if(_lastColor.equals(color)) return;
		
final float[] c = colorToFloats(color);
glColor4f(c[0], c[1], c[2], c[3]);
_lastColor = color;


I made some experiments, and if a have more than one "normal" images on screen and a list, if i tint a normal texture the textures from the list are affected too.

Fool Running

Remember that if you set a color or texture, it will remain set until you set another color or texture (or turn off texturing). Even through multiple frames.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

@

Yes, thanks for the reminder. I dont know what i did but i solved the problem. Heaven knows.