zed
06-01-2004, 08:43 PM
--not an important question--
is updating uniforms quite slow?
*this example animates a field of grass thus each 'mesh' contains only a few vertices, but theres thousands of meshes.
currently im doing the vertex deformation calculations myself
eg
for ( int i=0; i<10000; i++ )
[
..
glVertex3fv( vert0 + vertice_offset.. )
..
]now im thinking this is something a vertexshader would be ideal at so i do something like
int loc = glGetUniformLocationARB( the_shader, "friemel_origin" );
for ( int i=0; i<10000; i++ )
[
.....
glUniform3fvARB( loc, 1, origin );
....
....
glVertex3fv( vert0 )
..
]but its a lot(~3x) slower, from testing it seems to be the glUniform3fvARB(..) function that is causing the slowdown.
is updating a uniform really so slow?
ie u dont want to update them if the object contains only a few vertices (though its a different story though if an object contains thousands of vertices)
is updating uniforms quite slow?
*this example animates a field of grass thus each 'mesh' contains only a few vertices, but theres thousands of meshes.
currently im doing the vertex deformation calculations myself
eg
for ( int i=0; i<10000; i++ )
[
..
glVertex3fv( vert0 + vertice_offset.. )
..
]now im thinking this is something a vertexshader would be ideal at so i do something like
int loc = glGetUniformLocationARB( the_shader, "friemel_origin" );
for ( int i=0; i<10000; i++ )
[
.....
glUniform3fvARB( loc, 1, origin );
....
....
glVertex3fv( vert0 )
..
]but its a lot(~3x) slower, from testing it seems to be the glUniform3fvARB(..) function that is causing the slowdown.
is updating a uniform really so slow?
ie u dont want to update them if the object contains only a few vertices (though its a different story though if an object contains thousands of vertices)