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: What's wrong with this?

  1. #1
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    3

    What's wrong with this?

    Peace folks
    I tried to draw a simple polygon using these coordinates:
    glBegin(GL_POLYGON);
    glVertex3f(0.0f, 0.0f, 0.0f);
    glVertex3f(0.0f, -2.0f, 0.0f);
    glVertex3f(0.5f, -1.2f, 0.0f);
    glVertex3f(1.0f, -2.0f, 0.0f);
    glVertex3f(1.0f, 0.0f, 0.0f);
    glVertex3f(0.5f, -0.1f, 0.0f);
    glEnd();
    It is supposed to look like a X where the sides are flat. However, the code draws the top also flat. It connects the two upper vertices directly although it is not supposed to do that. What am I doing wrong and how do I fix it?

  2. #2
    Intern Contributor
    Join Date
    Jan 2001
    Location
    California
    Posts
    80

    Re: What's wrong with this?

    hehe
    dude the shape those coordinates are making in my mind look nothing like an X
    more like a mess
    hehe
    your not doing anything wrong i can see, just shift the vertices so you can get a reconizeable shape, then refine them to make the shape your desire.

  3. #3
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    3

    Re: What's wrong with this?

    Well, let me try to clarify the mess a little bit
    It is supposed to look like a rectangle whose top and bottom are concave. Hope this helps.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,757

    Re: What's wrong with this?

    The problem is that the shape you are trying to draw is concave, and GL_POLYGON can only be a convex polygon. You'll have to split it down the middle into two convex polygons.

    [This message has been edited by DFrey (edited 05-04-2001).]

  5. #5
    Junior Member Newbie
    Join Date
    May 2001
    Posts
    3

    Re: What's wrong with this?

    Many thanks for the hint DFrey.

Posting Permissions

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