I recently started to visualize my cuda simulations using openGL libraries.
I know there is something called VBO that helps plot vertex arrays, but there are too many function calls like buffer generate, register/unregister, bind/unbind, map/unmap, which seems no sense to me. And most of all, it copies the vertex arrays to some extra buffers, which is time and memory wasting.
However, I found another concept of VAR (vertex array range) which point directly to the array i want to plot, say, the coordinates of the particles array dCoor (dCoor is on graphical cards memory). So there is no need to call buffer generate, register/unregister, bind/unbind, map/unmap functions. And my display function is simply as follow:
glClearColor(1.0, 1.0, 1.0, 1.0);
glVertexPointer(4, GL_FLOAT, 0, &dCoor);
glColorPointer(4, GL_FLOAT, 0, &dCoor);
glDrawArrays(GL_POINTS, 0, nnn); // nnn=1000, I have 1000 particles in a cube
glFlush(); // just displaying one frame, not animation
I pointed color array to dCoor just for the sake of convenient. But the particles are not plotted on the screen. I am sure everything else are set correctly because when I simply plot a square there, it shows up. And I am sure the coordinates of the particles are located in the camera. I am not sure do I misunderstand the concept of VAR or not. Anyone expert at openGL with CUDA can give me a hint?