drawprimitiveup() problem.

Started by
9 comments, last by GekkoCube 20 years, 11 months ago
i had this problem where using drawprimitiveup produced primitives that had color problems. but when i changed to drawprimitive''s and vertex buffers, everything is fine. anybody have a reason for such a thing????
Advertisement
1) does the FVF make sense ?

2) does the FVF code match the vertex structure ?

3) are the elements of the vertex structure in the correct order (position, then normal, then colour, then texture coords) ?

4) is the stride you pass correct for the structure (double check it!) ?

5) check that you''ve used the correct data types in your vertex structure (i.e. that a colour comes out as a DWORD, not 3-4 floats!).

6) check any SetStreamSource() etc type calls.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

thanks for reply.
to ansqer your questions...

1) does the FVF make sense ?
Yes, i triple checked this...in fact, i didnt really have to touch this this when i used vertex buffers. everything else was practically untouched. so i know this isnt the issue.

2) does the FVF code match the vertex structure ?
yes it does.

3) are the elements of the vertex structure in the correct order (position, then normal, then colour, then texture coords) ?
I am using vertices that only have XYZ coordinates and a DIFFUSE color. and yes, they are defined and set in that order.

4) is the stride you pass correct for the structure (double check it!) ?
Now this is where I am unsure about. I dont know exactly what this means. What I pass for the stride information is this:

sizeof( CUSTOMVERTEX_UNTRANSFORMED )

where CUSTOMVERTEX_UNTRANSFORMED is D3DFVF_XYZ | D3DFVF_DIFFUSE.

5) check that you''ve used the correct data types in your vertex structure (i.e. that a colour comes out as a DWORD, not 3-4 floats!).
Is this again to double-check that my vertices are defined in proper order, XYZ first, DIFFUSE second?

6) check any SetStreamSource() etc type calls.
Before using vertex buffers i never made any calls to SetStreaSource(). Im not even sure what its for outside of vertex buffers.
For the stride, you must pass a sizeof of your vertex structure, not your FVF.
GraphicsWare|RenderTechhttp://www.graphicsware.com3D Graphics & Solutions
where CUSTOMVERTEX_UNTRANSFORMED is D3DFVF_XYZ | D3DFVF_DIFFUSE.


untransformed?
D3DFVF_XYZRHW

, where:
float x,y,z;
float rhw; // 0
dword color;

.lick
quote:Original post by aker_jus
For the stride, you must pass a sizeof of your vertex structure, not your FVF.


he did it right


.lick
quote:Original post by Pipo DeClown
Original post by aker_jus
For the stride, you must pass a sizeof of your vertex structure, not your FVF.

he did it right



pipo: umm no he didn't...for the stride like aker_jus said u have to pass the sizeof your vertex structure and not the fvf

and for your reference pipo....his vertex format is untransformed....D3DFVF_XYZRHW is already transformed...


[edited by - SnakeHunta on May 1, 2003 9:18:32 AM]
DrawPrimitiveUP is buggy and slow, it should never be used and it should be deprecated from the DirectX API.

------------------------------------------------------
Cuando miras al abismo el abismo te devuelve la mirada.
F. Nietzsche
Ok, I just figured out why i was experiencing some weird things.

I was defining my vertex buffer as a pointer in which i would dynamically allocate memory for it.
evidently, DX does not like that, even though it lets you do it.
so, i simply declared it with a predetermined length.
this works!
quote:Original post by Abominacion
DrawPrimitiveUP is buggy and slow, it should never be used and it should be deprecated from the DirectX API.

It''s often mis-used but that doesn''t make it buggy. Additionally it tends to be used by newbies since it''s easier to get into, and they''re even more likely to use it wrong.

I''ll agree about it being slow, but it''s not buggy and I see no reason for it not to be in the API.


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena

This topic is closed to new replies.

Advertisement