B4A Library OpenGL 2.0 library

Discussion in 'Additional libraries, classes and official updates' started by agraham, May 20, 2011.

  1. GDO

    GDO Member Licensed User

    Hello,

    I don't know what is wrong but gl.Version always return 1.2 and all functions needed by opengl es 2 (1.5 , I suppose) are logged like that :

    called unimplemented OpenGL ES API

    My AVD is 4.1 and android.jar is from android-17

    What can I do ?
     
  2. agraham

    agraham Expert Licensed User

    The Version property is the library version number and not the OpenGL version. The next version will be 1.3.

    What functions give that error and what is the exact error message?
     
  3. GDO

    GDO Member Licensed User

    Many ...

    gl.glGenBuffers
    gl.glBindBuffer
    gl.glBufferDataF

    and all the functions with shader (glCreateShader, glShaderSource, etc ...)
     
  4. GDO

    GDO Member Licensed User

    In the documention there is GL1 :

    Events:
    Click
    LongClick
    Draw(gl As GL1) 'The view wants to be drawn using the supplied GL10
    SurfaceChanged(gl As GL1, width As Int, height As Int) 'Called when the surface has changed size.
    SurfaceCreated(gl As GL1) 'Called when the surface is created or recreated.

    Is it an error in the documentation or in the code?
     
  5. agraham

    agraham Expert Licensed User

    Are you using the emulator or a real device? Apparently the emulator doesn't support OpenGL and give that error.
     
  6. GDO

    GDO Member Licensed User

    Emulator AND real device (Galaxy Note Version 4.0.4)
     
  7. agraham

    agraham Expert Licensed User

    If you mean "gl As GL1" then it is a documentation error. It should be "gl As GL2".
     
  8. agraham

    agraham Expert Licensed User

    You can try putting this in your manifest that should check at runtime if OpenGL 2 is present.
    Can your post your project (File -> Export as Zip) and I will see if I can see anything in the logs when it fails. However if some of the functions succeed but others fail I presently have no idea what the problem could be.
     
  9. GDO

    GDO Member Licensed User

    Hi,
    I had already changed the manifest and it was not ok with the emulator.
    I tried with the real device and it is not ok.

    I changed my program (little program) to add more log("...") and now it is clear that the only functions that are OK are defined inside your libraries opengl 2 AND opengl 1.

    The functions that are only defined in the opengl 2 library are not working.

    I think the EGL_CONTEXT is not initialized for opengl 2 but for opengl 1 but I don't know why.

    Thanks

    Log :


    ** Activity (main) Create, isFirst = true **
    ** Activity (main) Resume **
    mCBPickerDialog enter case. MSG_DISMISS_DIALOG
    Hide Clipboard dialog at Starting input: finished by someone else... !
    mCBPickerDialog enter case. MSG_DISMISS_DIALOG
    id=290 Removed main idx=4 Map Size=5
    id=291(2) createSurface 0x32944 (800x1280),1 flag=0, main
    id=290 Removed main idx=-2 Map Size=6
    id=292(3) createSurface 0x44efc (800x1134),1 flag=0, SurfaceView
    loaded /system/lib/egl/libEGL_mali.so
    loaded /system/lib/egl/libGLESv1_CM_mali.so
    loaded /system/lib/egl/libGLESv2_mali.so
    Device driver API match
    Device driver API version: 10
    User space API version: 10
    mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Fri May 4 10:32:42 KST 2012
    Displayed shortComponentName: +310ms
    Hide Clipboard dialog at Starting input: finished by someone else... !
    mCBPickerDialog enter case. MSG_DISMISS_DIALOG


    Created

    Create Triangle
    glGenBuffers
    glBindBuffer
    glBufferDataF
    glBindBuffer


    Shader

    glCreateProgram
    called unimplemented OpenGL ES API

    glCreateShader
    called unimplemented OpenGL ES API

    glShaderSource
    called unimplemented OpenGL ES API

    glCompileShader
    called unimplemented OpenGL ES API

    glCompileShader
    called unimplemented OpenGL ES API

    glAttachShader
    called unimplemented OpenGL ES API

    glBindAttribLocation
    called unimplemented OpenGL ES API

    glLinkProgram
    called unimplemented OpenGL ES API

    Changed
    Clear

    UseProgram
    called unimplemented OpenGL ES API

    BindBuffer

    VertexAttribPointer
    called unimplemented OpenGL ES API

    EnableVertexAttribArray
    called unimplemented OpenGL ES API

    VertexAttrib3f
    called unimplemented OpenGL ES API

    DrawArrays

    DisableVertexAttribArray
    called unimplemented OpenGL ES API

    BindBuffer

    UseProgram
    called unimplemented OpenGL ES API
     
  10. GDO

    GDO Member Licensed User

    I read that opengl 2 is now supported with emulator but of course I will only test with a real device.

    Thank you for your help.
     
  11. agraham

    agraham Expert Licensed User

    Are you using GLSurfaceView2.Initialize or GLSurfaceView2.Initialize2. If using GLSurfaceView2.Initialize2 then try GLSurfaceView2.Initialize instead.
     
  12. GDO

    GDO Member Licensed User

    Hello,
    Yes I used GLSurfaceView2.Initialize2 (I use your demo and try to add the display of a triangle).

    Now, with GLSurfaceView2.Initialize, all the errors disappeared but I can not see my triangle (on a real device).

    I don't know, for now, what I have to change in my code to make it work with Initialize.

    What I needed was RGBA_8888 and a 16 bits depth buffer (Initialize2 was perfect).

    I'll be back ...

    ;-)

    Once again, thank you for your help.
     
  13. agraham

    agraham Expert Licensed User

    I missed setting GLSurfaceView.setEGLContextClientVersion(2) in Initialize2 which is why I suggested trying Initialize which does have it. I'll post an update with Initialize2 corrected tomorrow as it's getting a bit late here now (17:30) and it's my turn to cook dinner tonight. :(
     
  14. GDO

    GDO Member Licensed User

    OK

    Good luck !
     
  15. agraham

    agraham Expert Licensed User

    Version 1.3 now posted has some new Initialize methods to let you control the configuration better.

    Initialize3 uses the default settings for OpenGL2

    The following partial initializers can be used sequentially in place of Initialize, Initialize2 or Initialize3 to create a custom initialisation.

    InitializeGL - must be called and called first to set up OpenGL 2
    InitializeConfig - if called should be called second to initialise the EGLConfigChooser
    InitializeHolder - if called should be called third to initialise the pixel format
    InitializeRender - must be called and called last to set up the Renderer
     
  16. GDO

    GDO Member Licensed User

    Hi,

    glsv.Initialize2(glsv.RENDERMODE_WHEN_DIRTY, "glsv", 16, 0)
    or
    glsv.Initialize3(glsv.RENDERMODE_WHEN_DIRTY, "glsv")
    seems OK

    but
    glsv..InitializeGL2("glsv")
    glsv.InitializeConfig(8, 8, 8, 8, 16, 0)
    glsv..InitializeHolder(glsv.PixelFormat.RGBA_8888)
    glsv.InitializeRender(glsv.RENDERMODE_WHEN_DIRTY)
    are KO

    InitializeGL not defined (I suppose it's InitializeGL2)
    InitializeHolder not defined
     
  17. agraham

    agraham Expert Licensed User

    Sorry :( I changed the name but the original one stuck in my mind when I wrote that post. I also made a stupid oversight in the code that I have now fixed. Download version 1.3 again and it should work. Notice that you need the int value of PixelFormat that you can get from the link in the help.
    Code:
    glsv.InitializeGL2("glsv")
    glsv.InitializeConfig(
    8888160)
    glsv.InitializeFormat(
    1' 1 is the int value of PixelFormat.RGBA_8888
    glsv.InitializeRender(glsv.RENDERMODE_WHEN_DIRTY)
     
  18. GDO

    GDO Member Licensed User

    Hi,
    Now,everything looks fine in your library.
    But my triangle display is not OK.
    I am looking what's wrong in my code...
    Thanks
     
  19. agraham

    agraham Expert Licensed User

    :sign0060: I got it drawing a gray frame and capturing and displaying it.
     

    Attached Files:

  20. GDO

    GDO Member Licensed User

    Hello,

    It was a log way to go but I can now see my triangle !

    Thank you for your help.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice