huh!? D3D9 acting differently than D3D8

Razor89
07-23-2004, 10:28 PM
Could any of you tell me how to fix this?
Its not drawing the textured quad correctly. I get a wierd shape and it
doesnt display the texture correctly.

Here is my vertexs's initiation code:


Quad(0) = New Direct3D.CustomVertex.TransformedColoredTextured(0, 0, 0, 0, Color.White.ToArgb, 0, 0) '0, 0
Quad(1) = New Direct3D.CustomVertex.TransformedColoredTextured(0, 0, 0, 0, Color.White.ToArgb, 1, 0) '1, 0
Quad(2) = New Direct3D.CustomVertex.TransformedColoredTextured(0, 0, 0, 0, Color.White.ToArgb, 0, 1) '0, 1
Quad(3) = New Direct3D.CustomVertex.TransformedColoredTextured(0, 0, 0, 0, Color.White.ToArgb, 1, 1) '0, 0


Here is my drawing code:


Private Sub DrawTile(ByVal X As Integer, ByVal Y As Integer)
With Quad(0)
.X = (X * 32)
.Y = (Y * 32)
.Tu = 0
.Tv = 0
End With
With Quad(1)
.X = ((X * 32) + 32)
.Y = (Y * 32)
.Tu = 1
.Tv = 0
End With
With Quad(2)
.X = ((X * 32) + 32)
.Y = ((Y * 32) + 32)
.Tu = 0
.Tv = 1
End With
With Quad(3)
.X = (X * 32)
.Y = ((Y * 32) + 32)
.Tu = 1
.Tv = 1
End With
cMolecule.D3DDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, Quad)
End Sub


Thanks for your help.

Here is what it looks like:

sgt_pinky
07-25-2004, 11:43 PM
Yep, it caused by culling. You have two options. First, is to simply reverse the triangle nodes so that the normal out of the plane of the monitor. Ie, in your vertex buffer, put the vertex coordinates so they are counterclockwise, or clockwise, in line with the other traingles.

OR, you can turn the culling off on the render device altogether -

dRender.RenderState.CullMode = Cull.None

;)

btw, I am wondering why you use four tria's to draw a quad, when it can be done with 2, which is 50% more efficient ;)

Razor89
07-29-2004, 12:59 PM
Actually I know what I am doing.
I just overlooked that I didn't set the RHW value to 1.

I am actually using a triangle strip with 4 vertices.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum