Jump to content
  • Advertisement
Sign in to follow this  
littlekid

Mesh and Vertex Shader

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

How do people normally go about rendering their meshes from .X files. Do they use the method like the example in the SDK. Using Draw Subsets etc. Or read in the file and get all the information out, and use a vertex shader to draw them?

Share this post


Link to post
Share on other sites
Advertisement
IIRC, you can actually do both. Since DrawSubset() only sets states such as vertex declaration and buffer streams, you can still use your own vertex and pixel shaders with it. For example, if you are using the effects framework, something like this:

// Set the technique
effect->SetTechnique( "myTechnique" );

// Activate
UINT numPasses = 0;
effect->Begin( &numPasses, 0 );

// Render each pass
for( int i = 0; i < numPasses; i++ )
{
// Set your constants and stuff
effect->SetValue(...);

// Activate pass
effect->BeginPass(i);

...

// Draw the subset
mesh->DrawSubset(0);

effect->EndPass();
}

effect->End();


Something along those lines should work pretty well.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!