PDA

View Full Version : strange terrain



apocalexiz
08-24-2003, 07:40 PM
hy there

i tried to do a little terrain w/o lighting material settings and a texture at first, my prob is that you will see the "triangle strips" not the triangles but the strips...

here u will found a picture of my problem
http://www.geocities.com/ismirnichegal/opengl/Desktop3.jpg

ive rendered the picture in polygon fill mode, and give every vertex a color determined by the height...to simulate darker parts in deeper areas

bye

apo

08-25-2003, 06:57 AM
It seems that on top of not posting any code from your program, the picture you posted isn't online. It is a bit difficult to analize anything without those things.

apocalexiz
08-25-2003, 08:02 AM
i dont know why u cant reach the picture...i can http://www.opengl.org/discussion_boards/ubb/smile.gif (its not cached)

but here is the code u asked for...

glBegin(GL_TRIANGLE_STRIP);
for(row = 0; row < surface_rows-1 ; row++)
{
if(!reverse)
{
for(col=0; col < surface_cols-1; col++)
{
glColor3f(surface[row][col][3],surface[row][col][3],surface[row][col][3]);

glVertex3f( surface[row+1][col][0], surface[row+1][col][1], surface[row+1][col][2] );
glVertex3f( surface[row][col][0], surface[row][col][1], surface[row][col][2]);

}
}
else
{
for(col=surface_cols-2; col >=0 ; col--)
{
glColor3f(surface[row][col][3],surface[row][col][3],surface[row][col][3]);

glVertex3f( surface[row][col][0], surface[row][col][1], surface[row][col][2]);
glVertex3f( surface[row+1][col][0], surface[row+1][col][1], surface[row+1][col][2] );
}
}

reverse = !reverse;
}
glEnd();

apocalexiz
08-25-2003, 08:10 AM
i re-uploaded the file...
http://www.geocities.com/ismirnichegal/opengl/desk3.jpg

and i forgot to say...for the code above, i've used a matrix filled up with the vertices

bye

1234!
08-25-2003, 08:27 AM
Originally posted by apocalexiz:
i re-uploaded the file...
http://www.geocities.com/ismirnichegal/opengl/desk3.jpg

and i forgot to say...for the code above, i've used a matrix filled up with the vertices

bye
www.geocities.com (http://www.geocities.com) doesnt allow remote linking (I think) so go to http://www.geocities.com/ismirnichegal/opengl/ instead and you will get the images.

For what you did to render them, they look perfectly fine (the jpeg is pretty low quality though).

Perhaps you should tell us how you expected them to look like?

dorbie
08-25-2003, 08:46 AM
You are missing a color this code:

glColor3f(surface[row][col][3],surface[row][col][3],surface[row][col][3]);

glVertex3f( surface[row+1][col][0], surface[row+1][col][1], surface[row+1][col][2] );
glVertex3f( surface[row][col][0], surface[row][col][1], surface[row][col][2]);

should look more like:

glColor3f(surface[row+1][col][3],surface[row+1][col][3],surface[row+1][col][3]);

glVertex3f( surface[row+1][col][0], surface[row+1][col][1], surface[row+1][col][2] );

glColor3f(surface[row][col][3],surface[row][col][3],surface[row][col][3]);

glVertex3f( surface[row][col][0], surface[row][col][1], surface[row][col][2]);

Same for the other loop.

This is compounded by an optical illusion, one of the Mach effects (I won't call it banding since that's a slightly different illusion IMHO).

apocalexiz
08-25-2003, 09:21 AM
dorbie
******

ahh...it works with the 2 glColor calls...

*lol* how could i forgot the second color...oh man... http://www.opengl.org/discussion_boards/ubb/wink.gif

thx folks