Results 1 to 2 of 2

Thread: vertex array

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2009
    Location
    India
    Posts
    15

    vertex array

    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

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,654

    Re: vertex array

    Quote Originally Posted by Janani
    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.

Similar Threads

  1. Generate Indices array from Vertex array
    By VirtualMan in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-28-2013, 02:51 AM
  2. a big vertex array or a ser of small vertex array?
    By lovemort in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 09-05-2013, 12:42 PM
  3. Vertex array with differ-normals of one vertex
    By Apollo in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-01-2009, 07:15 AM
  4. Why no per-vertex material specification in vertex array?
    By MelvinEng in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-09-2001, 03:20 AM
  5. Mixing Vertex Array Range & 'normal' vertex arrays
    By MarcusL in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 04-23-2001, 09:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean