Hello there, first of all I'm very new to Irrlicht engine and OpenGL, so if my question seens very basic, well, sorry, I did try a lot to find how to do it on the forum and google before posting this.
I'm trying to make a vertex buffer of GL_POINTS in Irrlicht but couldn't find anything about how to do it, actually I found the Tutorial 3 which use the drawVertexPrimitiveList to do it, the problem is that (correct me if I'm wrong) the vertex array will be sent to the GPU in every loop iteration, and the method uses S3DVertex to store the vertices, normals, uvs, etc.
What I really want is to just create a list of vertices of points, and only vertices, send it to the GPU with VBO and then manipulate it with Geometry Shader to create cubes.
Is there some way of achieve this with the engine? Ideally using SMeshBuffer or something similar if possible.
Thanks a lot!
How to draw GL_POINTS (EPT_POINTS?) ?
Re: How to draw GL_POINTS (EPT_POINTS?) ?
Ok, I found an code I did some months ago that shows exactly what I want to do:
So, as can be seen, I first fill m_points, which is a GLfloat array, with the points position (x, y, z), then I send it (and only it) to the GPU using glVertexPointer, finally I simply draw it..
I want to achieve something like this with irrlicht, sending just the same data (without normals, indices, etc).
If there is no way to do it, can I create a class which extends ISceneNode (I think this one would be the right class interface to extend), which will do the OpenGL calls directly internally? If this is a solution, does someone have an example ou some link as a start point?
Thanks!
Code: Select all
GLfloat* m_points;
// Fill array
for (int a = 0; a < m_size; ++a)
{
int gl_pos = a * 3;
int pos = a * 4;
*(m_points + gl_pos) = *(m_data + pos);
*(m_points + gl_pos + 1) = *(m_data + pos + 1);
*(m_points + gl_pos + 2) = *(m_data + pos + 2);
}
// Send data to GPU
glVertexPointer(3, GL_FLOAT, 0, &m_points[0]);
// Draw it!
glPushMatrix();
glDrawArrays(GL_POINTS, 0, m_size);
glPopMatrix();
I want to achieve something like this with irrlicht, sending just the same data (without normals, indices, etc).
If there is no way to do it, can I create a class which extends ISceneNode (I think this one would be the right class interface to extend), which will do the OpenGL calls directly internally? If this is a solution, does someone have an example ou some link as a start point?
Thanks!
Re: How to draw GL_POINTS (EPT_POINTS?) ?
In order to use VBO with non-triangles, I have a patch in the tracker. Though I only tested it with point sprites, not plain points.
Having normals, etc, doesn't sound like a big issue if you use a VBO, so that no transfer is made per frame.
Having normals, etc, doesn't sound like a big issue if you use a VBO, so that no transfer is made per frame.