Topic: Using Vertex Arrays
I've been having a play around with this particle system. I'm slowly getting somewhere, however it's currently crashing after a while. It seems to be possibly that it might be a buffer overrun or something. Just a few questions.
Firstly, is drawArray a synchronous call or does it get batched up? If that's the problem then that would potentially be the problem as I don't think the arrays I'm giving it are necessarily going to live that long. Secondly, there shouldn't be any theoretical maximum to the size of the array, should there? It's currently trying to draw 500 particles and complaining.
I think I'm going to have to do some serious rewriting on this particle system to get it to do anything sensible, "just for fun" I decided to render only 1 particle, but update 10,000 of them and the framerate dropped to a slideshow. Now, most particle systems shouldn't need that many particles, but potentially, over an entire scene, that's not an overly obscene amount.
Also, I'm not entirely sure if this is normal, but when I "GetParticlePointer" then it returns one giant array with all the information about the particle stored in it, with offsets to each of the different information within each particle. Much as this would be incredibly useful if the particle calculations are to be moved to the GPU, I think sending all of this in a giant array may be overkill for rendering.
cnt = m_Context.GetParticlePointer(ptr, flstride, pos3Ofs, posB3Ofs,
size3Ofs, vel3Ofs, velB3Ofs, color3Ofs, alpha1Ofs, age1Ofs,
up3Ofs, rvel3Ofs, upB3Ofs, mass1Ofs, data1Ofs);
if(cnt < 1) return;
render->enableColorArray();
render->setColorPointer(M_FLOAT, int(flstride) * sizeof(float), ptr + color3Ofs);
render->enableVertexArray();
render->setVertexPointer(M_FLOAT, int(flstride) * sizeof(float), ptr + pos3Ofs);
render->drawArray(M_PRIMITIVE_POINTS, 0, cnt);
render->disableVertexArray();
render->disableColorArray();
Is this correct or am I making a stupid mistake somewhere? I will try and look for answers myself too
Last edited by Nistur (2012-04-04 09:56:23)