Odd OpenGL Texture Problem

Started by
8 comments, last by Galileo430 22 years, 10 months ago
For some reason when ever I pass this code a texture. NO MATTER what the texture is it always comes out the color of the last glColor call I make. Just plain that color. No other color. If I call glColor3f(0.0f,0.0f,1.0f); it comes out pure blue ALTHOUGH the code being run is glTexCoord2f();
  
	glGenTextures(1, &m_dwTexture);
	glBindTexture(GL_TEXTURE_2D, m_dwTexture);

	if(m_byIsMipMapped[0] == 0x01)
	{
		gluBuild2DMipmaps(GL_TEXTURE_2D, 3, m_FileSubHeader.imgsizex, m_FileSubHeader.imgsizey, GL_RGB, GL_UNSIGNED_BYTE, m_byImage);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST_MIPMAP_LINEAR);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST_MIPMAP_LINEAR); 
	}
	else
	{
		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_FileSubHeader.imgsizex, m_FileSubHeader.imgsizey, 0, GL_RGB, GL_UNSIGNED_BYTE, m_byImage);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); 
	}

	m_bTextureLoaded = true;
  
Anyone have any ideas? ------------------------------------------------------------ I wrote the best video game ever, then I woke up... Grandus.Com
------------------------------------------------------------I wrote the best video game ever, then I woke up...
Advertisement
And do you call

glEnable( GL_TEXTURE_2D );

before rendering?
-------------------------------------------------------------LGPL 3D engine - http://www.sourceforge.net/projects/realityengine
I''m not sure if this is standard but on my system this is how it works. When you draw vertices using texture mapping it skews the colors to what is enabled on your last glColor call. So if you had previously called:

glColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
It would be completely black.

glColor4f( 0.0f, 0.0f, 1.0f, 1.0f );

will make the colors range from 0.0, 0.0, 0.0 to 0.0, 0.0, 1.0

You would need to set your color to 1.0, 1.0, 1.0 to get the full rang of colors in your texture.

Seeya
Krippy

Even with a glColor3f( 0.0f, 0.0f, 1.0f ) the texture would show, but tinted blue (as you said). As I understood it, Galileo430 didn''t get any texture at all.
-------------------------------------------------------------LGPL 3D engine - http://www.sourceforge.net/projects/realityengine
I do not get ANY texture just plane COLOR

Yes, I called glEnable(GL_TEXTURE_2D)

And glIsTexture returns GL_TRUE for dwTexture.

Even if I set it to White like Krippy Said. No texture.

------------------------------------------------------------
I wrote the best video game ever, then I woke up...

Grandus.Com
------------------------------------------------------------I wrote the best video game ever, then I woke up...
is Texturing enabled?

glEnable(GL_TEXTURE_2D)


Mathias
And you have a current texture?
use
GL_MODULATE + glColor4f(1,1,1,1)
or
GL_REPLACE + it doesnt matter what colour.
i prefer the first method

http://members.xoom.com/myBollux
Got it.. (I think)

------------------------------------------------------------
I wrote the best video game ever, then I woke up...

Grandus.Com
------------------------------------------------------------I wrote the best video game ever, then I woke up...
Is the bound texture a power of two?

I have heard that gluBuild2DMipmaps converts your images to powers of two, but I have not tested it.

This topic is closed to new replies.

Advertisement