Results 1 to 3 of 3

Thread: Images

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Question Images

    I am trying to draw an image onto a QGLWidget. The image I am trying to draw is an arrow which I want to be able to click and move around on the screen. I have an image maker and made an arrow that is a size of 16x16 pixels. But when I try to render it onto the screen, all I get is a straight line. I have shown other bitmaps on the window, but they have rendered incorrectly. So I was wondering if there is a way to render this image by reading it in through a QImage? I have been making a glRasterPos2f( ) function call followed by a glBitmap( ) function call. I know the raster position is working since I have seen incorrect images where I wanted them to appear. And the glBitmap( ) function seems to be working in showing my image in the proper size but not drawing it correctly. So does anyone have any idea how I can take my image I created and display it onto my QGLWidget? I can use whatever image format is necessary but would prefer it be a BMP or PNG format. This image is just a 2-D image. Thanks for your help and let me know if you need any more clarification.

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

    Default Re: Images

    How did you render it on screen? Did you use OpenGL calls? I think you should use the image as a texture for a small square rendered in 2D ortho mode.

  3. #3
    Join Date
    Dec 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Images

    Quote Originally Posted by ToddAtWSU View Post
    I am trying to draw an image onto a QGLWidget. The image I am trying to draw is an arrow which I want to be able to click and move around on the screen. I have an image maker and made an arrow that is a size of 16x16 pixels. But when I try to render it onto the screen, all I get is a straight line. I have shown other bitmaps on the window, but they have rendered incorrectly. So I was wondering if there is a way to render this image by reading it in through a QImage? I have been making a glRasterPos2f( ) function call followed by a glBitmap( ) function call. I know the raster position is working since I have seen incorrect images where I wanted them to appear. And the glBitmap( ) function seems to be working in showing my image in the proper size but not drawing it correctly. So does anyone have any idea how I can take my image I created and display it onto my QGLWidget? I can use whatever image format is necessary but would prefer it be a BMP or PNG format. This image is just a 2-D image. Thanks for your help and let me know if you need any more clarification.
    I know that this was a long time ago but did you ever find a solution. I have been using glbitmap() to draw symbols in my QGLWidget with Qt 3.3 very successfully. The technique continued to work with Qt 4.4 but now with Qt 4.5 it is broken! I get some symbols drawn correctly but some instances have lines missing. Drawing a diamond always results in a vertical line!

    Any thoughts would be most welcome.

Similar Threads

  1. how to export images of Qt/Embedded on Device
    By mahe2310 in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 23rd March 2006, 12:05
  2. Question about thumbnailing different kinds of images
    By SkripT in forum Qt Programming
    Replies: 6
    Last Post: 18th March 2006, 13:05
  3. working with images
    By Kapil in forum Newbie
    Replies: 2
    Last Post: 9th March 2006, 11:59
  4. Images in QLabel
    By qball2k5 in forum Qt Programming
    Replies: 5
    Last Post: 6th March 2006, 21:28
  5. Problems working with 8bpp and 24bpp images
    By SkripT in forum Qt Programming
    Replies: 20
    Last Post: 17th February 2006, 13:07

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.