Render a triangle and cube same time ?

Started by
4 comments, last by Fredericvo 11 years, 10 months ago
Hello everyone !

From the title u can see that i'm a total beginer... i've read a book about dx11 and msdn tutorials... i understood them ... bot no one had an example with ... rendering 2 things with diferent geometry... let's say i want to draw a cube and a triangle... how i do that... if my vertex buffer store the cube vertices... how i modify it or what should i do to be able to render the 2 objects :D


Ty ;D
Advertisement
One draw call per object.
I.e. Set world, view,projection, material/texture and vertex buffer for object 1. Draw.
Set whatever changed I.e. World, vertex buffer 2 (if different object) and draw.
so i should use multiple vertex buffers right ? :D 1 buffer for each element :-??
It sure seems silly for such simple geometry but imagine a house and a car for example. You would set all settings and renderstates for the house, draw it, do it again for the car and draw it. You're right that it requires creating 2 VB's and possibly 2 index buffers as well if you use that which you should.
Thank's a lot man :D that really helped me
Welcome man :-)
One more thing, if you draw let's say the car 2 or more times then obviously you don't need a VB for each instance but only change its position (worldmatrix!) and draw from same VB/IB again.

This topic is closed to new replies.

Advertisement