Page 1 of 1

IrrlichtQuickItem (Irrlcht + QtQuick/QML )

Posted: Fri Aug 10, 2018 7:30 pm
by savegame
Is it possible? i say YES =))
Image
part of sources here https://github.com/savegame/sailfish-ir ... _rendering
work its not done, now i have problem with Qt shader pipeline? when irrlicht render just One shader, its segfautl, becuse ut try render SOLID object with previosly lodaded by Qt shader for their QML object.. but when in scene more then one type of materials. its works normally with QML objects =)
Its works with QOpenGLFucntions (GLES2 Render), rendering Driver based on COGLES2Driver (its just copy-pasted with changes for Qt rendering). No context manger are created and used, Context/manager - its Qt. I test it on two desktop platforms, and it should work on any mobile platforms? where Qt work.
For use it in App, just need Create standart QtQuick template program (empty)? in main.cpp include irrlicht_folder/source/qt/IrrQuick.h and register QML type

Code: Select all

 
qmlRegisterType<IrrQuickItem>("ru.sashikknox",1,0,"IrrQuickItem");
 
then in main.qml use its

Code: Select all

 
import QtQuick 2.6
import QtQuick.Window 2.2
import ru.sashikknox 1.0
 
Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
    
    IrrQuickItem {
        id: irrItem
        anchors.fill: parent
 
        SequentialAnimation on t {
            NumberAnimation { to: 1; duration: 2500; easing.type: Easing.InQuad }
            NumberAnimation { to: 0; duration: 2500; easing.type: Easing.OutQuad }
            loops: Animation.Infinite
            running: true
        }
    }
    
    Rectangle {
        anchors {
            bottom: parent.bottom
            left: parent.left
            right: parent.right
            margins: 5
        }
        height: parent.height * 0.25
        color:  Qt.rgba(1,1,1,0.4)
        border.color: "black"
        border.width: 2
        radius: 10
        Text {
            text: "The Irrlciht render inside QML!!! That work on QOpenGLFunctions " +
                   "from Irricht-Qt driver (CQGLFunctionsDriver) and rendering with it. "
            anchors.fill: parent
            anchors.margins: 5
            font.pixelSize: 25
            wrapMode: Text.Wrap
        }
    }
}
 
also, that work inside QOpenGLWidget 8)

Re: IrrlichtQuickItem (Irrlcht + QtQuick)

Posted: Fri Aug 10, 2018 7:32 pm
by savegame
Next steps - i will try to compile all irrlicht examples inside QML. Then i try build it in all other platforms (iOS, Android, Sailfish ... any other platfrom, where Qt works fine)
Update: with few corrections, work on iOS

Re: IrrlichtQuickItem (Irrlcht + QtQuick/QML )

Posted: Sat Aug 11, 2018 10:52 am
by savegame
first example
Image

Re: IrrlichtQuickItem (Irrlcht + QtQuick/QML )

Posted: Sat Aug 11, 2018 4:57 pm
by mant
very nice!!!

Re: IrrlichtQuickItem (Irrlcht + QtQuick/QML )

Posted: Sat Aug 11, 2018 8:58 pm
by denzelbro
hi, can this run on windows? what do I need to install? I have Qt5 sdk

Re: IrrlichtQuickItem (Irrlcht + QtQuick/QML )

Posted: Sat Aug 11, 2018 10:01 pm
by savegame
yes, it should work on windows, but i dont test it... and it not finished yet, it always have different problems with rendering, some times it just crashes =)
for compile it on windows, you should get irrlicht from my repo (qt_rendering branch), then build it in QtCreator, then link it to your Qt QML program and use inside QML...
and add this to your *.pro file

Code: Select all

 
DEFINES += _IRR_COMPILE_WITH_QGLFUNCTIONS_
 
EDIT: Irrlciht engine you should build from irrlicht_lib_sfos.pro project file.

Re: IrrlichtQuickItem (Irrlcht + QtQuick/QML )

Posted: Sat Aug 11, 2018 10:09 pm
by savegame
i just updated QML file, where i load few irlicht's examples

Code: Select all

 
import QtQuick 2.6
import QtQuick.Controls 1.4
import QtQml.Models 2.1
import QtQuick.Window 2.2
import ru.sashikknox 1.0
 
Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
    
    IrrQuickItem {
        id: irrItem
        anchors.fill: parent
 
        SequentialAnimation on t {
            NumberAnimation { to: 1; duration: 2500; easing.type: Easing.InQuad }
            NumberAnimation { to: 0; duration: 2500; easing.type: Easing.OutQuad }
            loops: Animation.Infinite
            running: true
        }
    }
 
    ObjectModel {
        id: btn_model
        Button {
            id: example_1
            text: qsTr("1. Hello World")
            onClicked: {
                irrItem.loadExample(1);
            }
//            anchors.horizontalCenter: parent.horizontalCenter
        }
 
        Button {
            id: example_2
            text: qsTr("2. Quake 3 Map")
            onClicked: {
                irrItem.loadExample(2);
            }
//            anchors.horizontalCenter: listview.horizontalCenter
        }
 
        Button {
            id: example_11
            text: qsTr("11. Per Pixel Lighting")
            onClicked: {
                irrItem.loadExample(11);
            }
//            anchors.horizontalCenter: listview.horizontalCenter
        }
    }
 
    ListView {
        id: listview
        anchors.fill: parent
        model: btn_model
        spacing: 10
        anchors.margins: 10
    }
    
    Rectangle {
        anchors {
            bottom: parent.bottom
            left: parent.left
            right: parent.right
            margins: 5
        }
        color:  Qt.rgba(1,1,1,0.4)
        border.color: "black"
        border.width: 2
        radius: 10
        Text {
            id: textm
            text: "The Irrlciht render inside QML!!! That work on QOpenGLFunctions " +
                  "from Irricht driver (CQGLFunctionsDriver) and rendering with it. "
            anchors.fill: parent
            anchors.margins: 5
            font.pixelSize: 12
            wrapMode: Text.Wrap
        }
        height: Math.max(parent.height * 0.25, textm.contentHeight + anchors.margins * 2 )
    }
}
 
