Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


problem with D3DFVF_NORMAL

This topic is 5547 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

when i use this flag for my vertices, everything is either one color like gray with no apparant shading, or flickering and one shade of color. here''s the render part, assuming everything else, like the material is set properly, which i think it is since i took it straight from d3d''s help.

    FLOAT x, y, z;      // The transformed position for a vertex

    DWORD color;        // The vertex color 

    float tu, tv;       // texture coordinates

    float nx, ny, nz;

// Set render state(s)

	lpDevice->SetRenderState( D3DRS_ZENABLE, FALSE );

	// Set the material

	lpDevice->SetMaterial( &mtrl );

	// Set texture style(s)

	lpDevice->SetTexture( 0, m_pTexture );

	// Prepare vertex buffer and then draw

	lpDevice->SetStreamSource( 0, m_pVB, sizeof(CUSTOMVERTEX_TEX) );// )

	lpDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX_TEX );
	lpDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 10 );

	// Set render state(s) back to normal

	lpDevice->SetRenderState( D3DRS_ZENABLE, TRUE );

	// Set texture setting to NULL

	lpDevice->SetTexture( 0, NULL );

Share this post

Link to post
Share on other sites

I didn''t think it mattered as long as I keep it consistent with my custom vertex.

If the normal comes right after the position, then my vertex set must be way out of whack!!

What is the standard anyway? I guess i should look it up on the d3d reference.

thanks for the help.

Share this post

Link to post
Share on other sites
Yeah the order of components in the vertex struct is essential. Otherwise how does D3D expect to know where to find stuff - you don''t declare it anywhere else!

Read about my game, project #1
NEW (18th December)2 new screenshots, one from the engine and one from the level editor

John 3:16

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!