Jump to content
  • Advertisement
Sign in to follow this  
DesignerX

Annoying noob problem

This topic is 4816 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 wrote a method for creating spheres. Now,I use the DrawPrimitiveUP method to check check if the vertices are correct using the point list primitive type. The problem is the vertices are shaded differently from each other and I have no idea why. (the color I use for each vertex is white) My vertex declaration is as follows : #define SPHEREVERTEX_FVF (D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX1) struct SphereVertex { float x, y, z; float nx, ny, nz; udword udwColor; float tu, tv; }; thanks for any help !

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure what you mean by "the vertices are shaded differently from each other", but you have lighting (normal) and texture (uv) information in the vertex. If the sphere is textured and lit, then the vertexes won't all be white.

Share this post


Link to post
Share on other sites
I disabled lighing and texturing as follows :

SetRenderState(D3DRS_LIGHTING, false);
SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DISABLE);

To each vertex I assign the color D3DCOLOR_XRGB(255, 255, 255)
When I render the sphere using POINTLIST the sphere is rendered correctly but
the vertices color is not always white (some are darker or brighter)

Share this post


Link to post
Share on other sites
Bah, you disabled coloring completely. I'm not sure you can even do that ;).

Try this instead:

d3dDevice->SetTexture(0, NULL); // Disable any texture.
d3dDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); // Select Arg 1.
d3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE); // Set Arg 1 to diffuse (the vertex color).


Also, if you've used any other stage (other than 0), be sure to set it to disabled, like you did in your code.

[edit] Added comments...

Share this post


Link to post
Share on other sites
A better way to disable texturing is to just call pDevice->SetTexture(0,NULL);. It saves making two calls, and changing the texture pipeline thingy. (Edit: Assuming you haven't altered the texture parameters in any other way)

As for your problem - what vertices are shaded differently? Are they ones further from the viewer? Or are they on one side of the sphere? Or is it just random? We really need a screenshot I think.

You're not using fog at all, are you?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Looks like forced FSAA is kicking in. Try a solid render instead of points, points are not a useful thing to render anyway.

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!