Skip to main content
gamedev.net
🔒 Locked

Quad rendering

Started by steg Mar 21, 2003 at 12:26 PM 3 replies 350+ views
Original Post
steg
steg
Hi people, When using quad for a terrain, do i need to set y-coord of each vertex in quad to same value then next quad gets new y-coord from height map ? Thanking you.
If it isn't working, take a bath, have a think and try again...
ctoan
ctoan
Well, in DirectX, you can only directly draw triangles, but either way, set each vertex to a new y value. This way, the position is interpolated across the entire primitive.

Chris Pergrossi
< ctoan >
Chris Pergrossi< ctoan >My Realm
steg
steg
Thanks,

I am setting each y-value in vertex to a new value, one from the height map i.e.I have a height map of 32x32 so I am drawing 32 triangle strips, still not getting desired result, it seems some of my triangles are getting culled because they must be binding wrong way due to value getting back from height map ?
If it isn't working, take a bath, have a think and try again...
DanH
DanH

Are you finding that alternate triangles are being rendered with backface culling on - if so, its what I mentioned in my post that you ignored on your other thread. You have the winding wrong. i.e. The order of the verticies is incorrect for a strip.

You can test this by moving the camera under the strip and seeing if the missing tri''s appear.
steg
steg
Sorry DanH didn''t mean to ignore the message you posted, I much appreciate your comments.
I''m just rendering from what I believe to be correct, again I will re-iterate the code I am using:

for(int z=0; z<32; z++) // 1024 is height size
{
for (int x=0; x<32; x++)
{
quadVertices[z][x].x = (float)x;
quadVertices[z][x].z = (float)z;// * ScaleZ;
quadVertices[z][x].y = GetHeight(z,x) / 8;
quadVertices[z][x].DiffuseColor = D3DCOLOR_XRGB(0,255,0);
}
}
The z is incremented for each new strip, I''m drawing 32 in all. The GetHeight function returns a height value from the height map.

I then render this as follows:

for(int i=0; i<32; i++)
{
g_pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, i*32, 29);
}

Maybe I should try using a triangle list first ?

Best regards,
Steve
If it isn't working, take a bath, have a think and try again...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.