使用Qt与DirectX? [英] Using Qt with DirectX?
问题描述
我的选项到底是什么?我有程序,我需要写在 OpenGL 和 DirectX ,而且我想对OpenGL使用 Qt ,而不必为我的任务的DirectX组件重新实现一半我的程序。
我看过Google,我发现有人抱怨< a href =http://en.wikipedia.org/wiki/Microsoft%5FDirect3D> Direct3D 是Qt的依赖,人们谈论以类似QGLWidget的方式实现QD3DWidget子类QWidget,但是没有人谈到如何实现它或任何例子。
我需要帮助。我想知道是否可能?我需要做什么才能使它工作?
- >创建一个QWidget
- >覆盖paintEngine()方法,不执行任何操作,只返回NULL
- >将HWND分配给widget-> winId()
#ifdef USE_QTGUI
QApplication a(argc,argv);
CD3DWidget wndw; wndw.show(); wndw.resize(1280,960);
hWnd = wndw.winId();
#else
hWnd = CreateAppWindow(name,300,300);
#endif
// CD3DWidget类只包含以下定义
CD3DWidget :: CD3DWidget(QWidget * parent):QWidget(parent){}
QPaintEngine * CD3DWidget :: paintEngine(){return NULL; }
感谢您,
p>
What exactly are my options? I have programs I need to write in OpenGL and DirectX, and I'd like to use Qt for OpenGL, and not have to re-implement half my program for the DirectX components of my task.
I've looked on Google and I have found references to people complaining about Direct3D being a dependency of Qt, and people talking about implementing QD3DWidget sub-classing QWidget in a similar fashion to QGLWidget, yet nobody talked about how to implement it or where any examples are.
I need help. I want to know if it is possible? What would I need to do to get it working? Has it been done before?
its pretty straightforward than I thought,
-> Create a QWidget
-> Override paintEngine() method, does nothing, just returns NULL
-> Assign HWND to widget->winId()
#ifdef USE_QTGUI
QApplication a(argc, argv);
CD3DWidget wndw; wndw.show(); wndw.resize(1280,960);
hWnd = wndw.winId();
#else
hWnd = CreateAppWindow(name,300,300);
#endif
//CD3DWidget class contains only the following definitions
CD3DWidget::CD3DWidget(QWidget * parent):QWidget(parent){ }
QPaintEngine *CD3DWidget::paintEngine (){ return NULL; }
Thanks,
CV
这篇关于使用Qt与DirectX?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!