PDA

View Full Version : Glvertexpointer Buffer



Crownable
07-28-2012, 02:58 PM
Hai

Let's get straight to the point, the last arguement in glvertexpointer is the coord of the first vertex of the model
the coord is located in a buffer, how will i access that buffer and retrieve that coord?

V-man
07-28-2012, 07:15 PM
If you are using VBO, then you can map the buffer with glMapBuffer.
If you aren't using VBO, then call glGetPointerv :

float *pointer;
glGetPointerv(GL_VERTEX_ARRAY_POINTER, &pointer);
x=pointer[0];
y=pointer[1];
z=pointer[2];
etc.

mhagain
07-29-2012, 06:59 AM
If you want to read back from a VBO to system memory then you're going to incur substantial performance penalties due to pipeline stalls. Maybe you better say what it is that you're trying to accomplish as there will likely be much better options available.

Dark Photon
07-30-2012, 05:08 AM
how will i access that buffer and retrieve that coord?

On the GPU in a shader? Or on the CPU? Your question is a bit vague.

Also, do you have a particular version of OpenGL you're targetting? E.g. 4.2 core, 3.3 compatibility, 2.1, etc?