Jump to content
  • Advertisement
Sign in to follow this  
QuinnJohns

Texturing Tesselators, using TexCoord?? Possible?

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

Hello, I'm trying to utilize a texture on a tesselated surface in my display list. Which isn't obtaining the texture. The same texture is working on my other surfaces - just not tesselated ones. The following code, is what I've done....
double			cubeside[4][3] =
		        {
			         8, 0,  8,
			         8, 0, -8,
		                -8, 0, -8,
		                -8, 0,  8
		        };

double			window[14][3] =					  
		        {
			        0, 0,    2,
		             -1.5, 0,  1.7,
		             -1.7, 0,  0.5,
		             -1.7, 0, -2.0,
		              1.7, 0, -2.0,
		              1.7, 0,  0.5,
		              1.5, 0,  1.7,

			        0, 0,    2,
		             -1.5, 0,  1.7,
		             -1.7, 0,  0.5,
		             -1.7, 0, -2.0,
		              1.7, 0, -2.0,
		              1.7, 0,  0.5,
		              1.5, 0,  1.7,
		        };

glBindTexture(GL_TEXTURE_2D, g_stoneTexture);

glPushMatrix();
	glRotated(90,0.0,0.0,1.0);
	gluTessProperty(tess, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE);
	gluTessBeginPolygon(tess, NULL);
		gluTessBeginContour(tess);
			// glTexCoord2f(1.0, 1.0); Is this where I would put it?
			gluTessVertex(tess, cubeside[0], cubeside[0]);
			// glTexCoord2f(1.0, 0.0); Is this where I would put it?
			gluTessVertex(tess, cubeside[1], cubeside[1]);
			// glTexCoord2f(0.0, 0.0); Is this where I would put it?
			gluTessVertex(tess, cubeside[2], cubeside[2]);
			// glTexCoord2f(0.0, 1.0); Is this where I would put it?
			gluTessVertex(tess, cubeside[3], cubeside[3]);
		gluTessEndContour(tess);
		gluTessBeginContour(tess);
			gluTessVertex(tess, window[0], window[0]);
			gluTessVertex(tess, window[1], window[1]);
			gluTessVertex(tess, window[2], window[2]);
			gluTessVertex(tess, window[3], window[3]);
			gluTessVertex(tess, window[4], window[4]);
			gluTessVertex(tess, window[5], window[5]);
			gluTessVertex(tess, window[6], window[6]);		
		gluTessEndContour(tess);
	gluTessEndPolygon(tess);
glPopMatrix();

Image hosted by Photobucket.com Is there any suggestions on how I could fix this? Because, the glTexCoords, that I put there, I commented, since they weren't doing anything.... [Edited by - QuinnJohns on November 29, 2005 2:40:33 PM]

Share this post


Link to post
Share on other sites
Advertisement
When you call gluTessEndPolygon, it processes the entire mesh at once. Inserting OpenGL state calls inbetween passing of vertex data will do nothing.

The third parameter you pass to gluTessVertex should also contain "extra" vertex data, such as color info and texture coordinates along with the vertex position. You might also need to hook the combine function so you can derive new texture coordinates from polygons that have intersections.

You should probably read Chapter 11 of the Red Book again, especially the part regarding "User-Specified Data".

Oh, and please don't tessellate in realtime. :)

Share this post


Link to post
Share on other sites
Quote:
Original post by bpoint
When you call gluTessEndPolygon, it processes the entire mesh at once. Inserting OpenGL state calls inbetween passing of vertex data will do nothing.

The third parameter you pass to gluTessVertex should also contain "extra" vertex data, such as color info and texture coordinates along with the vertex position. You might also need to hook the combine function so you can derive new texture coordinates from polygons that have intersections.

You should probably read Chapter 11 of the Red Book again, especially the part regarding "User-Specified Data".

Oh, and please don't tessellate in realtime. :)


Yeah, I figured, that I'd have to handle it in either the VertexCallback or the CombineCallback, where I could obtain individual vertices. Oh, and I don't tesselate in real time. Those were just code blocks, that I threw in the code tag. Thanks for the suggestions.

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!