Sign in to follow this  

Texture coordinate generation problem

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

This topic is 2541 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this