Jump to content
  • Advertisement

Archived

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

skyx

A problem on glTexGen

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

In Nehe''s lessons I''ve learned that using GL_S and GL_T can obtain texture''s coordinates automatically.So I used them in my programme instead of using glTexCoor3f():
		glBindTexture(GL_TEXTURE_2D, texture[13]);
		
		glEnable(GL_TEXTURE_GEN_S);						// auto S coordinates

		glEnable(GL_TEXTURE_GEN_T);						// auto T coordinates

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

		glTranslatef(320.0f, 300.0f, 0.0f);
		glBegin(GL_QUADS);
		glVertex3f(width/2.0f, height/2.0f, 0.0f);
		glVertex3f(-width/2.0f, height/2.0f, 0.0f);
		glVertex3f(-width/2.0f, -height/2.0f, 0.0f);
		glVertex3f(width/2.0f, -height/2.0f, 0.0f);
		glEnd();

		glDisable(GL_TEXTURE_GEN_S);
		glDisable(GL_TEXTURE_GEN_T);	
but nothing appeared.I think that there is something wrong with the parameters of the function glTexGeni(),but I don''t know what is the matter.Would you please give me some advice?Thanks very much.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);

glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);


You have GL_OBJECT_LINEAR instead of GL_SHPERE_MAP.

This tells GL what type of tex-coord generation to preform

Share this post


Link to post
Share on other sites
What does nothing in "but nothing appeared" refer to? No texture, texture but no texture coordinates generated, no object at all, everything but that objects, or something else?

Share this post


Link to post
Share on other sites
I mean a black screen by nothing.
I've used GL_SPHERE_MAP parameter but only part of the texture appeared,not the whole image.I used glNormal3f(), but it dosen't work.
Aother question, why GL_OBJECT_LINEAR show nothing? Thank you!

[edited by - skyx on June 17, 2003 9:14:38 PM]

Share this post


Link to post
Share on other sites
Yes, I''ve enable texture. If I change the code like this:
glBegin(GL_QUADS);
glColor3f(1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(width/2.0f, height/2.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(-width/2.0f, height/2.0f, 0.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-width/2.0f, -height/2.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(width/2.0f, -height/2.0f, 0.0f);
glEnd();
That''s OK, but using GL_S and GL_T, it dosen''t work.

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!