way of implementing

Hey guys

im trying to implement the Mandelbrot set using cuda , the convenional way of doing that is to implement the main core

which does what it has to do , and for each point in the set i should determine which color i should give it by number of iterations.

that’s all nice , but im trying to build a 3d model using polygons rather than simple pixels…

i’ve began exploring the VBO but something doesn’t make quite clear yet…

since im going to use GL_ARRAY_BUFFER which is going to each point’s X Y Z, Z- stands for number of iteraion by CUDA main kenrel function.

and for each point i should also save it’s color( RGBA ) - as you can see , if im working on 800*600 res the amount of points is huge :

8006003*4 → 3 stands for xyz and 4 stands for RGBA.

since preformence is CRITICAL my question is :

since the best way working with VBO arrays is by declacring a huge float,int array and registering it in the HOST and DEVICE + buffer etc…

or should i use classes and so on?

im asking it because of the following example i found over the net :

#pragma pack(push, 1)

struct SVertex

{

    GLubyte r;

    GLubyte g;

    GLubyte b;

    GLfloat x;

    GLfloat y;

};

#pragma pack(pop)

glBindBuffer(GL_ARRAY_BUFFER, BufferName);

glBufferData(GL_ARRAY_BUFFER, VertexSize, VertexData, GL_STREAM_DRAW);

glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(SVertex), BUFFER_OFFSET(ColorOffset));

glVertexPointer(2, GL_FLOAT, sizeof(SVertex), BUFFER_OFFSET(VertexOffset));

glEnableClientState(GL_VERTEX_ARRAY);

glEnableClientState(GL_COLOR_ARRAY);

glDrawArrays(GL_TRIANGLES, 0, VertexCount);

glDisableClientState(GL_COLOR_ARRAY);

glDisableClientState(GL_VERTEX_ARRAY);

as you can see here , i can declare on an array which contains both points and colors , i just need to setisfy the function with the correct offsets and so on

something which i cant do with classes for each point.

thanks all!!