Way to display a lot of cubes

Started by
4 comments, last by V-man 12 years, 6 months ago
Hi all :)

I have to display a lot of cubes as visualization of some mathematics computing (in worst case even more than 100 000).
It's real time visualization of computing so I want to display this as fast as possible.
It will be only solid color cubes.
What I have before display is array contains size of cube and location (3d coordinate of center).

I thought for maybe Vertex Buffer of Triangle strips. But if I want use CUDA for generating vertex coordinates (for parallel and fast it up) I will have problem with concatenation of strips (because if I want to insert degenerate triangles to separate cubes I will need to know vertex coordinates for both of cubes and for parallel I need to generate cubes strips separately).

What is your ideas to make it fast?
Advertisement

Hi all :)

I have to display a lot of cubes as visualization of some mathematics computing (in worst case even more than 100 000).
It's real time visualization of computing so I want to display this as fast as possible.
It will be only solid color cubes.
What I have before display is array contains size of cube and location (3d coordinate of center).

I thought for maybe Vertex Buffer of Triangle strips. But if I want use CUDA for generating vertex coordinates (for parallel and fast it up) I will have problem with concatenation of strips (because if I want to insert degenerate triangles to separate cubes I will need to know vertex coordinates for both of cubes and for parallel I need to generate cubes strips separately).

What is your ideas to make it fast?


instancing?
Could even use geometry shaders, I've done this before in my demo -> http://pouet.net/prod.php?which=57299

What you can do with geometry shaders, or at least how I implemented it in that demo is that I only have to send a GL Point to the GPU and it will generate cubes on that spot, means I only send 1/8th of the points to the GPU I normally have to send 8 to create a cube out of triangles. It's fully written in GSLS, what I do is use a triangle strip which I wrap around this point. Add some size variables etc, color and you'll have about what I used for the demo. In the demo I was able to draw about 450K more or less, depending on the culling.


More on the demo here http://www.nisute.co...gathering-2011/
If I've helped you in any way please push the reputation button, thanks!

Abstraction is my choice of words.
Portfolio: http://www.0x3a.com/
Blog: http://blog.0x3a.com/
[font=arial, verdana, tahoma, sans-serif][size=2]Wow, thanks for replying guys, I will look at this technologies :)

I have another question (maybe silly, but I'm not quite familiar with OpenGL. I rather create algorithms and use OpenGL to visualize results):
What will happen if I will push more data (floats) than graphic card have available ram? Will it make error or start to swap... or what? I think this situation may occur, because my computing use CUDA and it will take large part of graphics card memory.[/font]

[font="arial, verdana, tahoma, sans-serif"]Wow, thanks for replying guys, I will look at this technologies :)

I have another question (maybe silly, but I'm not quite familiar with OpenGL. I rather create algorithms and use OpenGL to visualize results):
What will happen if I will push more data (floats) than graphic card have available ram? Will it make error or start to swap... or what? I think this situation may occur, because my computing use CUDA and it will take large part of graphics card memory.[/font]


what will happen is let's say you have 1GB of video RAM and 4GB of system RAM, and you have 3GB of data. About 1GB of it will be on the video card, and 2GB on the system ram. However this is implementation (driver) dependent, so your driver might do it differently, say it stores all the data in the system RAM.
There is an app for that
http://www.opengl.org/wiki/FAQ#Memory_Management
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement