PDA

View Full Version : Images



ToddAtWSU
5th July 2006, 23:24
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.

wysota
18th July 2006, 13:14
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.

GeoffT2
15th December 2009, 16:22
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.