Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4android > Additional libraries, classes and official updates
Documentation Wiki Register Members List Windows Mobile Search Today's Posts Mark Forums Read

Additional libraries, classes and official updates Users contributed libraries, classes and official updates. This forum is open for licensed users only.

OpenGL library

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-08-2011, 03:05 PM
agraham's Avatar
Basic4android Veteran
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,835
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default OpenGL library

Here is a first stab at implementing an OpenGL library. The implementation is a subset of the full Android API but the actual functionality is pretty complete (I think!) as the omitted functions are mainly those that used scaled integer working, I have only implemented the equivalents that use floats.

However it is almost totally untested. I have got it to the point where it can draw a triangle on the screen but my total ignorance of OpenGL makes further progress challenging and I'm not really interested in doing graphics. As it can now draw on-screen most of the further functionality should be OK as it is a very thin wrapper of the OpenGL API. The hard part of integrating the GLSurfaceView with Basic4android and drawing on it is done.

The reason for posting it therefore is to see if there is any interest in it before I waste more time on it, and to see if there is an OpenGL expert out there who would collaborate on testing and debugging it - assuming anyone wants to use it at all!

As an aside I believe that the GLSurfaceView, being based on a standard View, can also be drawn on using the same methods as other Views as well as by the OpenGL renderer but I haven't tried that.

Note that the "demo" needs my Threading library.

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

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

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

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

EDIT :- Version 1.5 posted. See post #25 for details.

EDIT :- Version 1.6 posted. See post #35 for details.
EDIT :- Version 1.6 reposted with correct version number. See post #38 for details.

EDIT :- Version 1.7 posted. See post #39 for details.
Attached Files
File Type: zip OpenGL1.7.zip (51.3 KB, 1317 views)
__________________
Sorry, but I don't answer questions by PM or email. Please post your queries in the forum.

If you have benefitted from my work a contribution would be welcome

Last edited by agraham : 05-20-2011 at 09:03 AM.
Reply With Quote
  #2 (permalink)  
Old 05-09-2011, 05:27 AM
Junior Member
 
Join Date: Dec 2010
Posts: 10
Smile OpenGL Testing

We use openGL extensively in a number of projects and as we are migrating code to the Android and iPhone platforms, one of the biggest stumbling blocks was the lack of a 3D engine in basic4android.

We had already starting an openGL implementation of our own, but after seeing your past contributions to basic4andoid I'm sure your implementaiton is likely to be cleaner and more functional.

Will give it a try and get back to you with our findings.

Keep up the great work !
Steve
Reply With Quote
  #3 (permalink)  
Old 05-09-2011, 06:16 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 25,792
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Thank you Andy. The documentation is available here: Basic4android - OpenGL
Reply With Quote
  #4 (permalink)  
Old 05-10-2011, 06:37 AM
Junior Member
 
Join Date: Jan 2011
Location: Finland
Posts: 52
Default

Wow, that's nice, one big feature/lib I have been missing in B4A... I have some experience with OpenGL and lot of intrest for 3d gfx so I'm going to test this feature soon... (week or so..)
Thanks!!!
__________________
--- Samsung Galaxy Note 4.04 ---
Reply With Quote
  #5 (permalink)  
Old 05-10-2011, 11:14 AM
agraham's Avatar
Basic4android Veteran
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,835
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Version 1.1 now posted has support for all the Android OpenGL Interfaces, namely GL10, GL10Ext, GL11, GL11Ext and GL11ExtensionPack. The constants and functions supported may be found in the Android documentation GL10 - Android SDK | Android Developers. Note the clickable list of Interfaces in the lower left panel.

Many functions have equivalents taking either an array or an Android native Buffer. As Basic4android doesn handle Buffers I have omitted those functions using them. However there are a few functions that exist that only accept a Buffer parameter, for example GL10.glVertexPointer. For those functions I have synthesised an alternative using a float array. Alternatives using int or other types of array are possible if required.

