PDA

View Full Version : vertex array



Janani
11-22-2009, 11:14 PM
Hi,
I am tryiny to fill circle using quad with different intensity, intensity is changing but only half of the area is getting filled, i am considering only x and y value of vertices .

I am attaching my code with this if someone knows what mistake i am doing kindly reply

CODING:

float myalpha=0.0f;
float myintensity=0.0f;
float v3,v4,v5,v6;
float sweepvertexarray[5000],colorarray[5000];
int k,indices1;


for(float sweepang=6.28;sweepang>=0;sweepang=sweepang-0.0157)
{
v3=0.0f;
v4=0.0f;
v5=8*0.252*sin(sweepang);
v6=8*0.252*cos(sweepang);
sweepvertexarray[(k*4)+0]=v3;
sweepvertexarray[(k*4)+1]=v4;
sweepvertexarray[(k*4)+2]=v5;
sweepvertexarray[(k*4)+3]=v6;
colorarray[(k*4)+0]=0.0f;
colorarray[(k*4)+1]=myintensity;
colorarray[(k*4)+2]=0.0f;
colorarray[(k*4)+3]=myalpha;
myalpha=myalpha-0.0025;
myintensity=myintensity-0.0025;

indices1=k*4;
k++;

}




glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glVertexPointer(2, GL_FLOAT, 0,sweepvertexarray );
glColorPointer(4, GL_FLOAT, 0, colorarray);
glDrawArrays(GL_QUAD_STRIP,0,indices1);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

Thank You
Janani

Dark Photon
11-23-2009, 05:58 AM
I am tryiny to fill circle using quad with different intensity, intensity is changing but only half of the area is getting filled
Print out your colorarray values. You'll see negative values for green and alpha. This is an error. These should be in 0..1.