Jump to content
  • Advertisement

Archived

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

Bleakcabal

Texture mapping a triangle strip

This topic is 5960 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 do this
glBegin(GL_QUADS);
		glTexCoord2f(0.0f, 0.0f);
		glVertex2f((GLfloat)0, (GLfloat)0);
		
		glTexCoord2f(1.0f, 0.0f);
		glVertex2f((GLfloat)scr_width, (GLfloat)0);

		glTexCoord2f(1.0f, 1.0f);
		glVertex2f((GLfloat)scr_width, (GLfloat)scr_height);

		glTexCoord2f(0.0f, 1.0f);
		glVertex2f((GLfloat)0, (GLfloat)scr_height);
	glEnd();
 
Everything works fine. But when I do this :
glBegin(GL_TRIANGLE_STRIP);
		glTexCoord2f(0.0f, 0.0f);
		glVertex2f((GLfloat)0, (GLfloat)0);
		
		glTexCoord2f(1.0f, 0.0f);
		glVertex2f((GLfloat)scr_width, (GLfloat)0);

		glTexCoord2f(1.0f, 1.0f);
		glVertex2f((GLfloat)scr_width, (GLfloat)scr_height);

		glTexCoord2f(0.0f, 1.0f);
		glVertex2f((GLfloat)0, (GLfloat)scr_height);
	glEnd();
 
A part of the shape isnt texture mapped, a triangle on the left side of the quad. But I have been using this same triangle strip code to do untextured rectangles and in worked fine. I have read many times on these forums that triangle_strip are faster than quads so I want to use them instead. Does anyone know what I am doing wrong. WHO DO THEY THINK THEY''RE FOOLING : YOU ?

Share this post


Link to post
Share on other sites
Advertisement
refer to this picture right here:


and make sure that your verticies are in the same order as on the picture for GL_TRIANGLE_STRIP (right now they aren''t).

---
shurcool
my project

Share this post


Link to post
Share on other sites
This fixed my problem but now the texture is flipped 90 degress counter-clockwise. But I know you are supposed to submit the texture coordinates in a clockwise fashion, but I can''t do so if I submit vertexes in the right order for the triangle_strip...

WHO DO THEY
THINK THEY''RE
FOOLING : YOU ?



Share this post


Link to post
Share on other sites
Actually it seems to matter for triangle_strips as I can make the texture "flip" a certain way depending on how I submit them.

WHO DO THEY
THINK THEY''RE
FOOLING : YOU ?



Share this post


Link to post
Share on other sites
Just enter the tex coords in the order that makes them look right on the screen. Final output is all that counts, for tex coords at least.

Share this post


Link to post
Share on other sites
Of course it matters how you input things. What sort of programmer are you?
You can draw tri-strips like:

TOP LEFT - TOP RIGHT - BOTTOM LEFT - BOTTOM RIGHT
or
BOTTOM LEFT - TOP LEFT - BOTTOM RIGHT - TOP RIGHT
and several other combinations

Just visualize what you are doing, and you''ll be able to match things up correctly.

------------
aud.vze.com - The Audacious Engine <-- It''s not much, yet. But it''s mine... my own... my preciousssss...
MSN: nmaster42@hotmail.com, AIM: LockePick42, ICQ: 74128155

Share this post


Link to post
Share on other sites
quote:
Just visualize what you are doing, and you''ll be able to match things up correctly.


...and if you can''t do that, buy the OpenGL Red Book.

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!