PDA

View Full Version : problem in using glcolorpointer in vertexarray



Janani
01-20-2010, 11:13 PM
Hi

I am using vertexarray to show some videodata ,
when i use glcolorpointer to show the color i am not getting proper color.

I am attaching code for reference.


float videovertexarray[5000000];
float videocolorarray[500000000];
int indexcolor=0;
int m1;
float vertices1,vertices2;
int vvertex=0;



for(int cpi=0;cpi<400;cpi++)
{
for(m1=0;m1<5000;m1++)
{
vertices1=(0.000252*m1)*sin(cpivalue*0.0157);
vertices2=(0.000252*m1)*cos(cpivalue*0.0157 );
videovertexarray[(vvertex*2)+0]=vertices1;
videovertexarray[(vvertex*2)+1]=vertices2;
videocolorarray[(indexcolor*4)+0]=0.0f;
videocolorarray[(indexcolor*4)+1]=1.0f;
videocolorarray[(indexcolor*4)+2]=0.0f;
videocolorarray[(indexcolor*4)+3]=0.0f;
indexcolor++;
vvertex++;
}
}

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_FLOAT,0,videocolorarray);
glVertexPointer(2, GL_FLOAT,0,videovertexarray);
glDrawArrays(GL_POINTS,0,vvertex);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisable(GL_BLEND);



When i run this code i am not getting green color, i am getting black color.

Thank you
Janani

_x57_
01-21-2010, 06:54 AM
I do not understand what you are trying to draw there... some sort of gigantic circular point cloud?

Maybe you should provide alpha = 1.0 for your colors, not 0.0 when you enable blending with that blendfunc...?

Dark Photon
01-21-2010, 07:30 AM
when i use glcolorpointer to show the color i am not getting proper color....

videocolorarray[(indexcolor*4)+0]=0.0f;
videocolorarray[(indexcolor*4)+1]=1.0f;
videocolorarray[(indexcolor*4)+2]=0.0f;
videocolorarray[(indexcolor*4)+3]=0.0f;
...
glColorPointer(4, GL_FLOAT,0,videocolorarray);
...

When i run this code i am not getting green color, i am getting black color.
glDisable( GL_LIGHTING ) ?

Janani
01-21-2010, 08:09 PM
I will be getting data which will give green intensity so i will be filling green color position dynamically with that value.

currently for reference i am filling it with 1.0, i have tried filling alpha value with 1.0 but i am not getting proper color


Thank You