PDA

View Full Version : Curves and Truchet Tiles



DragonXTC
01-25-2002, 09:22 AM
Ok here goes my really confusing question. I have never done any graphics programming at all. Im taking a class on it and he throw something at us, he wants us to draw truchet tiles, 20 across etc, of one of four patterns, my current problem is that i just simply cant get curves going with the GL_LINE_STRIP thing. any help anyone could throw me would be greatly appreciated.

nexusone
01-25-2002, 11:46 AM
Try a search on truchet tiles, I found some sites with some math and history on it.

I looked at how the tiles work, it would be simple for you to do the following:

Create your tile paterns in a image editor, from your message sound like you are trying to make your images with Opengl lines, which is not the correct way.
Make the images stay 64 x 64 in size.
Then map that image to a squire object as a texture.
Then map the placement of your squire tiles
on the screen.

Example:

glBindTexture ( GL_TEXTURE_2D, texture_id[0] );
glBegin ( GL_QUADS );
// squire face to draw on
glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.0f, -2.0f, 0.0f);
glTexCoord2f(2.0f, 0.0f); glVertex3f( 2.0f, -2.0f, 0.0f);
glTexCoord2f(2.0f, 2.0f); glVertex3f( 2.0f, 2.0f, 0.0f);
glTexCoord2f(0.0f, 2.0f); glVertex3f(-2.0f, 2.0f, 0.0f);
glEnd();


Originally posted by DragonXTC:
Ok here goes my really confusing question. I have never done any graphics programming at all. Im taking a class on it and he throw something at us, he wants us to draw truchet tiles, 20 across etc, of one of four patterns, my current problem is that i just simply cant get curves going with the GL_LINE_STRIP thing. any help anyone could throw me would be greatly appreciated.