Jump to content
  • Advertisement
Sign in to follow this  
giugio

Shaders and meshes

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

Hy. I'm still creating some mesh in dx10. The shader that must render these meshes is the same(for the vertex layout and behaviour) , but i must draw all the meshes. I 'have created a meshes class. This mesh class contains a vertexbufer and an indexbuffer , but is sufficent for the render ? I create also a collection class with an effect(shader) var member , a device var member and i adding all the meshes objects into a vector in the collection , but for the render i can use the same effect shader? I can link the index and the vertex buffer of the mesh class and then rendering with the shader(effect is the same word?) how? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
i'm try to read in more depth the sdk tutorial , but
I seem to have read that there must be a shader tecnique for each vertexbuffer and indexbuffer.
But if i would draw 2 meshes identical i must create 2 effect thecniques is correct?
Then the interface between the data(the mesh in directx9) and the video render is the shader and the tecniques?

But if i would create a mesh i must compile the shader , create vertex and indexbuffers and then


g_pTechniqueRender->GetPassByIndex( 0 )->Apply( 0 );
g_pd3dDevice->DrawIndexed( 36, 0, 0 );



but if i have a lot of meshes i must have a lot of shadertecnique!

And if i have created a "material water shader" , for example that display a meshes in the water material if i have rendered a "cube of water" i can with the same shader render a water sphere ?
The difference is only on the vertex and the index buffers , why i must redefine the effect?
Thanks.

Share this post


Link to post
Share on other sites
You do not need to redefine the shader, you can use the same if you want the same effect and the Input Layout is the same.

Share this post


Link to post
Share on other sites
thanks for the ready responce.
But how i resuse the same shader ?
yes , the effect is the same and also the layout but I must change at least the vertex and index buffer.
How in dx10?

Share this post


Link to post
Share on other sites
Quote:
Original post by giugio
thanks for the ready responce.
But how i resuse the same shader ?
yes , the effect is the same and also the layout but I must change at least the vertex and index buffer.
How in dx10?


Just like you set them in the first time. Set them to the input assembler with ID3D10Device::IASetVertexBuffers and ID3D10Device::IASetIndexBuffer?
you just need to apply the effect one time and then rendering the two meshes changing the vertex/index buffers between the draws...

If you are using the mesh class, i think you just need to call the draw after applying the shader, the class will do the rest. (I'm not sure cause i have my own system for rendering based over raw vertex/index buffers)

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!