Jump to content
  • Advertisement
Sign in to follow this  
Eric kim

DrawPrimitiveUP Problem

This topic is 4896 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using following setting struct sVERTEX { D3DXVECTOR3 p; D3DXVECTOR3 n; float u, v; sVERTEX():p(0,0,0),n(0,0,0),u(0),v(0) { } }; and this FVF DWORD dwfvf = ( D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 ); But when i turn on lighting, the vertex always turn black. I tried Vertex buffer but it became alot slower (From 250fps to 80fps) I also tried the vertex type that i used for vertex buffer and then many vertices were rendered as they got null position How can i make it work fast and make lighting work.

Share this post


Link to post
Share on other sites
Advertisement
Tried vertex buffer?.. what did u use before? :?

First of all, when you have lighting enable (I asume it's Fixed T&L), you must have right normals and a material (for color settings).


Share this post


Link to post
Share on other sites
Quote:
sVERTEX():p(0,0,0),n(0,0,0),u(0),v(0)

I'd say this is your problem. You're setting up a 0 normal, which will always make the output of any light 0 unless there is an ambient component.

Change this to a unit vector pointing in an appropriate direction and you might have more luck [smile]

hth
Jack

Share this post


Link to post
Share on other sites
I did work out normals and it worked when i used drawprimitive.
This vertex format doesnt work for DPUP and it works if i use vertexbuffer.
struct CUSTOMVERTEX{
D3DXVECTOR3 p;
D3DXVECTOR3 n;
D3DCOLOR color;
float u,v;
};

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!