I have some Haskell / OpenGLRaw code that does something like this:
verticesPtr <- newArray ...
glVertexPointer 3 gl_DOUBLE 0 verticesPtr
buffersPtr <- malloc
glGenBuffers 1 buffersPtr
buffer <- peek buffersPtr
glBindBuffer gl_ARRAY_BUFFER buffer
glBufferData gl_ARRAY_BUFFER 4 verticesPtr gl_STREAM_DRAW
glDrawArrays gl_LINE_STRIP 0 4
glDeleteBuffers 1 buffersPtr
I have two questions concerning this code:
- I am calling this from within the
draw
callback. Does this entirely negate the usefulness of storing my vertex data in the server? - If I should place this code outside
draw
, should I change thegl_STREAM_DRAW
command to something more static?