Archived

This topic is now archived and is closed to further replies.

angry

glVertexPointer

Recommended Posts

angry    128
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*?

Share this post


Link to post
Share on other sites
Sander    1332
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]

Share this post


Link to post
Share on other sites
Mulligan    378
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]

Share this post


Link to post
Share on other sites