[solved] expose VertexData in RenderToVertexBuffer?

What it says on the tin: a place to discuss proposed new features.
Post Reply
cloud
Gremlin
Posts: 196
Joined: Tue Aug 08, 2006 6:45 pm

[solved] expose VertexData in RenderToVertexBuffer?

Post by cloud » Sat Nov 15, 2008 1:22 pm

Hi there.

I've been trying to read back VertexData for creating collision geometry but couldn't see a way to get at it. So I tried changing RenderToVertexBuffers mVertexData to public and printing out the vertex positions, and that seems to work. For example for my terrain a chunk that generated no verts printed nothing one that did printed lots and the values looked correct. I could create a test mesh just to be sure.

Anyhoo tentively suggesting making protected mVertexData public vertexData or a getVertexData, or something.
Last edited by cloud on Mon Nov 17, 2008 12:06 pm, edited 1 time in total.
0 x

User avatar
Karan
Halfling
Posts: 62
Joined: Wed Sep 17, 2008 1:59 pm
Location: Berlin, Germany

Post by Karan » Sun Nov 16, 2008 12:53 am

I second that suggestion. For a technique I want to implement I'll need to initialize the VertexBuffer with specific values before the rendering with RenderToVertexBuffer can start.
If I understood the API correctly that could be done with HardwareVertexBuffer->writeData() and I could get the HardwareVertexBuffer via mVertexData....
0 x

User avatar
Noman
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 714
Joined: Mon Jan 31, 2005 7:21 pm
Location: Israel
Contact:

Post by Noman » Sun Nov 16, 2008 10:55 pm

Hey

I implemented the feature. If you want to get the vertex data, you can call the getRenderOperation call and get the VertexData from there.

The actual buffer might change from update to update (it uses a double buffer mechanism) so make sure to call it after each update, and not just once in the beginning.

Also, access to the generated vertex buffer is not something that all R2VB implementations support. DX10 doesn't, for example. (R2VB hasn't been implemented with DX10's stream out yet, but when it will I don't know how this code will behave)
0 x

cloud
Gremlin
Posts: 196
Joined: Tue Aug 08, 2006 6:45 pm

Post by cloud » Mon Nov 17, 2008 12:11 pm

Thanks Norman. I don't know why I didn't see that :oops:
0 x

Post Reply