Archived

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

Austrian Coder

Manipulating a VA

Recommended Posts

Austrian Coder    122
Hi! I need infos, how i can manipulate the data of an existing Vertex Array. I would like to make a Particle System, which uses a Vertex Array. I konw, that VA are dynamic. Here a spezific situation: in VA gPartilceVertexArray is from position 125 to 546 the vertexes of the actuall rendered particles. Now some particles die and i should manipulate this array. But How? Thanks for your help, Christian

Share this post


Link to post
Share on other sites
zedzeek    528
with vertex arrays u dont have to draw all the indices unless u use
glDrawArrays( QUADS, 100, 500 ) which will draw them all from 100..500 in that order
using glDrawElements will let u put them in any order u wish ie u can use indices 100,105,200 etc + skip oyut the ones inbetween

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
Austrian Coder    122
I know how to draw elements in an VA. But how can i manipulate it?
Must i generate every time an new array and make it then to an va with glVertexPointer(3, GL_FLOAT, 0, g_PaticlesVertexArray);
or can i manipulate it directly? Like:
Particlesystem from index 547 - 2413 died so i must delete this indexes.

Share this post


Link to post
Share on other sites
zedzeek    528
>>Must i generate every time an new array<<

well u shouldnt generate it with (new) everytime but yes u create the indices everytime eg
int indices[1000];
for ( ind=0; ind indices[ind] = part_num[ind];

very very quick to do, u could also do thi when youre updating the part system eg

loop ( all particles )
{
is part alive
indices[partnum] = thisone;

etc
}

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

edited by ze: using i as an element index causes the forum software to parse an italic tag. Changed 'i' to 'ind'

[edited by - zealouselixir on October 20, 2002 4:57:40 PM]

Share this post


Link to post
Share on other sites