Results 1 to 6 of 6

Thread: Texture in QGLWidget

  1. #1
    Join Date
    Jan 2006
    Posts
    26
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Texture in QGLWidget

    Hi, all

    In the scene, I make an image by using large size of data. And I need to do some other operations on the drawed image. Take drawing lines by move mouse for example. As anybody know, the image will be repainted when the mouse moving and this make the speed very slow!! I want to use texture to solve the proble. But the texture size is limited as 64,128 or 256. My image size can't be limited.

    1. How can I use texture but not limit?
    2. Or is there any other way to speed up?
    3. I use gluBuild2DMipmaps(), but the color of my drawed lines won't be correctly display. And why?

    Does anybody can help me, thanks in advance!!
    Last edited by showhand; 25th October 2006 at 10:51.
    There is no secret in the face of the code.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Texture in QGLWidget

    Quote Originally Posted by showhand View Post
    1. How can I use texture but not limit?
    Round your image up to the power of two - if you have a 1000x1000 image, use a 1024x1024 texture.
    2. Or is there any other way to speed up?
    It depends what causes the slowdown.

    3. I use gluBuild2DMipmaps(), but the color of my drawed lines won't be correctly display. And why?
    Could you elaborate on that? What do you mean by "correctly displayed"?

    BTW. This doesn't seem to be a Qt related issue.

  3. #3
    Join Date
    Jan 2006
    Posts
    26
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Texture in QGLWidget

    Thanks for your reply.

    The reason of drawing slowly is that my data size is very large. After making the image using these data, I need to do some other drawing operation. I want to draw lines by mouse(mouseMoveEvent) on the image. But you know, the image of large size of data should be always repainted, is it right? Both the image and lines use OpenGL commands.

    Is there any way to speed up? Thank you!!!
    There is no secret in the face of the code.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Texture in QGLWidget

    Quote Originally Posted by showhand View Post
    Is there any way to speed up? Thank you!!!
    Hard to say without seeing the code. Maybe you could optimise your GL code.

  5. #5
    Join Date
    Jan 2006
    Posts
    26
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Texture in QGLWidget

    The code are following:
    Qt Code:
    1. glWidget::glWidget (QWidget* parent):QGLWidget (parent)
    2. {
    3. //initialize some parametres
    4. }
    5.  
    6. glWidget::~glWidget ()
    7. {
    8. }
    9.  
    10. void makeImage ()
    11. {
    12. //draw the graphics according to given data, using OpenGL API
    13. }
    14.  
    15. void initializeGL()
    16. {
    17. }
    18.  
    19. void resizeGL(int width, int height)
    20. {
    21. }
    22.  
    23. void paintGL()
    24. {
    25. this->makeImage();
    26. }
    27. void mousePressEvent (QMouseEvent *e)
    28. {
    29. //get the start point of the line
    30. }
    31. void mouseMoveEvent (QMouseEvent *e)
    32. {
    33. //get the end point of the line
    34. updateGL(); //this will always call the func paintGL() and call makeImage(). Move event will make the paintGL() be called high frequency.
    35. }
    36. void drawLineTo (QPoint start, QPoint end )
    37. {
    38. //draw line to link the start point and the end point, using OpenGL API
    39. }
    To copy to clipboard, switch view to plain text mode 

    I only want to draw lines on the image which I make by large size of data. Mouse move event will make the paintGL() be called high frequency.
    Would you please give some advices (or code best) to solve my problem? Thanks for your reply!!!
    There is no secret in the face of the code.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Texture in QGLWidget

    What's inside "makeImage()"?

Similar Threads

  1. Textures + Multiple QGLWidgets
    By KShots in forum Qt Programming
    Replies: 8
    Last Post: 19th October 2007, 21:23
  2. QGLWidget on another QGLWiget
    By showhand in forum Qt Programming
    Replies: 1
    Last Post: 23rd October 2006, 09:59
  3. QGLWidget Problems
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 2nd October 2006, 22:06
  4. QGLWidget updateGL()
    By Lele in forum Qt Programming
    Replies: 7
    Last Post: 30th May 2006, 15:08

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.