Jump to content
  • Advertisement

Archived

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

Plasmite

GL: RGB & RGBA

This topic is 5318 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

I have a little problem with alpha-channel-textures. First I create couple of textures with glTexImage2D having third argument 3 and seventh GL_RGB. These have worked fine. Now I added a new texture, and it is generated with arguments 4 and GL_RGBA. I assume that should create a texture with alpha channel. Then I use glBindTexture to bind a texture with NO alpha channel, but when draw it to the screen, the texture is all messed up. If I comment out the part, where I create the alpha-channel-texture, other textures work fine again. To me it looks like, that I''m now drawing (3 bytes) textures with no alpha-channel as if there was (4 bytes) alpha-channel-texture to be read. How can I tell GL that I''m using textures with 3 bytes? This creation of alpha-channel-texture somehow appears to make GL think that I want to use 4 byte textures all the time.

Share this post


Link to post
Share on other sites
Advertisement

>>How can I tell GL that I''m using textures with 3 bytes?
this is specified with a parameter of glTexImage..., when you are creating your textureobject.

later on, you are only binding, again, the desired texture object - then using it, is in it''s usual manner...

DJSnow
---
this post is manually created and therefore legally valid without a signature

Share this post


Link to post
Share on other sites
hmhmhmhmhmh............... well, that''s the way I hoped it would work.

For some reason, creating one 4bytes texture, messes up drawing of an other 3bytes texture.

Basicly, like this:


Generates:

glBindTexture(..., a);
..
glTexImage2D(....,3,...GL_RGB,...);

glBindTexture(..., b);
...
glTexImage2D(.....,4....,GL_RGBA,...);


Draws:

glBindTexture(...., a);
glBegin(GL_QUADS);
......

And the texture "a" is totally messed up. If I change texture "b" to be 3 bytes too, then texture "a" works again.

????

Share this post


Link to post
Share on other sites
please post your complete texture-object creation code !

DJSnow
---
this post is manually created and therefore legally valid without a signature

Share this post


Link to post
Share on other sites
ääääähhhhhhhh! I got it.

I had had glBindTexture() several times between glBegin() and glEnd(). I didn''t know there''s anything wrong with that. Now I put glBegin() and glEnd() many times, and glBindTexture always before them, and everything started to work.

So the lesson was to not try to change texture between glBegin() ans glEnd(). That''s it..............

Share this post


Link to post
Share on other sites

>>Now I put glBegin() and glEnd() many times, and glBindTexture
>>always before them, and everything started to work.
i think, this you could have figured out by reading clearly the same tutorial, which told you how to use glTexImage... *g*



DJSnow
---
this post is manually created and therefore legally valid without a signature

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!