Results 1 to 11 of 11

Thread: OpenGl 2d

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    122
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    16

    Default Re: OpenGl 2d

    Thanks for all your posts,
    things are more clear to me now, but I see there's no one specific way to use OpenGL for 2d.

    Glitch suggestions sound really good to me but checking the docs I couldn't find that much about it (see at the end of this post)

    If I got it right that means I can take advantage of OpenGl without using it directly, has someone already tried that?

    thanks again

    QPainter and QGLWidget
    It is now possible to open a QPainter on a QGLWidget as if it were a normal QWidget. One huge benefit from this is that we utilize the high performance of OpenGL for most drawing operations, such as transformations and pixmap drawing.

    Extensive Use of Native Graphics Operations
    In the Qt 4 Paint System we make more use of native graphics operations. The benefit we gain from this is that these operations can potentially be performed in hardware, giving significant speed improvements over many pure-software implementations.
    Among these are native transformations (Mac OS X and OpenGL), making painting with a world matrix much faster. Some pixmap operations have also been moved closer to the underlying hardware implementations.

  2. #2
    Join Date
    Jan 2006
    Posts
    19
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11
    Thanked 1 Time in 1 Post

    Thumbs up Re: OpenGl 2d

    Glitch suggestions sound really good to me but checking the docs I couldn't find that much about it (see at the end of this post)
    I couldn't agree more, we should alwasy provide the code.
    I attached my test KDevelop application. (I couldn't include the screenshot.png due to size limit by the forum policy!) so just take a screenshot of your desktop and save it in src folder.

    Note: if you are not using kdevelop, just go to /src then type qmake followed by make.
    Attached Files Attached Files
    Last edited by firas; 8th May 2006 at 17:40. Reason: providing code

  3. #3
    Join Date
    Jan 2006
    Posts
    122
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    16

    Default Re: OpenGl 2d

    Thanks for the sample code,
    I think that for having a good comparision with real system it would be necessary to load a different buffer everytime, I mean not from a file but from a sample buffer just like camera acquisition, so we could also check the memory transfer rate from RAM to the board.

    Anyway, I'm also looking at qpaintengine_opengl.cpp like Glitch suggested (Arthur painting system) and there the drawImage is implemented using textures and not glDrawPixels.

    In conclusion, Arthur painting system could be the solution for who wants to take advantage of using harware acceleration without learning OpenGL directly, unfortunately I can't find good examples for that and the documentations is not helpful.

  4. #4
    Join Date
    Jan 2006
    Posts
    19
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11
    Thanked 1 Time in 1 Post

    Default Re: OpenGl 2d

    Quote Originally Posted by Lele
    I'm trying to understand the best way to do such a 2d display,
    your use of glDrawPixels is interesting and very fast, and most of all doesn't need to have width and heigh power of 2.
    But unfortunately it seems to work differently than other OpenGL rendering, so it's not possible to zoom or resize like when using Texture.
    actually it is possible to use the zoom capability. check the QT documentation:

    void QGLWidget::resizeGL ( int width, int height ) [virtual protected]
    This virtual function is called whenever the widget has been resized. The new size is passed in width and height. Reimplement it in a subclass.
    There is no need to call makeCurrent() because this has already been done when this function is called.

    Quote Originally Posted by Lele
    So now I'm using
    gluBuild2DMipmaps( GL_TEXTURE_2D, 3, width, height,
    GL_RGB, GL_UNSIGNED_BYTE, data );

    and it's ok even because it automatically resize the width and heigh to be power of 2, but it's very slow if you do that at every frame
    re-implement resizeGL(newWidth,newHeight), and it should be ok.
    Quote Originally Posted by Lele
    So I just wanted to know if you're using drawpixel for showing a buffer without working on it (zoom, resize, overlays) or it was just a test.

    thanks
    there are different ways to do (zoom, resize, overlays), like some stuff could be easily done as QImage then you convert that to openGL and do some other stuff and so on..

    my inetntion of the test was to find the fastest way of rendering video frames (image sequences) after processing them, e.i. to find the fastest way of displaying the images.

Similar Threads

  1. OpenGL and Qt Question
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 18th April 2009, 18:04
  2. Qt Embedded + OpenGL problem
    By EeroS in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 7th October 2008, 14:32
  3. QT + OpenGL + Thread => aaaahhhhh !
    By anthibug in forum Qt Programming
    Replies: 7
    Last Post: 26th July 2008, 13:36
  4. Qtopia Core & OpenGL ES?
    By zelko in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 28th May 2007, 07:21
  5. OpenGL ES, Qt/11 - Qtopia Core?
    By zelko in forum Qt Programming
    Replies: 0
    Last Post: 3rd May 2007, 10:56

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
  •  
Qt is a trademark of The Qt Company.