Jump to content
  • Advertisement

Archived

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

Floating

My textures are black... (;_;)

This topic is 5713 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, I load textures and initialize them correctly. Then I draw a lot of different non-textured things. Then when I want to draw a simple textured quad, it just appears black! My textures loading routine works fine (I took it from another of my applications where textures are working), but it seems I forgot some important setting. Could someone please tell me the important settings required to be able to display textures? (like glDisable(GL_LIGHTING), etc.) I initialize the textures like this: glBindTexture (GL_TEXTURE_2D, id); glPixelStorei (GL_UNPACK_ALIGNMENT, 1); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_REPEAT); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,GL_MODULATE); glTexImage2D (GL_TEXTURE_2D, 0, texFormat, imageWidth, imageHeight, 0, texFormat, GL_UNSIGNED_BYTE, imageData); Then I try using that texture with: glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D,1); glDisable(GL_LIGHTING); glBegin(GL_QUADS); glTexCoord2f(0.0f,0.0f); glVertex3i(0,0,0); glTexCoord2f(1.0f,0.0f); glVertex3i(100,0,0); glTexCoord2f(1.0f,1.0f); glVertex3i(100,100,0); glTexCoord2f(0.0f,1.0f); glVertex3i(0,100,0); glEnd(); Thanks for your help

Share this post


Link to post
Share on other sites
Advertisement
Hi, me again!

I have a very quick question related to the previous one:

glColor3f(a,a,a) with a between 0 and 1 displays my texture from black (a=0) to normal colors (a=1).

How can I reach a similar effect but from white to normal colors?
Or how can I blend my texture with the background?

Share this post


Link to post
Share on other sites
a) I don''t think you can, without changing the texture itself...
b) could you be a bit more specific about how you want it to blend against the background?

Share this post


Link to post
Share on other sites
Thanks James,

What I want to do is display "icons" on a white surface. Some of them can be enabled (normal colors), others disabled (paler colors). The last case seems to be blending, no?

Can''t I apply some kind of filter?

Share this post


Link to post
Share on other sites
If you are puting that icon over same background then it might be easier/faster just to make two textures and apply them as needed.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!