Jump to content

View more

Image of the Day

The beast has a mighty searchlight of evil! #screenshotsaturday https://t.co/bzKepOojDL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Odd OpenGL Texture Problem

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
9 replies to this topic

#1 Galileo430   Members   

122
Like
Likes
Like

Posted 13 June 2001 - 05:03 PM

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

#2 Lord Chaos   Members   

122
Like
Likes
Like

Posted 13 June 2001 - 11:46 PM

And do you call

glEnable( GL_TEXTURE_2D );

before rendering?


#3 Krippy2k   Members   

134
Like
Likes
Like

Posted 14 June 2001 - 03:34 AM

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



#4 Lord Chaos   Members   

122
Like
Likes
Like

Posted 14 June 2001 - 04:52 AM

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.


#5 Galileo430   Members   

122
Like
Likes
Like

Posted 14 June 2001 - 06:08 AM

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

#6 Anonymous Poster_Anonymous Poster_*   Guests   

Likes

Posted 14 June 2001 - 06:31 AM

is Texturing enabled?

glEnable(GL_TEXTURE_2D)


Mathias

#7 Anonymous Poster_Anonymous Poster_*   Guests   

Likes

Posted 14 June 2001 - 08:42 AM

And you have a current texture?

#8 zedzeek   Members   

528
Like
Likes
Like

Posted 14 June 2001 - 02:59 PM

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

#9 Galileo430   Members   

122
Like
Likes
Like

Posted 15 June 2001 - 04:37 PM

Got it.. (I think)

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

Grandus.Com

#10 WhatEver   Members   

125
Like
Likes
Like

Posted 16 June 2001 - 03:44 AM

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.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.