View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Render a triangle and cube same time ?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

5 replies to this topic

### #1andrei94  Members

Posted 19 June 2012 - 11:12 AM

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

Ty ;D

### #2Fredericvo  Members

Posted 19 June 2012 - 01:35 PM

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.

### #3andrei94  Members

Posted 19 June 2012 - 01:37 PM

so i should use multiple vertex buffers right ? 1 buffer for each element :-??

### #4Fredericvo  Members

Posted 19 June 2012 - 01:42 PM

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.

### #5andrei94  Members

Posted 19 June 2012 - 01:43 PM

Thank's a lot man that really helped me

### #6Fredericvo  Members

Posted 19 June 2012 - 01:54 PM

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.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.