How can I have two things render independently

Started by
15 comments, last by clrscr 19 years, 7 months ago
I am trying to render some outline font text and a rotating textured cube. However, the texture cube picks up the color of the text. I tried setting glTextEnvi to DECAL however that just makes the text a dull color though it does fix the cube. So I'm at a lost, any help would be appreciated.
-----------------------------When men speak of the future, the Gods laugh.An apology for the devil: it must be remembered that we have heard one side of the case. God has written all the books.Samuel Butler (1835 - 1902)
Advertisement
stick in

glColor3f(1.0f,1.0f,1.0f);

after the call to rendering the text and before you render the cube.
Disclaimer: "I am in no way qualified to present advice on any topic concerning anything and can not be held responsible for any damages that my advice may incurr (due to neither my negligence nor yours)"
I tried that with no luck thanks though
-----------------------------When men speak of the future, the Gods laugh.An apology for the devil: it must be remembered that we have heard one side of the case. God has written all the books.Samuel Butler (1835 - 1902)
Are you applying a seperate texture to both the text and the cube?
Disclaimer: "I am in no way qualified to present advice on any topic concerning anything and can not be held responsible for any damages that my advice may incurr (due to neither my negligence nor yours)"
no the text is just getting colored while the cube is getting the texture.
-----------------------------When men speak of the future, the Gods laugh.An apology for the devil: it must be remembered that we have heard one side of the case. God has written all the books.Samuel Butler (1835 - 1902)
Does the same thing happen if you draw the cube first?
Disclaimer: "I am in no way qualified to present advice on any topic concerning anything and can not be held responsible for any damages that my advice may incurr (due to neither my negligence nor yours)"
Yup excatly the same thing would it help if I posted the rendering and setup code?
-----------------------------When men speak of the future, the Gods laugh.An apology for the devil: it must be remembered that we have heard one side of the case. God has written all the books.Samuel Butler (1835 - 1902)
so I'm gonna bump this just one time cuz I really need the help
-----------------------------When men speak of the future, the Gods laugh.An apology for the devil: it must be remembered that we have heard one side of the case. God has written all the books.Samuel Butler (1835 - 1902)
post code, anything else is blind guessing on our part...
heres the setup and rendering code
gobase = CreateOut("Comic Sans",12,0.5f);	if(gobase==0)		return false;	glClearColor(0.0f,0.f,0.0f,0.0f);	glClearDepth(1.0);	glEnable(GL_TEXTURE_2D);	glShadeModel(GL_SMOOTH);	glEnable(GL_DEPTH_TEST);	glDepthFunc(GL_LEQUAL);	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	glEnable(GL_LIGHT0);	glEnable(GL_LIGHTING);	glEnable(GL_COLOR_MATERIAL);		glGenTextures(1,&text);	glBindTexture(GL_TEXTURE_2D,text);	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);	//glTexImage2D(GL_TEXTURE_2D, 0, 3, pic->sizeX, pic->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, pic->data);	gluBuild2DMipmaps(GL_TEXTURE_2D,3,pic->sizeX,pic->sizeY,GL_RGB,GL_UNSIGNED_BYTE,pic->data);	glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DECAL);	if(pic)	{		if(pic->data)		{			free(pic->data);		}		free(pic);	}	return true;}void Draw(){	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);	glLoadIdentity();	glTranslatef(-4.5f,-0.5f,-10.0f);	if(change_text)	{		note=rnd(6);		change_text=!change_text;	}	if(change_color)	{		color=rnd(5);		switch(color)		{		case red:			r=1.0;			g=0.0;			b=0.0;			break;		case green:			r=0.0;			g=1.0;			b=0.0;			break;		case blue:			r=0.0;			g=0.0;			b=1.0;			break;		case purple:			r=0.5;			g=0.0;			b=0.5;			break;		case white:			r=1.0;			g=1.0;			b=1.0;			break;		}		change_color=!change_color;	}	glRasterPos2f(-0.35f,0.0f);	glColor3f(r,g,b);	PrintBit(gbbase,amber_notes);	glColor3f(1.0f,1.0f,1.0f); 	glTranslatef(-1.0,-3.0,-5.0);	glRotatef(angle,1.0f,0.0f,0.0f);	glRotatef(angle,0.0f,1.0f,0.0f);	glRotatef(angle,0.0f,0.0f,1.0f);	glBindTexture(GL_TEXTURE_2D,text);	DrawCube(0.0f,-5.0f,-10.0f);		if(angle>=360.0f)		angle=0.0f;	angle+=0.2f;	glFlush();	SwapBuffers(ghDC);}
-----------------------------When men speak of the future, the Gods laugh.An apology for the devil: it must be remembered that we have heard one side of the case. God has written all the books.Samuel Butler (1835 - 1902)

This topic is closed to new replies.

Advertisement