Results 1 to 3 of 3

Thread: polygon draw

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2011
    Posts
    9

    polygon draw

    Hello

    I want to draw a polygon that has a line color and a different fill color, which is the best way to do this?

    I was trying to use:
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
    to draw the polygon fill color and then call
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
    to draw its countour lines.

    When I do this, if i have two consecutive polygons drawn this way the render scene sometimes doesn't display the contour line between them...

    Thanks in advance

  2. #2
    Member Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    59

    Re: polygon draw

    Hello,

    I understand that sometimes you don't see the edge lines.
    Do you call glPolygonOffset before drawing lines ? glPolygonOffset enables to draw the lines in front of the polygon face.

    NB: I am a beginner. I am here to ask questions, not to contribute... Warning !

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2011
    Posts
    9

    Re: polygon draw

    Hi!

    Thank you. In fact I found the answer and it is related with what you said.

    I have to draw the polygons twice.

    First time to draw the inside color i call:


    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)

    Second time i need to call:

    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
    glEnable(GL_POLYGON_OFFSET_LINE)
    glPolygonOffset(-1, -1)

    This way it works just as i was expecting.


Similar Threads

  1. how to draw wireframe polygon
    By cjren in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-24-2010, 01:55 PM
  2. Draw polygon
    By Never in forum OpenGL: General
    Replies: 1
    Last Post: 03-20-2008, 09:37 AM
  3. Draw polygon
    By Never in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 03-18-2008, 08:00 PM
  4. Draw a rectangular polygon...
    By powervr in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 11-02-2004, 06:22 AM
  5. How to draw regular polygon?
    By in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 10-15-2003, 11:26 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