what is the fastes way to generate geoemtry?

I have to (re)generate geometry every frame. What is fastest way? Right now i am using vertex rewriters. But maybe there is a fastest way like accessing the memory of data directly?

If you’re generating this geometry in Python, then it becomes a Python question: what’s the fastest way in Python to generate a table of numeric data? And to answer that question precisely requires knowing all sorts of details about your source data and processing requirements.

In C++, the vertex rewriter is a fine way to generate data; it’s tuned for performance. It’s the same mechanism used internally in Panda, for instance by the animation subsystem.

David

Yeah i am doing this from c++ so i guess i will stick rewriter. Actually its a lib for python with high level draw calls, but ultimately heavy drawing is in c++.

As the process goes some thing like this (i just want to make sure)

1: modify-data
panda3d uploads the vertexes to gpu
gpu draw vertexes
goto 1

does panda3d upload the entire vertex object or can it do just parts?
for data that is static its some thing like this right?

load-data
panda3d uploads the vertexes to gpu
1: gpu draws the vertexes
goto 1

What happens if there is not enough gpu memory to upload to?

Is it ok to keep rewriters between frames. Like create once use forever?

Right, that’s the basic process.

If you have your data separated into several different arrays, then Panda can upload only the array(s) that have changed. For instance, if you are modifying vertex position only, then you can put color, texture coordinate, and normal in a separate array, and Panda will need to re-upload only the array that contains the vertex position. (This optimization works in OpenGL only. In DirectX, the entire array must always be sent.)

There’s no way to upload only a subset of rows. All rows are always re-uploaded if any of them change. You can split the vertex data into several different, smaller, vertex data objects if this is an issue. Of course, then it can’t be rendered in a single graphics call.

If there is not enough GPU memory, in OpenGL it is up to the graphics driver to evict something else to make room for it; in DirectX, this is handled by Panda. In either case, you don’t have to worry too much about it yourself. (And in practice, usually the vertex buffers are tiny compared to the textures.)

It is not OK to keep rewriters between frames. You should always create them as you need them. They are fast to create, though.

David