Results 1 to 5 of 5

Thread: basic qt opengl problem

  1. #1
    Join Date
    Aug 2006
    Location
    Germany
    Posts
    33
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default basic qt opengl problem

    Hallo people,
    I have a array list of an object and I showing it in a screen and rotating.
    When I rotate it it goes wavery. some files work normaly.

    Qt Code:
    1. void GLWidget::paintGL()
    2. {
    3. glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
    4.  
    5. glPushMatrix();
    6.  
    7. glTranslatef(0.0, 0.0, -10.0);
    8. glRotatef(xRot/16, 1.0, 0.0, 0.0);
    9. glRotatef(yRot/16, 0.0, 1.0, 0.0);
    10. glRotatef(zRot/16, 0.0, 0.0, 1.0);
    11. glCallList(1); // call display list
    12. glPopMatrix();
    13.  
    14.  
    15. }
    16.  
    17.  
    18. void GLWidget::resizeGL(int width, int height)
    19. {
    20. GLfloat w = (float) width / (float) height;
    21. GLfloat h = 1.0;
    22.  
    23. glViewport( 0, 0, width, height );
    24. glMatrixMode(GL_PROJECTION);
    25. glLoadIdentity();
    26.  
    27. glFrustum(-w, w, -h, h, 5.0, 60.0);
    28.  
    29. //glOrtho(-1.5, +1.5, +1.5, -1.5, 4.0, 15.0);
    30. glMatrixMode(GL_MODELVIEW);
    31. glLoadIdentity();
    32. glTranslatef( 0.0, 0.0, -10.0 );
    33.  
    34. }
    To copy to clipboard, switch view to plain text mode 

    but for some objects its working fine.
    i dont know whats wrong in this.

  2. #2
    Join Date
    Aug 2006
    Location
    Germany
    Posts
    33
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: basic qt opengl problem

    Is there anything wrong with my question or something unclear.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: basic qt opengl problem

    Quote Originally Posted by kingslee View Post
    some files work normaly.
    Then maybe the problem lies in those other files?

  4. #4
    Join Date
    Aug 2006
    Location
    Germany
    Posts
    33
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: basic qt opengl problem

    Do you think the code can be used for any object array list?

    I thaught the problem with the glrotate part , as its rotating in a circle.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: basic qt opengl problem

    Quote Originally Posted by kingslee View Post
    Do you think the code can be used for any object array list?
    What do you mean by "object array list"?

    I don't see any problem why this code shouldn't work, provided that xRot, yRot and zRot variables have some normal values.

  6. The following user says thank you to jacek for this useful post:

    kingslee (12th November 2006)

Similar Threads

  1. Qt 4.2.0 OpenGL problem
    By mbjerkne in forum Qt Programming
    Replies: 1
    Last Post: 14th October 2006, 18:39
  2. Basic: problem building designer application
    By kingslee in forum Qt Tools
    Replies: 2
    Last Post: 31st August 2006, 15:26
  3. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.