its work normally (almost) in desktop, but inside iOS it cant load Quake3Map example, always crashes =)
litle bit later i will try test it in android, sailfish os
ios
Image

Re: IrrlichtQuickItem (Irrlcht + QtQuick/QML )

Posted: Mon Aug 13, 2018 11:45 pm
by denzelbro
nice. so this is basically just Qt5 with QML for styling the UI/layout. I see a lot of Qt5 integrations here, even on Qt website, why create another?

Re: IrrlichtQuickItem (Irrlcht + QtQuick/QML )

Posted: Tue Aug 14, 2018 7:52 am
by savegame
denzelbro wrote:nice. so this is basically just Qt5 with QML for styling the UI/layout. I see a lot of Qt5 integrations here, even on Qt website, why create another?
Sorry, but i am dont found correct integration of Irrlicht inside Qt Widget or QML.. can you get me URL? If it integration with code like :

Code: Select all

 
 params.WindowId = reinterpret_cast<void*>(this->winId());
 
that is incorrect, it not work anywhere, its work in few desktop OS ,and not work in mobile platforms, or inside Wayland platforms... not work inside OSX
i try use Qt platform independence definitions of OpenGL , and it already work in all platforms where i test it... With QML i can make nice HiDPI scalable GUI with multitouch gestures in separate Thread, i can use Qt's multimedia for play sounds in my program, i can use many good features of Qt in any platform, where Qt already work )

Re: IrrlichtQuickItem (Irrlcht + QtQuick/QML )

Posted: Tue Aug 14, 2018 11:06 am
by denzelbro
savegame wrote:
denzelbro wrote:nice. so this is basically just Qt5 with QML for styling the UI/layout. I see a lot of Qt5 integrations here, even on Qt website, why create another?
Sorry, but i am dont found correct integration of Irrlicht inside Qt Widget or QML.. can you get me URL? If it integration with code like :

Code: Select all

 
 params.WindowId = reinterpret_cast<void*>(this->winId());
 
that is incorrect, it not work anywhere, its work in few desktop OS ,and not work in mobile platforms, or inside Wayland platforms... not work inside OSX
i try use Qt platform independence definitions of OpenGL , and it already work in all platforms where i test it... With QML i can make nice HiDPI scalable GUI with multitouch gestures in separate Thread, i can use Qt's multimedia for play sounds in my program, i can use many good features of Qt in any platform, where Qt already work )
Ah sorry, I missed some details there. So you changed or added a Qt driver to irrlicht? I would assume this will also run in web assembly? That is quite nice and really good integration! keep it up :!:

Re: IrrlichtQuickItem (Irrlcht + QtQuick/QML )

Posted: Wed Aug 15, 2018 8:44 am
by savegame
denzelbro wrote: I would assume this will also run in web assembly?
In Qt 5.10 and newer, it has WebGL implementation, and i think it will work inside WebGL as other QML applications.
i will try test it in web GL as soon as possible, thanks for that idea =)
Link to QtWebGL implementation

Re: IrrlichtQuickItem (Irrlcht + QtQuick/QML )

Posted: Tue Dec 18, 2018 10:05 am
by lyoo
it is possible to use this IrrlichtQuickItem on Android platform? irrlicht on android platform use native activity, and there is no way to get softkeyboard input text(Unicode String) by pure JNI method. unless use irrlicht GUI to write an input method based on native activity.(actually, I've already doing this, and It's not a wise way, though. )
so, can IrrlichtQuickItem works on Qt Android ?

Re: IrrlichtQuickItem (Irrlcht + QtQuick/QML )

Posted: Wed Feb 27, 2019 8:12 am
by savegame
lyoo wrote:it is possible to use this IrrlichtQuickItem on Android platform? irrlicht on android platform use native activity, and there is no way to get softkeyboard input text(Unicode String) by pure JNI method. unless use irrlicht GUI to write an input method based on native activity.(actually, I've already doing this, and It's not a wise way, though. )
so, can IrrlichtQuickItem works on Qt Android ?
Sorry for long time of response =)
Yes, it is possible, i test it inside Andoid, and it work on windows, linux, ios, SailfishOS, OSX... its work everywhere, just need rebuild with Qt for specific platform. But now i dont have time for continue work. maybe later )

Re: IrrlichtQuickItem (Irrlcht + QtQuick/QML )

Posted: Fri Mar 01, 2019 7:40 am
by savegame
Android:
Image
Image
Most hard thing, is load assests, i make few hack for irrlich FileSystem, now it can load resources from qrc files =) its not commitet now