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 2 of 2

Thread: Changing Lines to Quads?

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    26

    Changing Lines to Quads?

    I have a code to draw cube(frame wire). I want replace them with quads instead of lines.
    The following code draws the lines
    Code :
     static const HDint aLines[12][2] = 
        {
            { 0, 1 }, { 1, 3 }, { 3, 2 }, { 2, 0 },
            { 4, 5 }, { 5, 7 }, { 7, 6 }, { 6, 4 },
            { 0, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 }
        };
    glBegin(GL_LINES);
        for (i = 0; i < 12; i++)
        {
            glVertex3d((aLines[i][0] & (1 << 0)) ? minPt[0] : maxPt[0],
                       (aLines[i][0] & (1 << 1)) ? minPt[1] : maxPt[1],
                       (aLines[i][0] & (1 << 2)) ? minPt[2] : maxPt[2]);
     
            glVertex3d((aLines[i][1] & (1 << 0)) ? minPt[0] : maxPt[0],
                       (aLines[i][1] & (1 << 1)) ? minPt[1] : maxPt[1],
                       (aLines[i][1] & (1 << 2)) ? minPt[2] : maxPt[2]);
        }
        glEnd();

    The cube should have five faces.

  2. #2
    Junior Member Regular Contributor
    Join Date
    Jan 2011
    Location
    Paris, France
    Posts
    248
    You can use glLineWidth( GLfloat width) if you want lines with a thickness > 1
    (if what you think when you say "replace them with quads instead of lines" is lines with a thickness larger than one)

    Or you want to display a solid cube instead a wireframe cube ?
    (in this case, you can use glTranslatef()/glScalef() + glutSolidCube() for to handle this)

    PS : what is a cube with five faces ??? (a cube have normaly six faces)
    Last edited by The Little Body; 10-23-2013 at 03:50 PM.
    @+
    Yannoo

Posting Permissions

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