Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  How do I correctly instantiate Android OpenGLES?  (Read 1686 times)
0 Members and 1 Guest are viewing this topic.
Offline elias4444

Junior Member





« Posted 2010-01-10 19:45:30 »

I've been working on porting my latest game over to Android, but I'm stuck on one VERY important detail. How do I correctly instantiate my openGLES environment?

I was using this example on the Android developer site:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/GLSurfaceViewActivity.html
but that only starts up the surface, and I'm not sure how to tie into it to run my openGL loop.
I've also heard that it's best to run your logic updates and graphic updates as separate threads on Android devices... is this really true?

Does anyone have a tutorial or some sample code that would help me understand this better? A lot of the examples I've found thus far have only been for 2D games, and pretty poorly designed at that (they don't even use a timer).

Any help would be appreciated!  Grin

Offline Nate

JGO Kernel


Medals: 145
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #1 - Posted 2010-01-10 20:34:42 »

Here is some code that manages the OpenGL surface:
http://code.google.com/p/skorpios/source/browse/trunk/skorpios-android/src/com/esotericsoftware/skorpios/opengl/AndroidGLView.java
It is a modified / cleaned up version of some sample code (I forget the original class name). The game loop starts on line 171. It is a bit hairy since it has to manage creating and resizing the OpenGL surface. It also buffers key and touch events that happen on the UI thread and fires them on the game thread.

You might check out Skorpios:
http://code.google.com/p/skorpios/
It lets you develop an OpenGL app on the desktop and run it on your phone using the same codebase. Desktop development is much, much faster.

Offline elias4444

Junior Member





« Reply #2 - Posted 2010-01-10 20:42:51 »

Thanks Nate! I'll start reading through that code.

My desktop engine is already set. The main issue has been "dummying" it down for use on Android. My other issue is that I don't actually own an Android phone, so I'm running everything in the virtual device created by the SDK. To tell you the truth, I'm not even sure why I'm porting it to Android in the first place, except that the game feels like something that would play well on a mobile device.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (15 views)
2014-08-01 22:53:16

CogWheelz (15 views)
2014-08-01 22:51:43

CopyableCougar4 (16 views)
2014-08-01 19:37:19

CogWheelz (19 views)
2014-07-30 21:08:39

Riven (27 views)
2014-07-29 18:09:19

Riven (16 views)
2014-07-29 18:08:52

Dwinin (14 views)
2014-07-29 10:59:34

E.R. Fleming (35 views)
2014-07-29 03:07:13

E.R. Fleming (13 views)
2014-07-29 03:06:25

pw (44 views)
2014-07-24 01:59:36
Resources for WIP games
by CogWheelz
2014-08-01 18:20:17

Resources for WIP games
by CogWheelz
2014-08-01 18:19:50

List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!