PDA

View Full Version : How to use "bindTexture()" in QtQuick project



Abel
5th December 2014, 03:08
Hi,
I want to draw some rotating cubic in background of a qml program. I inherit a class from Object and export it to qml as "GLBG" and can call openGL function in animation slot, which just like the example of QT: "Scene Graph - OpenGL Under QML".
The problem is I do not know how to bind a picture as Texture. Other samples of Qt are using QGLwidget, and QGLwidget provide bindTexture() to create a Texture from a bitmap, but this fucntion can not be called in a QObject sub class. I hear that can not use QGlWidget in Qt Quick 2.0. How can I do?

anda_skoa
5th December 2014, 07:26
Isn't there glBindTexture()?

Cheers,
_

Abel
8th December 2014, 01:37
Yes,. but bindTexture() encapsulate better. If use glBindTexture, I need convert QImage to Texture data, how can I do? Is there any sample code to draw cubic with Texture in qml?

wysota
8th December 2014, 09:40
Either do the needed conversion manually (if needed) or if you can use QOpenGLTexture class.

Abel
9th December 2014, 01:49
Thank you, I will try.