Jump to content
  • Advertisement

Archived

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

jbay101

using the texture matrix with multitexture

This topic is 5474 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 am having trouble using several texture matricies at once. Below is a example. ///////////////////////////////////// active texture 1 { bind texture matrix -rotate } active texture 2 { bind texture matrix -rotate } active texture 3 { bind } -- render object ///////////////////////////////////// The problem is that texture 3 shouldn''t be transformed by the matrix used for the other two - but it is. This is a severe problem for me. Textures 1 and 2 are used for a surface in my ''world'', and texture3 is a cube map. The cube map rotates with the other textures. The rendered object should have three textures - texture 1 and 2 (rotated) and the cube map reflection. Is this because the texture matrix is global and not relative to a texture? Or is there a mistake somewhere?

Share this post


Link to post
Share on other sites
Advertisement
I''m not sure if i understand your problem but here are some common mistakes that i did while working with multitextures:

Make sure you are not using similar texture identifier for more than one texture, like using GL_TEXTURE1_ARB for more than one texture.
You can use the same identifier if you disable it first.

OpenGL is a state machine, if you rotate once it will effect everything you do later unless you reset the rotation or rotate the other way. Same goes with texture manipulation like scaling the texture matrix.

Share this post


Link to post
Share on other sites
There is only one texture matrix, so all texture units will be affected by the same matrix.
You have 2 solutions : either calculate texture coordinates for all units, or render in several passes. Anyway, you should have a multi-pass rendering path for low-end hardware ;*)

Maybe there''s a vertex shader solution ?


SaM3d!, a cross-platform API for 3d based on SDL and OpenGL.
The trouble is that things never get better, they just stay the same, only more so. -- (Terry Pratchett, Eric)

Share this post


Link to post
Share on other sites
Post you full code please!

--------------------------------------------------------

"If it looks good, it is good computer graphics"
"If it looks like computer graphics, it is bad computer graphics"

Corrail
corrail@gmx.at
ICQ#59184081

Share this post


Link to post
Share on other sites
i might be way off, but isn''t it possible to do:


texture 1
{
bind
texture matrix reset
texture matrix -rotate
}

texture 2
{
bind
texture matrix reset
texture matrix -rotate
}

texture 3
{
bind
texture matrix reset
}

Share this post


Link to post
Share on other sites
Yes, it is possible but you have to select the Modelview Matrix after your texture matrix transformations! If you don''t, any transformation will affect the texture matrix of the selected texture unit (in your case texture unit 3). Maybe that''s your problem, jbay101!

--------------------------------------------------------

"If it looks good, it is good computer graphics"
"If it looks like computer graphics, it is bad computer graphics"

Corrail
corrail@gmx.at
ICQ#59184081

Share this post


Link to post
Share on other sites
thanks guys.

the problem was that the texture matrix transformations are applied to all of the textures - not just the active texture.

I have just modifed the texture co-ords the matrix is no longer needed.

thanks for the ideas!

Share this post


Link to post
Share on other sites
That sounds confusing!
Normally there is a texture matrix for each texture unit! So this have to work!

--------------------------------------------------------

"If it looks good, it is good computer graphics"
"If it looks like computer graphics, it is bad computer graphics"

Corrail
corrail@gmx.at
ICQ#59184081

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!