Quad Confusion...

nazgul42

17-02-2008 21:54:40

When I use this code to render a textured quad, it works fine:

obj.Begin(material, RenderOperation.OperationTypes.OT_TRIANGLE_STRIP);
obj.Position(-100, 100, 0);
obj.TextureCoord(0, 0);
obj.Position(-100, -100, 0);
obj.TextureCoord(0, 1);
obj.Position(100, -100, 0);
obj.TextureCoord(1, 1);
obj.Position(100, 100, 0);
obj.TextureCoord(1, 0);
obj.Index(0);
obj.Index(1);
obj.Index(2);
obj.Index(3);
obj.Index(0);
obj.End();


but when I use this code, nothing shows:

obj.Begin(material, RenderOperation.OperationTypes.OT_TRIANGLE_STRIP);
obj.Position(-100, 0, -100);
obj.TextureCoord(0, 0);
obj.Position(-100, 0, 100);
obj.TextureCoord(0, 1);
obj.Position(100, 0, 100);
obj.TextureCoord(1, 1);
obj.Position(100, 0, -100);
obj.TextureCoord(1, 0);
obj.Index(0);
obj.Index(1);
obj.Index(2);
obj.Index(3);
obj.Index(0);
obj.End();

Marioko

18-02-2008 05:07:45

because in the second you are setting Z > 0. In 2D graphics only X and Y are important, Z always need be zero. The first snippet are right. X,Y and Z=0

nazgul42

18-02-2008 12:15:03

So... how would I be able to rotate a quad so it is horizontal?

Sairon

24-02-2008 14:23:53

Try changing Y in the second, if I'm reading it correctly you're creating a quad out of 4 positions where all vertices are on a line.