Hardware buffers & Terrain

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
iso
Halfling
Posts: 73
Joined: Fri Mar 18, 2005 11:43 am
Location: Slovakia

Hardware buffers & Terrain

Post by iso »

Hello again, I'm currently modifying the build-in terrain manager (EXTERIOR_CLOSE) for my project (screenshots soon). And now I've come to the point, where I need to implement modifying terrain.

What I've found out yet:
Each "tile" owns a small hardware buffer, that contains the geometry of that tile.
I've found the place, where the geographical information is fed to the buffer.
The buffer gets only deleted, when the app is closed.
The buffer is of course static.

What I want to do:
I have the new (modified) geometry and I want to dispose the old buffer content (and delete it out from the memory) and create a new (again static) buffer with new geometry.

Sooooo how to do that?
User avatar
Antiarc
Greenskin
Posts: 120
Joined: Thu Jan 23, 2003 8:40 am
Contact:

Post by Antiarc »

Well, the actual mechanics of doing it should be easy enough to observe from the existing code - you're just going to modify the simple renderable to take new data, and most of the work is done for you.

However, if you're going to be modifying the data, wouldn't a dynamic buffer be more beneficial than recreating static buffers?
iso
Halfling
Posts: 73
Joined: Fri Mar 18, 2005 11:43 am
Location: Slovakia

Post by iso »

Ok, so I can asume, that Ogre deletes unused buffer itself (a kind of garbage collection). Right???

So that I have just to create a new buffer and set the pointer to the new... Do I understand it right?

Well, updates to the terrain don't occure so often The scene is rendered ~60 fps and the updates happen at most once per second (when the user intensively modifies it). But The length of the game compared to the number of terrain changes... there are to few terrain changes to use dynamic buffers.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

All hardware buffers use shared pointers so that once the last reference to them goes out of scope, it gets destroyed.
iso
Halfling
Posts: 73
Joined: Fri Mar 18, 2005 11:43 am
Location: Slovakia

Post by iso »

Great thanx :-)
Post Reply