Members - Reputation: 100
Posted 16 January 2012 - 01:51 AM
I have a quick question regarding the computational costs of different methods of rendering a large set of points. Consider, for example, that you were trying to deform a solid on a per-point basis. I can think of two options for managing the deformation:
1) render each point one at a time, pushing and popping a new matrix containing the necessary translation information for each individual, pre-allocated point, or
2) calculate the new point positions, generate values locally, and then resubmit the vertex data to the gpu.
Which of these methods would ultimately yield the best performance? My gut feeling is that the second method is more likely to be "correct" however I fear that resubmitting a large number of points regularly could be bad. Are there any other methods for manipulating vertex data efficiently?
Members - Reputation: 805
Posted 16 January 2012 - 04:34 AM
and general info
an open source GLU replacement library. Much more modern than GLU.
float matrix, inverse_matrix;
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Crossbones+ - Reputation: 2702
Posted 16 January 2012 - 05:01 AM
Members - Reputation: 923
Posted 17 January 2012 - 02:24 AM
Go with 2, but after updating make sure you stream the data into a VBO so that you aren't drawing 1 by 1. Do your updates and then send all the new positions once as one giant array of memory, and then draw it all at once (VBO). The exact implementation of his 3, would be to use some render to texture updates and keep all the updates and data strictly on the gpu by updating the points with texture that are calculated on the gpu with a couple textures.