PDA

View Full Version : Texture mapping



MarsuGL
10-24-2000, 02:05 AM
Hello, i'm new to texture mapping and i am curious to know if when i load a texture onto the memory, (i don't map it on any object), my scene is darker, for example i draw a 3d cube ,each face has a different color, then load the texture and thre colors of my cubes are changed, all is darker,why ?,is it normal ??
i have tried to map a face of the cube, it seems to work well, but i have noticied that the color of the texture is different if the face is coloured before to apply the texture.
Is it possible to just draw the 4 points which made a quad and them map it or i must draw a filled quad to apply texture on it ?
tanks by advance
Domi.marsu@caramail.com

nbasili
10-24-2000, 05:44 AM
About your first question:
If you load the texture without binding it first to a variable using glBindTexture then when you call glEnable(GL_TEXTURE_2D) all your objects are assumed to have that texture attached to them and since you dont specify per vertex texture coordinates you get the black result. Try disabling GL_TEXTURE_2D and see if the cube becomes colored again.

About your second question:
Coloring and texture mapping are different operations and you do not have to fill a polygon to map it, but if you specify a color and a texture to a polygon both are blended. I mean that if you have a textured object and before drawing it you call glColor3f(1,0,0) you will colorize the object red, so the texture will appear red. I would recommend calling glcolor3d(1,1,1) before texture mapping so that your texture appears full bright. I think you can use glDisable(GL_MODULATE) to avoid this texture-color blending.
I hope it helps

MarsuGL
10-24-2000, 10:39 AM
Tanks, it's helps perfectly
one of my problems was the fact that i do not use GlDisable(GL_TEXTURE_2D) even once in my programm.