PDA

View Full Version : glutesselation and texture mapping



eldee
01-13-2003, 08:14 PM
how?!
heh... i've searched for a while now looking for a way to use texture
mapping with a complex polygon tesselated by glutess, but the
only thing i found is this (http://www.cfxweb.net/~lpsoftwa/tessellation.htm).
and the source and executable links are both 404, and the author
is MIA (since 2001 in fact). there are, however, screenshots showing
off what i need to accomplish, so i know it's possible http://www.opengl.org/discussion_boards/ubb/smile.gif

actually, i was hoping to be able to tile my texture across a complex
polygon, but i'll take this one step at a time.

anybody have any ideas, or even some tips to get started?

JustHanging
01-14-2003, 01:58 AM
Hi,

You can use glTexGen to automatically generate texture coordinates based on vertex positions. This will affect all geometry, including tesselated polygons. This example will setup the texture in the xy-plane:




var
v : array[0..3] of GlFloat;
...
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
v[0]:=1; v[1]:=0; v[2]:=0; v[3]:=0;
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, addr(v));
v[0]:=0; v[1]:=1; v[2]:=0; v[3]:=0;
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_T, GL_OBJECT_PLANE, addr(v));

It's in Delphi, but should be understandable. addr(v) equals to v in c, I think.

-Ilkka

eldee
01-14-2003, 03:26 AM
thanks for the tip, i'll give it a go when
i get home tonight http://www.opengl.org/discussion_boards/ubb/wink.gif

eldee
01-15-2003, 02:27 PM
hey, that worked great- thanks for the info.