Jump to content
  • Advertisement
Sign in to follow this  
Alkhimey

Texture coordinate generation problem

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

When I generate coordinates with GL_EYE_LINEAR. When I specify the plane, for some reason I get the same results as generating with GL_OBJECT_LINEAR.

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);

float s[4] = {1,0,0,0};
float t[4] = {0,1,0,0};
glTexGenfv(GL_S, GL_EYE_PLANE, s);
glTexGenfv(GL_T, GL_EYE_PLANE, t);

Notice that he planes I try to set here are the same as the default planes.
The result is:
http://i.imgur.com/1yzCw.jpg

When I generate without plane (default plane) I get the expected results.

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);

The result is:
http://i.imgur.com/otJ4j.jpg

What can be the reason for this?


Thank you.

[Edited by - Alkhimey on December 26, 2010 2:26:25 AM]

Share this post


Link to post
Share on other sites
Advertisement
the code you are showing here should work, because it is doing everything right.

You just have to check all your code if you don't made some where else an error, for example are you calling the "glTexGenfv" in a right way(that's where everything goes wrong^^)?

Share this post


Link to post
Share on other sites
Quote:
Original post by Danny02
the code you are showing here should work, because it is doing everything right.

You just have to check all your code if you don't made some where else an error, for example are you calling the "glTexGenfv" in a right way(that's where everything goes wrong^^)?



What do you mean by "calling glTexGen in a right way"? Is the way I wrote in the code (first code example) correct?

Maybe there is an order that these commands should be executed with?

Share this post


Link to post
Share on other sites
I have tried to see what plane is actually stored in opengl (using glGetTexGenfv)and got that the plane actually stored is different from what I supply:

GLfloat params[4] = {1,0,0,0};
GLfloat* test = new GLfloat[4];
glGetTexGenfv(GL_S, GL_EYE_PLANE, test); test is {1, 0, 0, 0} as expected
glEnable(GL_TEXTURE_GEN_S);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGenfv(GL_S, GL_EYE_PLANE, ¶ms[0]);
glGetTexGenfv(GL_S, GL_EYE_PLANE, test); // test is {0.416666, 0, 0, 0}

When I move or rotate my model the last plane values that are returned change as well.
This does not happen with GL_OBJECT_PLANE.



Still looking for a solution...

Share this post


Link to post
Share on other sites
The modelviewmatrix transforms the plane vector. I recommend to set glLoadIdentity before calling glTexGenfv(GL_S, GL_EYE_PLANE, s);

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!