Some functions exist in two forms using the same name but different parameter lists. Basic4android does not suppport this so the figure "2" has been appended to the later version name to allow Basic4android to distinguish them. I think I've found them all but if a particular expected version is not visible that is probably the reason for it.

There may be stupid mistakes and typos but I am pretty sure we can overcome those as they arise and hopefully end up with a working OpenGL implementation for Basic4android.
__________________
Sorry, but I don't answer questions by PM or email. Please post your queries in the forum.

If you have benefitted from my work a contribution would be welcome

Last edited by agraham : 05-10-2011 at 11:24 AM.
Reply With Quote
  #6 (permalink)  
Old 05-11-2011, 05:45 AM
Cor Cor is offline
Senior Member
 
Join Date: May 2007
Posts: 499
Default

Thanks agraham,

for your nice and hard work
__________________
Best regards,
Cor de Visser, Netherlands, HTC Magic 2.2.1

Amazing Guitar Chords for Android
http://android.ready4music.com
Reply With Quote
  #7 (permalink)  
Old 05-11-2011, 06:48 AM
Junior Member
 
Join Date: Apr 2009
Posts: 62
Default

hey Andrew, could you post a sample code? just something basic like making a cube and putting a texture on it. thanks.
Reply With Quote
  #8 (permalink)  
Old 05-11-2011, 07:57 AM
agraham's Avatar
Basic4android Veteran
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,835
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by gorelshv View Post
could you post a sample code?
No. I'm a Systems Engineer, not a graphics programmer and I know nothing about actually using OpenGL for graphics work. That is why I asked for collaboration to test the library. I knew some people wanted OpenGL so I have done the work to expose it to Basic4android. I now need feedback and examples of failure from people who know what they are doing so that we can debug the library.
__________________
Sorry, but I don't answer questions by PM or email. Please post your queries in the forum.

If you have benefitted from my work a contribution would be welcome
Reply With Quote
  #9 (permalink)  
Old 05-11-2011, 09:56 AM
Junior Member
 
Join Date: Jan 2011
Posts: 20
Default

Andrew,

In answer to your question of whether anyone wants a gl library I can personally say that I definitely do and I've got lots of uses for it. Having gl is something I've been hoping for and makes b4a an amazing product. Thank you very much for providing it, I'll post any bugs I find.

Many thanks,

Andrew.

Reply With Quote
  #10 (permalink)  
Old 05-11-2011, 10:51 AM
agraham's Avatar
Basic4android Veteran
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,835
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Hmm! I didn't think this library would grow like this

Version 1.2 now posted.

GL10 Object name changed to GL1 to reflect that it might support either OpenGL ES 1.0 or 1.1.

Various GL1.xxxPointer functions refined as I now better appreciate what they do.

Added Int as well as Float versions of many functions to improve the orthogonality of what's available. This may need revisiting when someone who really knows what they are doing plays with this library.

Added Matrix and Visibility support objects.

Added GLSurfaceView.RunOnGuiThread so that rendering code can run stuff on the GUI thread.

Improved the demo, not in the graphics but in the structure to show error handling on the rendering thread which would otherwise force close the application as exceptions not on the main thread are not trapped and reported by Basic4android.
__________________
Sorry, but I don't answer questions by PM or email. Please post your queries in the forum.

If you have benefitted from my work a contribution would be welcome

Last edited by agraham : 05-11-2011 at 11:29 AM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wish: OpenGL 2D Jim Brown Bugs & wishlist 3 08-11-2011 01:06 AM
Door library (Beta) - Special library Erel Official Updates 60 01-13-2011 11:23 AM
Merging Outlook library and Phone library Erel Official Updates 11 09-15-2010 09:22 AM
PhoneticAlgorithms Library (ex-StringComparison Library) moster67 Additional Libraries 10 11-11-2008 07:46 PM


All times are GMT. The time now is 02:52 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0