Thread: OpenGL Question...simple (triangle drawing stuff)

  1. #1
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427

    OpenGL Question...simple (triangle drawing stuff)

    Why won't this display the front face of the triangle with lines.


    Code:
    
    		glBegin(GL_TRIANGLES);
    		glPolygonMode(GL_FRONT, GL_LINE);
    		glVertex3f(-1.0f, -1.0f, -5.1f);
    		glVertex3f( 0.0f, 1.0f, -5.1f);
    		glVertex3f( 1.0f, -1.0f, -5.1f);
    		glEnd();
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  2. #2
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    I dropped that in place of the triangle create lines in one of my programs, and it drew a triangle just fine.

  3. #3
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    With just the lines? Not filled......I mean draw a triangle with lines.....not filled....Thanks btw


    See I want the triangle to drawn ( at least the front part ) using not lines, not filled, I thought this was the function used to do this.

    glPolygonMode(GL_FRONT, GL_LINE);

    but it doesn't seem to work.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  4. #4
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    The default is to fill the region with color. To change the way polygons are drawn, you would use:

    void glPolygonMode(GLenum face, GLenum mode);

    The only thing i can think is that the mode is set to fill (default) still and is over-riding the command to draw in lines. I have never used the above method before, so you will have to look it up.

  5. #5
    Registered User SAMSAM's Avatar
    Join Date
    Nov 2001
    Posts
    218
    your front is actually your back.

    it is actualy showing(logical back ) which is your front.

    draw it counter clockwise and it will be ok.

  6. #6
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    you can't call glPolygonMode() in-between glBegin() and glEnd(). call it before.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  7. #7
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    EDIT, got it work people, apparently you have to call glEnable (GL_LINE_SMOOTH) for some reason.


    Thanks no one it's working now.....hey people I am also having problems with this.......it won't smooth out the lines.


    Code:
    
    		glPolygonMode(GL_BACK, GL_LINE);
    		
    		glBegin(GL_TRIANGLES);
    		glEnable(GL_POLYGON_SMOOTH);	
    		glVertex3f(-1.0f, -1.0f, -5.1f);
    		glVertex3f( 0.0f, 1.0f, -5.1f);
    		glVertex3f( 1.0f, -1.0f, -5.1f);
    		glEnd();

    The book says something about lines of with (1.0) but I don't really understand what it's refering to.
    Last edited by incognito; 03-15-2003 at 07:55 PM.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  8. #8
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    glEnable() should not be called inbetween glBegin() and glEnd()

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Opengl question
    By Shadowwoelf in forum Windows Programming
    Replies: 3
    Last Post: 06-03-2007, 01:21 PM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  3. Simple Ddraw question. Display bitmap on a screen.
    By tegwin in forum Game Programming
    Replies: 0
    Last Post: 05-22-2004, 05:50 PM
  4. OpenGL question
    By Malek in forum Windows Programming
    Replies: 1
    Last Post: 09-10-2001, 12:00 PM