Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: auxSolidCylinder & glutSolidCylinder woes

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    17

    auxSolidCylinder & glutSolidCylinder woes

    Here, I am plotting a series of shapes, and I am having problems glut and aux SolidCylinders. If I use Spheres I am OK, but I don't want to use them. When I use cylinders, I only get 1 cylinder instead of multiple cylinders.

    glPushMatrix();
    glTranslated(x[i],y[i],z[i]);
    glutSolidSphere(.006f, 10, 10);
    //auxSolidCylinder(.006f,.25f);//why not ?
    glPopMatrix();

    Why is it that I only get 1 cylinder but multiple spheres, and what am I doing wrong?

    thank you,

    SpaceGhost

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: auxSolidCylinder & glutSolidCylinder woes

    You have to call the sphere routine each time you want to draw a new one.

    Also are you drawing them all in the same place?

    Now about a little bit more code?

    Originally posted by SpaceGhost:
    Here, I am plotting a series of shapes, and I am having problems glut and aux SolidCylinders. If I use Spheres I am OK, but I don't want to use them. When I use cylinders, I only get 1 cylinder instead of multiple cylinders.

    glPushMatrix();
    glTranslated(x[i],y[i],z[i]);
    glutSolidSphere(.006f, 10, 10);
    //auxSolidCylinder(.006f,.25f);//why not ?
    glPopMatrix();

    Why is it that I only get 1 cylinder but multiple spheres, and what am I doing wrong?

    thank you,

    SpaceGhost

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    17

    Re: auxSolidCylinder & glutSolidCylinder woes

    Uh no, I am translating to draw each shape in a diff place. My results are just fine with the Sphere, and I get what I am expecting. When I use the Cylinder I get the wrong results.

    -SG
    Here is my source:

    int CDialogGLDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (CDialog::OnCreate(lpCreateStruct) == -1)
    return -1;

    HWND hWnd = GetSafeHwnd();
    HDC hDC = ::GetDC(hWnd);

    if(SetWindowPixelFormat(hDC)==FALSE)
    return 0;

    if(CreateViewGLContext(hDC)==FALSE)
    return 0;

    COLORREF color = ::GetSysColor(COLOR_3DFACE);
    glClearColor((float)GetRValue(color)/255.0f,
    (float)GetGValue(color)/255.0f,
    (float)GetBValue(color)/255.0f,
    1.0);

    glPolygonMode(GL_FRONT,GL_FILL);
    glPolygonMode(GL_BACK,GL_FILL);

    // Gouraud
    glShadeModel(GL_SMOOTH);

    BuildList();

    SetTimer(0,10,NULL);
    return 0;
    }
    void CDialogGLDlg::BuildList()
    {
    imax = nInputFileCoord_ctr;//these coords are read when dialog is opened
    ::glNewList(1,GL_COMPILE_AND_EXECUTE);
    glColor3f(0.0f,0.5f,0.5f);
    for (int i = 0; i< imax;i++)
    {
    glPushMatrix();
    glTranslated(x[i],y[i],z[i]);
    glutSolidSphere(.006f, 10, 10);
    //auxSolidCylinder(.006f,.25f);//why not ?
    glPopMatrix();
    }
    ::glEndList();
    }

    void CDialogGLDlg::RenderScene()
    {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glPushMatrix();

    // Position / translation (mouse rotation)
    glTranslated(0.0,0.0,-8.0);
    glRotated(m_xRotate, 1.0, 0.0, 0.0);
    glRotated(m_yRotate, 0.0, 1.0, 0.0);
    glScalef(m_ScaleX,m_ScaleY,m_ScaleZ);

    // Only one list, the box
    ::glCallList(1);

    glPopMatrix();
    }

    void CDialogGLDlg::OnPaint()
    {
    if (IsIconic())
    {
    //here typical MFC code for this case
    }
    else
    {
    CPaintDC dc(this); // device context for painting
    RenderScene();
    SwapBuffers(dc.m_ps.hdc);
    CDialog::OnPaint();

    }
    }

  4. #4
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    17

    Re: auxSolidCylinder & glutSolidCylinder woes

    The timer just changes x and y rotation/member variables.
    -SG

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    17

    Re: auxSolidCylinder & glutSolidCylinder woes

    Anybody know the answer to this question?

    I have complied and supplied the necessary source code as requested.

    What is so diff about glutSolidCylinder() and glutSolidSphere()???

    -SG

  6. #6
    Senior Member Frequent Contributor
    Join Date
    Jan 2003
    Location
    Virginia
    Posts
    586

    Re: auxSolidCylinder & glutSolidCylinder woes

    Are you using glutSolidCylinder or auxSolidCylinder? I found all kinds of web sites with glutSolidCylinder and yet I have no definitions in my glut headers or libs. If you do have them in yours, please let me know where I can get a newer version of glut as I just downloaded the latest (to the best of my knowledge) from Nate Robbin's site.

    Anyway, I have no clue. Seems extremely odd that it doesn't work properly, but my only advice would be to use gluCylinder instead of aux. Always prefer anything else over GLaux. It is outdated and unsupported and probably the reason why it doesn't work properly if it does with the glut spheres and all the rest of the code unchanged. My opinion at least.

  7. #7
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    17

    Re: auxSolidCylinder & glutSolidCylinder woes

    Yes Shin, I too came to that conclusion after a visit ironically to the Microsoft site. Last I heard though, they were getting ready to claim OpenGL as deprecated.
    article entitled:

    Is Microsoft poised to open a brawl on the graphics front?
    http://www.directx.com/home.htm


    PS here is my new code.

    glTranslated(x[i],y[i],z[i]);
    double diff = 0;
    if (fabs(z[i]) > fabs(z[i-1]))
    diff = fabs(z[i]) - fabs(z[i-1]);
    else
    diff = fabs(z[i-1]) - fabs(z[i-1]);
    GLUquadricObj* qobj1 = gluNewQuadric( );
    gluCylinder(
    qobj1,
    .006,
    .006,
    diff,
    10,
    10 );
    gluDeleteQuadric(qobj1);

  8. #8
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    17

    Re: auxSolidCylinder & glutSolidCylinder woes

    and thank you everybody for your replies.
    -SG

  9. #9
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: auxSolidCylinder & glutSolidCylinder woes

    I have worried about openGL when SGI sold some of its 3D IP to MicroSoft.
    (SGI is the founder of OpenGL)
    Since they could use it to kill, openSource ports of openGL, like what is used for Linux.

    I bet when SGI sold the IP to them, they covered their butt's to keep use withing there systems, but maybe not outside.

    Now also there has been talk of Microsoft making some type of OpenGL class to work within Direct-X, so that OpenGL call would be made directly through direct X.

    On the cylinder, unlike sphere where the axis is at the center, on the cylinder object the axis is defaulted at the starting end of the cylinder.

    Originally posted by SpaceGhost:
    Yes Shin, I too came to that conclusion after a visit ironically to the Microsoft site. Last I heard though, they were getting ready to claim OpenGL as deprecated.
    article entitled:

    Is Microsoft poised to open a brawl on the graphics front?
    http://www.directx.com/home.htm


    PS here is my new code.

    glTranslated(x[i],y[i],z[i]);
    double diff = 0;
    if (fabs(z[i]) > fabs(z[i-1]))
    diff = fabs(z[i]) - fabs(z[i-1]);
    else
    diff = fabs(z[i-1]) - fabs(z[i-1]);
    GLUquadricObj* qobj1 = gluNewQuadric( );
    gluCylinder(
    qobj1,
    .006,
    .006,
    diff,
    10,
    10 );
    gluDeleteQuadric(qobj1);


  10. #10
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    17

    Re: auxSolidCylinder & glutSolidCylinder woes

    If it is any consolation, I got my version of glut from Nate Robbin's site 'glut for win32' as well.

    -SG

    Originally posted by shinpaughp:
    [B]Are you using glutSolidCylinder or auxSolidCylinder? I found all kinds of web sites with glutSolidCylinder and yet I have no definitions in my glut headers or libs. If you do have them in yours, please let me know where I can get a newer version of glut as I just downloaded the latest (to the best of my knowledge) from Nate Robbin's site.
    [B]

Page 1 of 2 12 LastLast

Similar Threads

  1. glutSolidCylinder
    By Panayiotis in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 12-20-2007, 01:28 PM
  2. GLSL woes
    By PigeonRat in forum OpenGL: GLSL
    Replies: 2
    Last Post: 08-28-2004, 08:16 PM
  3. Compiling woes, help please :-(
    By Andrew Davey in forum OpenGL: Linux
    Replies: 2
    Last Post: 05-24-2004, 02:10 PM
  4. Bezier Woes
    By agentsim in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-14-2003, 09:48 PM
  5. Transparency woes
    By architekt in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 01-14-2002, 07:22 PM

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