0
\$\begingroup\$

How can I draw many different objects on screen at once, with multiple vertex buffers, using DrawIndexed()? (Drawing the same object is simple, and I'm not looking to instance)

...but I am looking to transform two different vertex buffers. (Yes I am using indexed vertices)

\$\endgroup\$
1
\$\begingroup\$

You can bind multiple vertex buffers at once. However, unless you use instancing or similar (passing transform data in a constant buffer, for example, which becomes cumbersome beyond a certain number of objects and which is effectively the same as instancing anyway), all the buffers bound at a given draw call share the same bound transformation.

In other words, your options are:

  • use instancing (which you have discarded for some unspecified reason)
  • use constant buffers to emulate instancing (which may also be off the table for the above)
  • make multiple draw calls, one for each buffer into which you were able to pack all the objects that can share a transform
  • pre-transform all your objects on the CPU, write their final world-space vertices into the buffer, and draw that (somewhat silly)
\$\endgroup\$
  • \$\begingroup\$ I didn't want to instance because the content of each vertex buffer was different. It was something simpler than the draw calls. I'm unsure how to refer to individual (indexed) vertex data in the index buffer... If I need to of course... and also confuzzled about how to wrap the data in a class for transforms. I thought about the cpu option, but my storage structures were in the heap and transforms would be called every single frame -or updated when changed... and it defeats the use of the GPU. :P \$\endgroup\$ – Rashid Ellis Feb 6 '14 at 4:56
0
\$\begingroup\$

Creating an OBJECT class did the trick. It allowed for object data separation and the member support I was looking for.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.