Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: problem in glDrawArray

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    15

    problem in glDrawArray

    hi,
    code:

    glDisable(GL_TEXTURE_2D);
    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer( 3, GL_FLOAT, 0, createdVertices );
    glDrawArrays(GL_LINE_LOOP, 0,count);
    glDisableClientState(GL_VERTEX_ARRAY);

    i'm having an array of 40,00,000 vertices with start and end points.while displaying with gldrawarray some stranges line are present which i have not used to draw.i had checked my array values.everything is right.i had tried with small array at that time also its displaying some lines.





  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    513

    Re: problem in glDrawArray

    glDrawArrays(GL_LINE_LOOP, 0,count);

    i'm having an array of 40,00,000 vertices with start and end points.
    Those two statements seem contradictory. GL_LINE_LOOP will draw a single line through all the vertices given, while GL_LINES draws many lines, each from vertex i to i+1.
    Did you perhaps mean glDrawArrays(GL_LINES, 0, count) ?

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    15

    Re: problem in glDrawArray



    i have tried with small array but still some strange lines are present.i have tried with both GL_LINES and GL_LINE_LOOP but some lines r displaying.i have attached the picture with this

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    513

    Re: problem in glDrawArray

    Hm, I'm not sure I understand the problem without the picture (I don't see it here or a link to it) or a more detailed description of your inputs and the expected and actual output.

    Between which vertices are the additional lines?

    If your vertices are [v0, v1, v2, v3, v4, v5]

    you get with GL_LINES:
    line0 v0 to v1
    line1 v2 to v3
    line2 v4 to v5

    with GL_LINE_LOOP:
    line0 v0 to v1
    line1 v1 to v2 *
    line2 v2 to v3
    line3 v3 to v4 *
    line4 v4 to v5

  5. #5
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    15

    Re: problem in glDrawArray

    pic1:My exact output

    pic1



    pic2:Some lines are present which i have not drawn

    pic2




    i have attached my two outputs pic.jpg is exact output i have used with glBegin and glEnd.when used the glDrawArrays i'm getting some lines.

    My Code:

    glClear(GL_COLOR_BUFFER_BIT);
    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer( 3, GL_FLOAT, 0,createdVertices );
    glDrawArrays(GL_LINE_LOOP, 0,m_vertexNumber);
    glDisableClientState(GL_VERTEX_ARRAY);
    glFlush();

    My Array:
    4 5 0
    4 6.932 0
    4 6.932 0
    3.97036 6.93177 0
    3.97036 6.93177 0
    3.94074 6.93109 0
    3.94074 6.93109 0
    3.91112 6.92995 0
    3.91112 6.92995 0
    3.88153 6.92836 0
    3.88153 6.92836 0
    3.85196 6.92632 0
    3.85196 6.92632 0
    3.82243 6.92382 0
    3.82243 6.92382 0
    3.79294 6.92087 0
    3.79294 6.92087 0
    3.7635 6.91747 0
    3.7635 6.91747 0
    3.73412 6.91362 0
    3.73412 6.91362 0
    3.7048 6.90931 0
    3.7048 6.90931 0
    3.67554 6.90456 0
    3.67554 6.90456 0
    3.64637 6.89936 0
    3.64637 6.89936 0
    3.61727 6.89371 0
    3.61727 6.89371 0
    3.58827 6.88762 0
    3.58827 6.88762 0
    3.55936 6.88108 0
    3.55936 6.88108 0
    3.53056 6.8741 0
    3.53056 6.8741 0
    3.50187 6.86668 0
    3.50187 6.86668 0
    3.4733 6.85882 0
    3.4733 6.85882 0
    3.44484 6.85052 0
    3.44484 6.85052 0
    3.41652 6.84179 0
    3.41652 6.84179 0
    3.38834 6.83262 0
    3.38834 6.83262 0
    3.3603 6.82302 0
    3.3603 6.82302 0
    3.33241 6.813 0
    3.33241 6.813 0
    3.30468 6.80254 0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •