Fastest way to draw dots in 3D
Im makin a program
(screenshot: http://home.online.no/~7396/delta/images/double.jpg )
..and well.. as you can c from the screenshot, I need to draw lots of dots in it. Currently the dots are small triangle pyramids. That is a problem because they take to much time to render. So my question is: does anyone know a way to render a ''dot'' in 3D space fast ? ..and it doesn''t matter how it looks; it only needs to be visable, and not to big. Thanks for any help
you could try having a single triangle facing the camera, maybe with a texture to make it a dot.
Thanks for the help, but how excactly does it work ?
does the glVertexPointer point to a set of coordinates ?
will this draw a point :
glDrawArrays(GL_POINTS, 0, 1 );
glVertex3f(0.0f, 0.0f, 0.0f);
?
PS, I''ve thought about using a single triangle facing the camera, but it still requires a lot of calculations compared to what a dot would require.
does the glVertexPointer point to a set of coordinates ?
will this draw a point :
glDrawArrays(GL_POINTS, 0, 1 );
glVertex3f(0.0f, 0.0f, 0.0f);
?
PS, I''ve thought about using a single triangle facing the camera, but it still requires a lot of calculations compared to what a dot would require.
In DX you only need:
D3DDevice.DrawIndexedPrimitive(D3DPT_POINTLIST, D3DFVF_VERTEX, m_pVertices[0], m_dwNumVertices, pIndices^, dwNumIndices, 0 );
where
m_pVertices: array of vertices
m_dwNumVertices: number of vertices
pIndices^: vertex indices
dwNumIndices: number of indices
D3DDevice.DrawIndexedPrimitive(D3DPT_POINTLIST, D3DFVF_VERTEX, m_pVertices[0], m_dwNumVertices, pIndices^, dwNumIndices, 0 );
where
m_pVertices: array of vertices
m_dwNumVertices: number of vertices
pIndices^: vertex indices
dwNumIndices: number of indices
glBegin(GL_POINT);
glVertex3f(x,y,z);
glEnd();
edit- that's not the fastest way, but that's how you do it. for speed try display lists for static stuff or vertex arrays for dynamic stuff.
How many Microsoft employees does it take to screw in a light bulb?
None, they just declare drakness as a new standard.
Edited by - Julio on August 3, 2001 11:09:50 AM
glVertex3f(x,y,z);
glEnd();
edit- that's not the fastest way, but that's how you do it. for speed try display lists for static stuff or vertex arrays for dynamic stuff.
How many Microsoft employees does it take to screw in a light bulb?
None, they just declare drakness as a new standard.
Edited by - Julio on August 3, 2001 11:09:50 AM
GLfloat verts[] = { {0,0,0}, {0,1,0}, {1,1,0}, {23,3,3} };
glEnableClientState( GL_VERTEX_ARRAY );
glVertexPointer( 3 , GL_FLOAT, 0, verts );
glDrawArrays( GL_POINTS, 0, 4 );
u dont want to draw to many elements in one hit eg if youre drawing 100,000 points use say 10 calls of 10,000 points or 20 calls of 5000 points.
glEnableClientState( GL_VERTEX_ARRAY );
glVertexPointer( 3 , GL_FLOAT, 0, verts );
glDrawArrays( GL_POINTS, 0, 4 );
u dont want to draw to many elements in one hit eg if youre drawing 100,000 points use say 10 calls of 10,000 points or 20 calls of 5000 points.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement