ok so I have a 3D environment and the camera motion works and you can move around freely. I am now trying to texture some primatives, and I ran into this problem: The texture I loaded onto a quad does not appear in the correct colour.
I have a function that draws some lines across the floor to represent the ground:
void DrawFloor()
{
PushMatrix;
color3f(1,0,0)
BEGIN (LINES)
glVertex(0,0,-1)
etc…
END
PopMatrix;
}
Then I Load my Texture. This is already loaded in a TGA image loader. The load function loads the specified fril from the hard drive, which is pre loaded into the Structures within the TGA loading function. I have used an unsigned int TexturOne, to refer to when calling GenTextures(). But I dont think it works.
Render()
{
STGA tgaFile;
if (loadTGA("font.tga", tgaFile))
{
unsigned int TextureOne;
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glGenTextures(1, &TextureOne);
glTexImage2D(GL_TEXTURE_2D, 0,
3,tgaFile.imageWidth ,
tgaFile.imageHeight, 0, GL_RGB,
GL_UNSIGNED_BYTE,
tgaFile.imageData);
Now here is the problem: When I use the code above, the texture is gone and the quad is the same colour as the lines I drew earlier.
IF I comment out the Color3f() function, the texture appears in its true colours but the lines are the same colour as the main area of the texture!
IF I then add:
glBindTexture(GL_TEXTURE_2D,TextureOne);
to the Render() function, they both turn an eggshell colour!
Am I setting up textures correctly? I tried this method in a similar project which didnt have any camera manipulations. I loaded two seperate textures onto quads but once i try to bind the texture, it goes eggshell again!
I know its a lot to read but i really am stuck and would really welcome some help.
Cheers