B4A Library OpenGL 2.0 library

Android 2.2 and later support OpenGL 2.0 ES as well as OpenGL 1.0 ES. Having produced an OpenGL library for 1.0 I thought I may as well do one for 2.0 as well so here it is!

The included "demo" is not really a demo at all and does little more than test the device OpenGL capability and initialise a drawing surface. It needs someone more interested in graphics than I to take it further.

Note that the demo needs my Threading library.

EDIT:- Version 1.1 posted. See post #12 for details.

EDIT:- Version 1.2 posted. See post #16 for details.

EDIT:- Version 1.3 posted. See post #35 for details.

EDIT:- Version 1.4 posted. See post #61 for details.

EDIT:- Version 1.5 posted. See post #83 for details.
User @walterf25 has added two methods to the the library to create version 1.5. The new jar and xml are posted below in OpenGL2_v1.5_lib.zip. I have left version 1.4 as the zip for that contains a somewhat trivial demo program. Just use the new v1.5 libs and ignore the v1.4 ones.
 

Attachments

  • OpenGL2_1.4.zip
    43.7 KB · Views: 1,579
  • OpenGL2_v1.5_lib.zip
    38.2 KB · Views: 746
Last edited:

walterf25

Expert
Licensed User
Longtime User
Hi @agraham, first off thank you very much for wrapping this library, i am currently wrapping at AR library and it requires the use of the GLSurfaceView View, i had no idea that you had wrapped this library before I started wrapping my AR library, i had already wrapped some of the Opengles2.0 classes when I realized there was already this library in the forums, i was able to get some of the AR examples to compile and run just fine with B4A, i am now trying to finish wrapping some of the last classes of this AR library before releasing it to the forums, however i was wondering if you would be willing to add some more functions to your library.

I noticed that you have GLBufferDataF and GLBufferDataI for floats and integers, however I need to also have a GLBufferDataB which would take an array of bytes and another maybe GLBufferDataS which would take an array of shorts, as this library i am wrapping requires this two methods, everything else seems to have already been wrapped in your library.

Please let me know if that would be possible I realize you may be very busy as i have been this last few months wrapping this library as well.

Thanks in advanced.
Walter
 

agraham

Expert
Licensed User
Longtime User
It's nearly six years since I last looked at this and returned to desktop development only so I've forgotten almost everything about it. However here's the Eclipse project for the library, perhaps that will be of some use.
 

Attachments

  • OpenGL2.zip
    42.2 KB · Views: 341

walterf25

Expert
Licensed User
Longtime User
It's nearly six years since I last looked at this and returned to desktop development only so I've forgotten almost everything about it. However here's the Eclipse project for the library, perhaps that will be of some use.
Thanks @agraham I added the functions I needed, i have increased the version to 1.5, would you mind uploading it and edit your first post, i got my AR library working, i'm ready to upload a beta version of it, there's still something to iron out but for the most part it works as expected.

Here's the updated version.
I added the following function
B4X:
    public void glBufferData(int target, int size, Buffer buffer, int type) {
        GLES20.glBufferData(target, size, buffer, type);
    }
and this one as well
B4X:
    public void glDrawElements2(int mode, int count, int type, int offset) {
        GLES20.glDrawElements(mode, count, type, offset);
    }
On my AR library wrapper there was a need for the glBufferData function but needed to pass a Buffer type.
For the glDrawElements function i needed to pass the mode parameter, count param, type param and offset param.

Anyhow, thank you very much for wrapping this library, it definitely saved me some time as I didn't have to wrap this library.

Walter
 

Attachments

  • OpenGL2_v1.5.zip
    42.4 KB · Views: 310

agraham

Expert
Licensed User
Longtime User
i have increased the version to 1.5, would you mind uploading it and edit your first post
I'd be glad to but you seem to have posted just the Eclipse project. There's no jar or xml file and no B4A demo project :(. Perhaps you could take my OpenGL2_1.4.zip and replace the jar and xml with yours.
 
Last edited:

walterf25

Expert
Licensed User
Longtime User
I'd be glad to but you seem to have posted just the Eclipse project. There's no jar or xml file and no B4A demo project :(. Perhaps you could take my OpenGL2_1.4.zip and replace the jar and xml with yours.
Hi abraham, I figured you would want to do a quick review of the source code and compile the jar and xml files yourself since you are the author of this lib, but no worries I will upload them in a bit so you can edit the first post and update the files.

I have uploaded an example apk file in the new libraries thread

Walter
 

walterf25

Expert
Licensed User
Longtime User
I'm not set up to do so any more without a lot of setup so if it works for you I'm happy to post it!
Here ya go, Thanks again, if you'd like if there's any other changes that may be required in the future i can just create a separate thread and name it something like Updated OpenGL2.0 library that way i don't have to bother you to update your post every time.

Here is the updated lib files version 1.5

Walter
 

Attachments

  • OpenGL2_v1.5.zip
    38.2 KB · Views: 336

Informatix

Expert
Licensed User
Longtime User
Here ya go, Thanks again, if you'd like if there's any other changes that may be required in the future i can just create a separate thread and name it something like Updated OpenGL2.0 library that way i don't have to bother you to update your post every time.

Here is the updated lib files version 1.5

Walter
The libGDX library wraps also the OpenGL classes. What you added here was already in libGDX.
 

walterf25

Expert
Licensed User
Longtime User
The libGDX library wraps also the OpenGL classes. What you added here was already in libGDX.
Great to know, I completely forgot about libGDX, I'll play around with libGDX and EasyAR one of this day .
Walter
 

luke2012

Well-Known Member
Licensed User
Longtime User
Android 2.2 and later support OpenGL 2.0 ES as well as OpenGL 1.0 ES. Having produced an OpenGL library for 1.0 I thought I may as well do one for 2.0 as well so here it is!

The included "demo" is not really a demo at all and does little more than test the device OpenGL capability and initialise a drawing surface. It needs someone more interested in graphics than I to take it further.

Note that the demo needs my Threading library.

EDIT:- Version 1.1 posted. See post #12 for details.

EDIT:- Version 1.2 posted. See post #16 for details.

EDIT:- Version 1.3 posted. See post #35 for details.

EDIT:- Version 1.4 posted. See post #61 for details.

EDIT:- Version 1.5 posted. See post #83 for details.
User @walterf25 has added two methods to the the library to create version 1.5. The new jar and xml are posted below in OpenGL2_v1.5_lib.zip. I have left version 1.4 as the zip for that contains a somewhat trivial demo program. Just use the new v1.5 libs and ignore the v1.4 ones.

Hi @agraham and thanks for this library :)
I have a project based on WebGL library. Is it possible to porting it within a desktop app using OpenGL library ?
 
Top