views:

577

answers:

2

Hello,

i'm working in Linux [GCC Compiler] , i'm using Eclipse with CDT + QT to compile I need to display sequence of DICOM images using QT window and OpenGL functions pls let me know which is the function to display sequence of images i'm using 3 functions 1) initiallizeGL() to initallize OpenGL functions. 2) resizeGL() instead of glutInitWindowSize() in Glut. 3) paintGL() instead of glutDisplayFunc() in Glut. 4) updateGL() instead of glutPostRedisplay() in Glut.

also pls let me know which are the Glut equivalent functions in QT glutMainLoop(); glutSwapBuffers(); glutInitDisplayMode(); glutIdleFunc(idle); glutInit(&argc, argv);

A: 

I'd say Qt already take care of gluSwapBuffers, glutInitDisplayMode and glutInit, so you dont need those. I am also not sure if your mapping of functions is correct, simply put, Qt and Glut think about GL in a different way so possibly you have to to the same (think in a different way) and Qt methods are pretty much self explanatory. I'd recommend download the code of KGLEngine or any other Qt +GL project to better understand how it works.

Jordi
+1  A: 

You should be able to easily display images by simply using QGLWidget as your painting device which - depending on your specific usecase - might simplify your implementation. This will draw the image using the OpenGL paint engine in Qt. Something like the following should allow you to display an image;

class CustomWidget : public QGLWidget
{ 
public:
    CustomWidget(QWidget* parent=0) : QGLWidget(parent), pix("foo.jpg")
    {

    }

protected:
    void paintEvent(QPaintEvent *pe)
    {
        QPainter p(this);
        // maybe update the pixmap
        p.drawPixmap(this->rect(),pix);
    }

private:
    QPixmap pix;
};

If you need to put it in a 3D scene, you probably need to load the image as a texture. Some of the Qt OpenGL demos should be able to give you a starting point, e.g. the 'Boxes' demo;

http://doc.trolltech.com/4.6-snapshot/demos-boxes.html

Henrik Hartz