Archived

This topic is now archived and is closed to further replies.

Using Color and Textures At The Same Time

This topic is 5575 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there! This has prob been asked a million times but.... the search is out soooo..... I just wanna know how I can use textures and color at the same time like...
  
	
glColor3f(0.5f,0.5f,0.5f) 
	 
	 glBegin(GL_TRIANGLE_STRIP);
		 
	 glTexCoord2d(1,0);

	 glVertex3fv(br.xyz);
	 glTexCoord2d(0,0);

	 glVertex3fv(bl.xyz);
	 glTexCoord2d(1,1);

	 glVertex3fv(tr.xyz);
	 glTexCoord2d(0,1);

	 glVertex3fv(tl.xyz);
	
	 

	 glEnd();

  
This is the code I use and the textures work but the color is alway white!

Share this post


Link to post
Share on other sites
I came across this problem, too, and I think the solution had to do with materials. If you are using LIGHTs, I think you have to define MATERIALs that reflect the correct colors.

Try abandonning glColor all together and instead define meterials that reflect the colors you want, ie, if you want a red cube, define a material that reflects red light and enable it instead of calling glColor. You should then be able to bind a texture to the cube, and still have the red light get reflected back.

Remember, there are 3 types of light, and each are reflected with different aspects of the MATERIAL.

I''m not sure, but I think that will solve the problem...

Share this post


Link to post
Share on other sites
Yes, I hadn''t thought about materials, that would work huh? But I know there is a way to use colors and textures at the same time and I would really prefer to use them since I don''t wanna calc normals for all the particles, well I guess they are billboards so only one calc per frame.. but still I wanna use colors and I know that it can be done. DOES ANYONE KNOW????

Share this post


Link to post
Share on other sites