Skip to main content
gamedev.net
🔒 Locked

Vertex buffer question

Started by Oddball Aug 9, 2001 at 7:34 PM 2 replies 350+ views
Original Post
Oddball
Oddball
I''m using a vertex buffer to render primitives to the screen, and a matrix to move them around. However, I''d like to render another primitive to the screen, without it being moved around by the matrix. I was thinking of creating a different vertex buffer to hold those primitives. Is this the best way to go about it? Does having 2 vertex buffers cause a significant performance loss? Thanks.
Oddball
Oddball
Whoops... it turns out that creating a vertex buffer still doesn't solve the problem- the matrix effects both. So how do I make the matrix's transformations apply to only one? I don't need another D3D Device, do I? Thanks.

Edited by - Oddball on August 9, 2001 8:56:48 PM
reaptide
reaptide
Hey there,

Your problem is relatively easy to fix.

You can either:

- Set the matrix.
- Render the first primitive.
- Load the Identity Matrix.
- Render the Second Primitive.

* Or *

- Render the Second Primitive.
- Set the Matrix.
- Render the First Primitive.

A matrix doesn''t effect just the object you are rendering. It effects the whole world. After moving your first object according to the matrix, you have to reset the matrix to its default position; or set a new position, before rendering your next polygon.

I hope that wasn''t too confusing. Just ask if you need more help.

Derek Sauer
dereksauer@hotmail.com
JonStelly
JonStelly
SetTransform(...);
DrawPrimitive(...);
SetTransform(...);
DrawPrimitive(...);

If you''re drawing 2 of the same object, then you can just render it twice. If there are 2 different objects you can either use multiple vertex buffers, or a single vertex buffer and multiple index buffers.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.