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

Thread: newbie error (gluCylinder)

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    Orlando, FL, USA
    Posts
    1

    newbie error (gluCylinder)

    Hi,
    I am trying to draw a cylinder vertically oriented along the y axis, but all I see are two straight lines which could be the dges of the cylinder. I am using gluCylinder. Obviously there is a stupid mistake somewhere in my program. Could someone please point out to me, what I am doing wrong? I am posting part of the main routine along with the routines that create and draw the cylinder.

    Thanks,
    Balaji

    main() {

    glEnable (GL_DEPTH_TEST);
    glMatrixMode (GL_PROJECTION);
    glLoadIdentity ();
    glFrustum (-100.0, 100.0, -50.0, 50.0, 1.0, 100.0);
    glMatrixMode (GL_MODELVIEW);
    glLoadIdentity ();

    Createit();
    glLoadIdentity ();
    glTranslatef (0.0, 0.0, -10.0);

    while (1) {
    XNextEvent (dpy, &event);
    switch (event.type) {
    case ButtonPress:
    break;
    case Expose:
    Drawit(dpy, win, doubleBuffer);
    break;
    case ConfigureNotify:
    glViewport (0, 0, event.xconfigure.width,
    event.xconfigure.height);

    Drawit(dpy, win, doubleBuffer);
    break;
    }
    }

    void Drawit(dpy, win, doubleBuffer)
    Display *dpy;
    Window win;
    Bool doubleBuffer;
    {
    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glColor3f (0.8, 0.9, 0.9);
    glCallList (CylList);

    if (doubleBuffer)
    glXSwapBuffers (dpy, win);
    else
    glFlush();
    }


    void Createit()
    {
    GLUquadricObj *cyl;

    glNewList (CylList, GL_COMPILE);
    glPushMatrix ();
    glLoadIdentity ();
    glRotatef (90.0, -1.0, 0.0, 0.0);
    cyl = gluNewQuadric();
    gluQuadricDrawStyle (cyl, GLU_FILL);
    gluQuadricOrientation (cyl, GLU_OUTSIDE);
    gluQuadricNormals (cyl, GLU_NONE);
    gluQuadricCallback (cyl, GLU_ERROR, cylfunc);
    gluCylinder (cyl, 6,6, 50, 432, 600);
    glPopMatrix ();
    glEndList ();
    }

  2. #2
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    Osby, Sweden
    Posts
    15

    Re: newbie error (gluCylinder)

    Maybe i'm totally wrong but there is no glBegin anywhere in the code, i think u need it somewhere =)

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    France
    Posts
    880

    Re: newbie error (gluCylinder)

    No cOg, when you use gluCylinder, you do not use glBegin/glEnd (it's included in the gluCylinder function !).

    The only strange things I could notice are the lack of a gluDeleteQuadric(cyl) before the glEndList() and the lack of CylList=glGenLists(1) before using glNewList;

    I do not know if it will solve the problem but it's worth a try !

    Eric

Posting Permissions

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