glVertexPointer
I think I read somewhere that the vertex array which you pass to the glVertexPointer function must be static, in means of can''t change their indiviual posititons, is that correct?
If so, is it then the only way to render dynamically objects(terrains in my case) using a for loop and make calls to glVertex*?
You can modify the contents of the array but you have call glVertexPointer on the array again after you changed it.
AFAIK with the standard way of glVertexPointer and glDrawArrays/glDrawElements the buffer does not need to be static as in "cannot change" (maybe they means the c++ static attribute?).
You can simply alter the values in the array (I presume you just have a float vBuffer[terrainWidth*terrainHeight] somewhere) and pass a glVertexPointer(...) to OpenGL each frame. That's what I used to do in my terrain renderer until I decided to use locked vertex buffers (i don't need dynamic terrain).
EDIT: hehe, Dark One beat me to it
Sander Maréchal
[Lone Wolves Game Development][RoboBlast][Articles][GD Emporium][Webdesign][E-mail]
GSACP: GameDev Society Against Crap Posting
To join: Put these lines in your signature and don't post crap!
[edited by - sander on July 7, 2003 5:41:02 PM]
You can simply alter the values in the array (I presume you just have a float vBuffer[terrainWidth*terrainHeight] somewhere) and pass a glVertexPointer(...) to OpenGL each frame. That's what I used to do in my terrain renderer until I decided to use locked vertex buffers (i don't need dynamic terrain).
EDIT: hehe, Dark One beat me to it
Sander Maréchal
[Lone Wolves Game Development][RoboBlast][Articles][GD Emporium][Webdesign][E-mail]
GSACP: GameDev Society Against Crap Posting
To join: Put these lines in your signature and don't post crap!
[edited by - sander on July 7, 2003 5:41:02 PM]
Above is right, however what you may be thinking of are Compiled Vertex Arrays, which generally should not change.
[edited by - Mulligan on July 8, 2003 1:25:32 PM]
[edited by - Mulligan on July 8, 2003 1:25:32 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement