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,578
  • OpenGL2_v1.5_lib.zip
    38.2 KB · Views: 744
Last edited:

GDO

Member
Licensed User
Longtime User
Thank you !

Do you know, why my apk is result.apk and not bitmap.apk ?
(I guess is not the right place to ask about that but my program is in this thread).
 

Informatix

Expert
Licensed User
Longtime User
I can test my programs on 3 devices (Samsung Galaxy Notes, Nexus 7 and Asus Transformer TF300).

My first program (colored triangle with OGL2) runs OK on the 3 devices .
My second program (square with one texture OGL2) doesn't run on my Asus but runs OK on the 2 others devices.

Do you know if there is something special to do with OGL2 and Asus ?
Could you, please, try my program ?

In landscape mode, the monkey does not show on some of my devices (e.g. Nexus 7). In portrait mode, all is OK.
 

GDO

Member
Licensed User
Longtime User
Thanks Agraham and Informatix for your answer.

My Asus got a keyboard and the program runs in landscape mode.

I have to manage the reload of the bitmap in this case.

Thank you very much for your help.
 

GDO

Member
Licensed User
Longtime User
I think the ratio trouble could be solved by changing that :
#FullScreen: False ------------> True
#IncludeTitle: True -----------> False
Am I right ?
 

GDO

Member
Licensed User
Longtime User
Hello,

The trouble was about ratio and vertex shader, as you said.
I fixed it.

Thanks.
 

GDO

Member
Licensed User
Longtime User
Hello,

Could you please, change these 2 functions :

glCompressedTexImage2D
glCompressedTexSubImage2D


" data As java.nio.Buffer " should be replace by the same type like you did for gltexImage2D

Thank you.
 

agraham

Expert
Licensed User
Longtime User
I actually did nothing for glTexImage2D and glTexSubImage2Dto let them accept a Bitmap parameter, a class call GLUtils provide those methods.

Did you want to pass a Bitmap to glCompressedTexImage2D and glCompressedTexSubImage2D? From what I can see they accept an image in some sort of compressed format. I am afraid I do not know enough about OpenGL or Android Bitmap handling for that matter, to even guess how to implement this. If anyone can explain what is needed I'm willing to have a go.
 

GDO

Member
Licensed User
Longtime User
I wrote glTexImage2D and glTexSubImage2Dto but I thought to glBufferData.

I wanted to pass a pointer on bytes to glCompressedTexImage2D and glCompressedTexSubImage2D and I thought opengl will manage it.

I don't know how to generate ppm files (ericson can convert ppm to ktx but my ppm files (from Paint Shop Pro X2) are not OK).

And last but not least, I need to generate compressed files inside my program (for shadow maps for example) and I don't know how.

So, for the moment, I will not use compressed textures.

Sorry for my last post.

:signOops:
 

PhilN

Member
Licensed User
Longtime User
Hi Graham, I have a project in which I am trying to implement motion sensing. That is using the 3-axis accelerometer, gyro and magnetometer data, applying sensor fusion to integrate the data (using Kalman filter techniques) to create a 3D virtual motion path that closely resembles the motion of the initiating device, my Samsung Galaxy SII. I was so very excited to see that you wrote a wrapper for OpenGL for B4A. I immediately downloaded and installed a few examples and used Jim Browns ModelUtil to convert a few objects and tried it out. Great success! I however would like to use the glVertex and glBegin and glEnd functions. This would really save me as I need to draw countless points and lines as you can imagine. Would you be so kind as to include these functions in your OpenGL2 library.
:sign0085:
Please... Please... Please...
 

Informatix

Expert
Licensed User
Longtime User
Hi Graham, I have a project in which I am trying to implement motion sensing. That is using the 3-axis accelerometer, gyro and magnetometer data, applying sensor fusion to integrate the data (using Kalman filter techniques) to create a 3D virtual motion path that closely resembles the motion of the initiating device, my Samsung Galaxy SII. I was so very excited to see that you wrote a wrapper for OpenGL for B4A. I immediately downloaded and installed a few examples and used Jim Browns ModelUtil to convert a few objects and tried it out. Great success! I however would like to use the glVertex and glBegin and glEnd functions. This would really save me as I need to draw countless points and lines as you can imagine. Would you be so kind as to include these functions in your OpenGL2 library.
:sign0085:
Please... Please... Please...

Agraham cannot implement what does not exist in OpenGL ES (please note the ES). Android does not embed a full featured OpenGL.
 

John D.

Member
Licensed User
Longtime User
Thank you for this library, Mr. Graham. I've left a tip in the jar for you.

Being new to all this, I tried running the demo included in the zip and ran into a few problems, most likely due to my blithering ignorance. I've posted a few questions in the questions forum, could you please have a look if you get some time?

Thanks

--John--
 
Top