Qt and OpenGL ES



  • Hello.

    Im trying to achieve OpenGL ES support on my freescale i.mx51 evk.
    I have built the rootfs with ltib myself (based on the L2.6.31_10.07.11_ER_Source).
    Qt was compiled with touchscreeen support (works perfectly) and opengl es 2.0 support.

    But when i try to run the hellogl_es2 example found in the qt-dir, i receive this error;

    @root@freescale /usr/local/Trolltech/Qt-target-version/examples/opengl/hellogl_es2$ ./hellogl_es2 -qws
    mxc_ipu mxc_ipu: Channel already disabled 9
    mxc_ipu mxc_ipu: Channel already uninitialized 9
    QEglContext::defaultDisplay(): Cannot initialize EGL display: "Success (0x3000)"
    QGLContext::makeCurrent(): Cannot make invalid context current
    QGLContext::chooseContext(): The screen is not a QGLScreen
    QEglContext::chooseConfig(): Could not find a suitable EGL configuration
    Requested: "type=es2 rgba=1,1,1,0 surface-type=window"
    Available:@

    Huh? Success 0x3000 ?
    The program runs, but the QT-logo (or bubbles) are not displayed. (they should have)
    Only the frame and sliders are shown.

    Ive been googling this for a couple of hours now, so any ideas would be much appreciated.

    Thanks for your time!

    • andreas


  • hi.
    i want to compile qt with opengl es for arm linux
    i am always faile . could you give some advice about this .
    thank you . my email : spidermanma@126.com



  • I can try as best as i can.

    Can you specify what your problem really is? Can you compile qt? Or is it qt source code you are having problems with?

    Any output would also be very helpful.



  • Thanks you very much.
    I can compile qt and opengl/es singly . But I received a error when I configure the qt embedded with opengl es.
    The error is seem to be (I am not in computer ,so I can't post the all right now):

    You might need to modify the include and library search paths by editing
    QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in
    /home/spiderman/rebuitQT-for-GL/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-arm-g++.

    I export some data link about QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL . Then configure it , I still face the same problem.

    I will post all the errors and the output as fast as I can . Thank you for your time .



  • It would be really helpful if you post the last few lines before the error happened, in addition to the ./configure line used.

    I used to have this issue myself, but solved it for my setup.
    "http://developer.qt.nokia.com/forums/viewthread/879":http://developer.qt.nokia.com/forums/viewthread/879

    Maybe you can get some helpful hints there?



  • Hi.
    I come again.
    I just read the posts of "Need help compiling Qt for embedded device (i.mx51 evk)",and did as your steps. I set up mesa. Then I found that there is no EGL package in /usr/include/. But I found one named GL there . So I export nothing ,and did next step. But again ,I got the same error .

    What I have done.

    1. The configuration i used:
      ./configure -qt-sql-sqlite -xplatform qws/linux-arm-g++ -prefix /home/spiderman/rebuitQT-for-GL/builtQtLibs-with-Gl/ -webkit -qt-mouse-linuxtp -embedded arm -D__ARM_ARCH_5TEJ__ -opengl es2
    1. I received this error:
      The EGL functionality test failed!
      EGL is required for OpenGL ES to manage contexts & surfaces.
      You might need to modify the include and library search paths by editing
      QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in
      /home/spiderman/rebuitQT-for-GL/qt-everywhere-4.6.2/mkspecs/qws/linux-arm-g++.

    3.I checked the file qmake.conf:

    qmake configuration for building with arm-linux-g++

    include(../../common/g++.conf)
    include(../../common/linux.conf)
    include(../../common/qws.conf)

    modifications to g++.conf

    QMAKE_CC = arm-linux-gcc
    QMAKE_CXX = arm-linux-g++
    QMAKE_LINK = arm-linux-g++
    QMAKE_LINK_SHLIB = arm-linux-g++

    modifications to linux.conf

    QMAKE_AR = arm-linux-ar cqs
    QMAKE_OBJCOPY = arm-linux-objcopy
    QMAKE_STRIP = arm-linux-strip

    load(qt_config)

    4.Some datas excerpted from linux.conf included by qmake.conf:

    QMAKE_INCDIR =
    QMAKE_LIBDIR =
    QMAKE_INCDIR_X11 = /usr/X11R6/include
    QMAKE_LIBDIR_X11 = /usr/X11R6/lib
    QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS]
    QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS]
    QMAKE_INCDIR_OPENGL = /usr/X11R6/include
    QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib
    QMAKE_INCDIR_OPENGL_ES1 = $$QMAKE_INCDIR_OPENGL
    QMAKE_LIBDIR_OPENGL_ES1 = $$QMAKE_LIBDIR_OPENGL
    QMAKE_INCDIR_OPENGL_ES1CL = $$QMAKE_INCDIR_OPENGL
    QMAKE_LIBDIR_OPENGL_ES1CL = $$QMAKE_LIBDIR_OPENGL
    QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL
    QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL
    QMAKE_INCDIR_EGL =
    QMAKE_LIBDIR_EGL =
    QMAKE_INCDIR_OPENVG =
    QMAKE_LIBDIR_OPENVG =

    Shall I export some data like:
    export QMAKE_LIBS_EGL=/usr/lib/
    export QMAKE_INCDIR_EGL=/usr/include/GL
    export QMAKE_LIBDIR_EGL=-lEGL

    But I found there is a package of opengl'headers in /home/spiderman/rebuitQT-for-GL/qt-everywhere-4.6.2/include which named QtOpenGL already, and I found that the configuration of opengl es is empty. Can I edit the *.conf files ? Or, export something ...

    Thanks for your time.



  • Hello.

    There is no need to export variables, you just type the path in linux.conf/g++.conf like you have done.

    I assume that you are compiling ON a x86 computer, FOR an arm architecture?
    In that case you would have to point to the location of the arm version of the includes and libraries mentioned above. (and not to the x86 version of them stored in the /usr/include and /usr/lib directories)

    You can find the files on your computer with the command: locate egl.h (this is the header file for EGL)
    There are of course many other includes and libraries you'll need.

    Id start by looking for the include files, egl.h glext.h gl.h and the library files libegl13.so libgl.so etc.
    (i dont remember the exact filenames, but can post them later today)

    A.



  • Thanks for replie.
    I didn't find out the header with command"locate egl.h" on my computer.
    I also checked the packages in /usr/include and in /home/spiderman/rebuitQT-for-GL/qt-everywhere-4.6.2/include, there are no such header. Then I download a *.gz named tinygl(one of the opengl es). I check it out after decompression,but there is no egl.h either.
    where can I get such package and headers ? Is there something wrong with my mesa ?



  • Hmmm.

    These are the includes; (you will need most of these..)
    @
    ael@ael-laptop:/tftp/nfsshare/rootfs/usr/include$ ls -ls EGL
    total 44
    12 -rwxr-xr-x 1 root root 10027 2010-10-21 14:22 eglext.h
    4 -rwxr-xr-x 1 root root 1394 2010-10-21 14:22 eglfslext.h
    16 -rwxr-xr-x 1 root root 13285 2010-10-21 14:22 egl.h
    8 -rwxr-xr-x 1 root root 5175 2010-10-21 14:22 eglplatform.h
    4 -rwxr-xr-x 1 root root 3958 2010-10-21 14:22 eglplatformX.h
    ael@ael-laptop:/tftp/nfsshare/rootfs/usr/include$ ls -ls GLES
    total 92
    4 -rwxr-xr-x 1 root root 509 2010-10-21 14:22 egl.h
    8 -rwxr-xr-x 1 root root 7925 2010-10-21 14:22 gl_extensions.h
    40 -rwxr-xr-x 1 root root 37743 2010-10-21 14:22 glext.h
    36 -rwxr-xr-x 1 root root 35151 2010-10-21 14:22 gl.h
    4 -rwxr-xr-x 1 root root 1076 2010-10-21 14:22 glplatform.h
    ael@ael-laptop:/tftp/nfsshare/rootfs/usr/include$ ls -ls GLES2
    total 72
    12 -rwxr-xr-x 1 root root 8298 2010-10-21 14:22 gl2amdext.h
    24 -rwxr-xr-x 1 root root 22330 2010-10-21 14:22 gl2ext.h
    32 -rwxr-xr-x 1 root root 32549 2010-10-21 14:22 gl2.h
    4 -rwxr-xr-x 1 root root 1027 2010-10-21 14:22 gl2platform.h
    ael@ael-laptop:/tftp/nfsshare/rootfs/usr/include$ ls -ls KHR
    total 12
    12 -rwxr-xr-x 1 root root 9832 2010-10-21 14:22 khrplatform.h@

    and these are the libraries;

    @-rw-r--r-- 1 root root 13291114 2010-10-22 11:28 libgles20.so
    -rwxr-xr-x 1 root root 713474 2010-10-21 14:22 libGLESv1_CM.so
    -rwxr-xr-x 1 root root 13291114 2010-10-21 14:22 libGLESv2.so
    -rwxr-xr-x 1 root root 261229 2010-10-21 14:54 libegl13.so
    -rwxr-xr-x 1 root root 261229 2010-10-21 14:22 libEGL.so
    -rwxr-xr-x 1 root root 97846 2010-10-21 14:22 libgsl.so@

    i had some problems with the naming of these libs, so you can see (according to the size) that some are duplicates.

    OpenGL ES is maintained by "Khronos":http://www.khronos.org/opengles/
    You may need to compile them for arm yourself, if you do not find these libraries pre compiled (for your architecture).

    What hardware do you intend this to be used on? Maybe the manufacturer have some information?



  • Hi.
    Thank you very much .
    I want to compile this to s3c-arm6410 board . I have cross-compiled qt embedded and picogl(one of the tinygl wrote by somebody) successfully, and run the examples on board .
    So,I think it's ok to use this on the board. Maybe I should serch more infomations to make sure.



  • Hi.
    I have no idea about this . Whether I should get the headers one by one frome "Knronos ":http://www.khronos.org/registry/ and put them in packages then compile them or I just need to download a tar.gz which include all the headers and libs.

    And I have a puzzle . I can run the picogl(one of the opengl es) examples on the board already, why does the EGL must be included? Is EGL necessary ?

    I brought you too many troubles .Thanks for your time .



  • I you find a tar.gz with all headers and libs included thats good. As the error msg say; EGL is required for OpenGL ES to manage contexts & surfaces.

    Apart from that, i have no idea.
    I can always send you the files i have here, which are compiled for ARM.

    I did some searching for EGL for linux, and found this package;
    "libegl1-mesa-dev":http://packages.debian.org/experimental/libegl1-mesa-dev

    Similiar for GLES, GLES2.
    "libgles1-mesa-dev":http://packages.debian.org/experimental/libgles1-mesa-dev
    "libgles2-mesa-dev":http://packages.debian.org/experimental/libgles2-mesa-dev

    These contain both headers and libraries.
    You probably need other packages as well, but these may possibly solve the problem at hand.

    • almagest


  • Thank you so much .
    But I got this error now:
    g++ -Wl,-O1 -o opengles1 opengles1.o -L/usr/lib -L/usr/lib/dri -lGLES_CM
    /usr/bin/ld: cannot find -lGLES_CM

    I think there is something wrong with my qmake.conf. How can I solve it ?

    -s



  • This means that you have to locate where libGLES_CM.so is at. (locate libGLES)

    In my case, i just made a copy of the file with a slightly differing name.

    In the libgles1-mesa-dev package, i see that there exist a file named;
    /usr/lib/libGLESv1_CM.so

    make a copy of this file named libGLES_CM.so, then give it a go.

    • almagest


  • Hi. almagest.
    I am sorry to bother you again. But I am totally crashed . I have tried so many ways and always failed.
    I don't know how to compile mesa with arm-linux-gcc the tool I used. And the sources from "gl1-mesa-dev":http://packages.debian.org/experimental/libegl1-mesa-dev was built by gcc can't be used with qt embedded. So, I must compile mesa with arm-linux-gcc , or any other way to compile
    opengl es with qt embedded ?



  • Hi.
    Thanks for your help so much .
    I have made some progress.
    I cross compiled several libs for my platform included the libs you listed, but when I cross compile qt embedded with these libs , I got those errors:
    /home/spidermanma/opengl-lib/lib/libEGL.so: undefined reference to dlclose@@GLIBC_2.4' /home/spidermanma/opengl-lib/lib/libEGL.so: undefined reference todlopen@@GLIBC_2.4'
    /home/spidermanma/opengl-lib/lib/libEGL.so: undefined reference to dlerror@@GLIBC_2.4' /home/spidermanma/opengl-lib/lib/libEGL.so: undefined reference todlsym@@GLIBC_2.4'
    collect2: ld returned 1 exit status
    make: *** [egl4gles1] error 1
    EGL (GLES/egl.h) disabled

    I'll be very glad to get any advice .
    -s



  • I really dont understand this, i was under the impression that you could download "[libegl1-mesa-dev]":http://packages.debian.org/experimental/armel/libegl1-mesa-dev for the arm system, and point qmake to the folders where you save those files.

    Don't mix these files with the ones present in the /usr/include and /usr/lib directories though.

    My guess would be that either the egl.h or libEGL.so is wrong in your situation.
    You are certain that your crosscompiler is set up correctly? (since you state that you compile the libs yourself?)

    A.



  • Thank you so much sincerely ,you help me a lot.
    The errors are still there, I was totally wrong . I had compiled mesa by gcc, not arm-linux-gcc, and it absolutely didn't work .
    I had downloaded the libs you showed to me "here":http://packages.debian.org/experimental/armel/libegl1-mesa-dev before and had put them into /usr/lib already . So ,I think that the errors I posted are bugs of the libEGL.so .
    Now , I have no idea about this. I am really crashed this time. I have compiled this evil qt more than two weeks.
    You know ,I am a newbie. I think I must do more research about this(compile qt embedded and opengl) first , and then work on it .

    Hmmm....Thank you again, almagest.

    -s



  • No fear. Im relatively new to this myself, but like you, i was a bit hasty at one point, and ended up reinstalling my whole os as a cleanup. Then proceeded to do every step with alot of caution.

    Keep me/us/the world updated on how things are proceeding.

    One of the main problems with qt and embedded technology, as far as i see it, is that people do not post their experiences on the web. Sure, some people are very good at it, but more info makes it easier for people like you and me.

    Keep up the good work!
    A.



  • Hi.
    I don't know what to say,you are really a good guider and kind heart friend.
    You know what,you cheer me up. And fortunately, I have made a little progress:

    I have rebuilt mesa7.5 by arm-linux-g++ ,thought I haven't completely succeeded,
    I got several libs ,such as libEGL.so, etc . So, I copied them and put into the package with other libs which I have download before from "here":http://packages.debian.org/experimental/armel/libegl1-mesa-dev . Then , I configure qt embedded with these libs like this:

    ./configure -embedded arm -xplatform qws/linux-arm-g++ --prefix=/home/mx/qte/built -opengl es1 -nomake demos -no-libtiff -no-gif -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-tds -no-dbus -no-cups -no-dbus -no-cups -no-qt3support -no-phonon -no-pch -no-openssl -no-nis -no-scripttools -no-script -no-javascript-jit -no-stl -qt-mouse-linuxtp -fast -little-endian -no-separate-debug-info -depths 8,16 -L/home/spidermanma/opengl-lib/lib -I/home/spidermanma/opengl-lib/include -v

    But there is still a error :

    /usr/local/arm/4.3.1-eabi-armv6/usr/bin-ccache/../lib/gcc/arm-samsung-linux-gnueabi/4.3.1/../../../../arm-samsung-linux-gnueabi/bin/ld: warning: libX11.so.6, needed by /home/spidermanma/opengl-lib/lib/libEGL.so, not found (try using -rpath or -rpath-link)
    /home/spidermanma/opengl-lib/lib/libEGL.so: undefined reference to `XOpenDisplay'
    collect2: ld returned 1 exit status
    make: *** [egl4gles1] error 1
    EGL (GLES/egl.h) disabled

    As far as I know , XOpenDisplay is a important function. Why doesn't such a important function undefined in libEGL.so ? Do I miss some files ,or is there something wrong with my header egl.h ?



  • First of all, is it intended that you use X11 as a window manager on the device? I choose to not use it, since Qt would take care of all my needs in that sense. - Just a thought.

    In any case, by looking at the output you printed;
    ... warning: libX11.so.6, needed by /home/spidermanma/opengl-lib/lib/libEGL.so, not found ...
    probably implies that the library containing the XOpenDisplay (X11) needs the corresponding library libX11.so.6 to work properly. Look for the library, and make sure it is reachable by the compiler.



  • Yes,you are right.I found X11 libs and put them into the right package . Eventually , I configure qt embedded successfully . It's a long time I have worked on it, this is a big step for me . Thanks to your help, I make it .
    I will run command 'make' tomorrow , because there are some other libs(such as tslib, etc.) should be added into qt libs .
    But , if X11 is not necessary as you mentioned , how can I remove it and configure it without errors ? Can I configure qt embedded without X11 ?



  • Hi, almagest.
    I have built qt with opengl es . But I got a error again, when I run opengl examples.
    The error :

    libEGL debug: dlopen(/mnt/nfs/builtQte2/lib/egl/egl_glx.so)
    libEGL warning: GLX: XOpenDisplay failed
    libEGL debug: EGL user error 0x3001 (other) in eglInitialize

    QEglContext::defaultDisplay(): Cannot initialize EGL display: "Not initialized (0x3001)"

    I compiled X11 before , since I didn't know that it is not necessary . But what can I use as a driver for libEGL without X11 ? What can I do with this error , if I use X11 ? I am so glad to get any idea from you.

    -s



  • Im really sorry that i cannot help you with this problem, i really dont know the answers to this. My best advice would be to spend quite some time googling this spesific problem though. Maybe somebody else have some ideas?



  • Thank you very much all the same . Maybe this is something special with my platform .

    -s



  • Have you tried to run a opengles2 example that does not use qt?
    Then you can prove that at least some parts are working as they should.

    I have an example written in c++ that i used to show a rotating triangle. Like you, i have problems running opengles2 within the qt environment.



  • Hi
    I am sorry to reply so late , because of my classes and homework .

    I have run opengles examples on my platform and it's good . I have read a article "here":http://labs.qt.nokia.com/2010/08/05/hitching-qtembedded-to-a-framebuffer-opengl-es-2-abstraction/ . It seems that every kind of platform has its own EGL driver as QScreen management . Just like WSEGL for powervr . So , I think we have the same problem that we don't have the right EGL driver .

    This is what I think . I don't know whether it is right or not . How can get the right driver or any other solution to me , if I am right ? What cause this error , if I am wrong ?

    -s



  • Hi,
    I got similar error as below,

    @QEgl::display(): Cannot initialize EGL display: "Not initialized (0x3001)"
    QEglContext::chooseConfig(): Could not find a suitable EGL configuration
    Requested: "type=es2 rgba=8,8,8,0 surface-type=window"
    Available: @

    Have you solved your problem?



  • DreamerIndia, please don't double (or triple-post) your problem.
    Generally, if you want help, state as much information as possible regarding your system, compiler, goals .. etc.

    You posted the same question in different threads recently, please do not hijack threads like this. (it also makes searching harder, since you get hits on tons of identical questions..)

    Your identical threads;
    http://qt-project.org/forums/viewthread/35307/
    http://qt-project.org/forums/viewthread/35392/

    Maybe you should try to run some GLES application that does not require Qt or EGL first?



  • Hi almagest,

    have you had any luck with the original problem?. I'm working with a iMX53 QSB, compiled everything to run Qt with OpenGL following this "post":https://community.freescale.com/thread/230065 and had exactly the same result as you:

    @hellogl_es2$ ./hellogl_es2 -qws
    QEgl::display(): Cannot initialize EGL display: "Not initialized (0x3001)"
    QEglContext::chooseConfig(): Could not find a suitable EGL configuration
    Requested: "type=es2 rgba=5,6,5,0 surface-type=window"
    Available:@

    Could you resolve this problem? I had googled a lot, also in Qt forums an iMX community with no luck.

    My compiled version of Qt without OpenGL works perfect.

    Thanks in advance!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.