Original Post
Hello! I have a simple (i hope so) question: Is it possible to render a triangle in Directx without using DrawPrimitive (or a similar function). The problem is: My program creates a large ammount of triangles, but all coordinates can be stored in a byte. In order to push as little data to the GPU as possible i tried to store the position in only the needed 4 byte. So i tried to create a VERTEXELEMENT which looks like
D3DVERTEXELEMENT9 decl[]=
{
{0,0,D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION,0},
D3DDECL_END()
};
I use UBYTE4 because it look like it could be ideal for my problem. I will store in every UBYTE one coordinate. In a vertexshader they should be transformed into the correct float4 value. But now here comes my problem: if i try to use this declaration the DrawPrimitive function returns D3DERR_INVALIDCALL. It says the problem is that POSITION cant be an other type than float3 in the fixed function pipeline. So i tried to change the usage to D3DDECLUSAGE_BLENDWEIGHTS. Now it says that for the fixed function pipeline there has to be a POSITION value. So finally here comes my question: Is it possible either to render triangles only with a shader (only pass the elements in the right order to the shader and tell it the outcome should be a triangle) or create a declaration without the POSITION which works with the drawprimitives function. Tia PaulSmecker