• Advertisement

Archived

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

GL_LINES and Textures

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

Simple question: How do you assign textures when rendering lines? Textures do work for normal polygons, but i now need to assign textures for lines too. Currently the lines get rendered without any textures, just with the material colorvalues. Here''s a short summary of what i''m doing: (Lines are rendered antialiased) Material (diffuse, ambient, etc) is set. A texture is set. Blending is enabled. LOOP each line Texcoords are set for each line vertex. A normal is set for each line vertex. Line is rendered. END LOOP Setting glPolygonMode for GL_LINES and rendering the lines using polygons would probably solve this, but it doesn''t sound to be a very good solution. Any ideas on this?

Share this post


Link to post
Share on other sites
Advertisement

glEnable(GL_TEXTURE_2D);
glBegin(GL_LINES);
glTexCoord2f(0.0f, 1.0f);
glVertex2f(0.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex2f(1.0f, 0.0f);
glEnd();


To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites
Thanks for your reply.

So basically you mean that i should enable texturing once just before i''m rendering the lines? Sounds odd since i''ve learned that OpenGL is a state machine, and because i''ve already enabled the 2D texture-bit it should stay enabled. Well, off to try it anyway...

Share this post


Link to post
Share on other sites

  • Advertisement