Sign in to follow this  
crosstantine

OpenGL ES 2.0 Emulator

Recommended Posts

crosstantine    102
Hi all, and thanks in advance for your help, I spend several hours trying to run the hellogl inside the Android emulator that comes with the SDK, I was pulling my hair (and believe me... I've a lot!) and always got the f..ng message that the application exploted and was forced to close... I started to debug and it did not explote... it worked!!!, but still got the error inside the emulator, then I search and found in some forum that Android emulator does not support OpenGL ES 2.0, got the apk uploaded it on my phone, and voila!!! it worked... (it's frustrating too waste time like this)

Here's the question... if I cannot test my applications in a "save" environment, how can I develop and debug a game to be deployed on an android phone? I found that [url="http://www.malideveloper.com/developer-resources/tools/opengl-es-20-emulator.php"]http://www.malideveloper.com/developer-resources/tools/opengl-es-20-emulator.php[/url] has an opengl emulator but its crappy to recompile your application to test it under this emulator, isn't it?

I'm thinking the best way should be to create the game for desktop platform with the OpenGL ES restrictions using OpenGL (as far as OpenGL ES is a subset of OpenGL) and then refactor the code to run on an Android, but I think there should be a better way to do this,

As usual, thanks in advance for sharing your knowledge with newbies like me

Note: Why I'm using OpenGL ES from C code?, because I want to deploy my game on iphone too, and I think it will be better if I create all the "engine" of the game in plain C as a library and then wrap the input devices using some classes for each platform.

Share this post


Link to post
Share on other sites
Dunge    405
I never went trough the process, so someone else probably have better answers. But. A quick search allowed me to find "[url="http://developer.nvidia.com/tegra-resources"]NVIDIA x86 Windows OpenGL ES 2.0 Emulator[/url]" that seems to have been developed to support developing on "tegra" chips, which are included in some Android phones. As for the iphone, you will have to port your project to Objective-C, it don't support normal C/C++.

Share this post


Link to post
Share on other sites
crosstantine    102
Hi Dunge and thanks for your reply, as far as I understood Objective-C can call libraries made in plain C, is that false? I misunderstood this point? What I was thinking it could be a good approach to do a multiplatform game (android and iphone) will be to create a component to manage all the OpenGL details and create the application using the language according to the platform, that way the events from each device will be forwarded to the library to be manage in an standard way, most of the game logic will be in a dll and all the graphic management will be in another one... this is what I'm thinking:


[code]
--------------------
| App in iPhone |
| Objective - C |---------|
-------------------- | |--------------------| |----------------|
|----> | Common Component |----> | OpenGL pure |
-------------------- | | Application Logic | | c and c++ code |
| App in Android | | | and Input wrappers | | "game engine" |
| Java |---------| |--------------------| |----------------|
--------------------
[/code]
[font="Courier New"][font="arial, verdana, tahoma, sans-serif"]
[/font][/font]
[font="Courier New"][font="arial, verdana, tahoma, sans-serif"]The first layer will be written in java or objective-c based on the platform requirements and the other two components will be written in plain c and compiled to be used as static or dynamic libraries, am I missing something? should I create two different applications both written to the target platform? (I already have an desktop application running on windows, linux and Mac and this was my approach to them, it worked very nice but I used Qt for the presentation layer to avoid the rewriting and all the logic rest in libraries that could be recompiled without any painful refactoring.)[/font][/font][/font][/font]

Share this post


Link to post
Share on other sites
JanRichardson    103
I found the imgtec SDKs really useful when porting my companies engine to support es1 & es2 pipelines, there's also a lot of other good tools and information on their site.
[url="http://www.imgtec.com/developers.asp"]http://www.imgtec.com/developers.asp[/url]

We utilise a simple platform application wrapper over the top of engine / client code which allows us use pretty much the same code base on all the different platforms. It made debugging and development go a lot smoother and was an awesome help in the development of Bug Wings, [url="http://itunes.apple.com/gb/app/bug-wings/id437473178"]http://itunes.apple.com/gb/app/bug-wings/id437473178[/url].

Their SDK also allows you to capture API calls through PVRTrace and if your writing any shaders for the iphone I'd recommend using their PVRUniSCo editor.

Share this post


Link to post
Share on other sites
Bregma    9214
[quote name='Crosstantine' timestamp='1307627968' post='4821312']
Hi Dunge and thanks for your reply, as far as I understood Objective-C can call libraries made in plain C, is that false?
[/quote]
It is not false. It is true. You will have much more trouble integrating into Java on Android, but not so much that your approach is not the correct one.

Share this post


Link to post
Share on other sites
crosstantine    102
Thanks for the replies,

Jan thanks for the link I will give it a look, but I'm the kind of programmer that likes to build his own frameworks and only use free ones (not because the commercial aren't any good, it's because I don't like to be tied to any major change on some little company... that happens very ofter these days, a good idea is bought by a monster company and change the rules and you get into a trouble in the middle)

Bregma, thanks also for your reply,

I'm thinking to use some kind of framework like freeglut, glfw or something like that, did you use them to achieve portability? I don't know if one of those are ported successfully to iphone and android, most of them works on apple, windows and linux, but they dont say anything about mobile market, does anyone knows if there's a portability layer (like the ones I mentioned or others) to do an abstraction of the initialization and events models? (also, destruction, etc etc)

Share this post


Link to post
Share on other sites
crosstantine    102
Backing to the point of the thread, what emulator for GL ES do you recomend? the one that comes with android sdk does not support OpenGL ES 2 and shows a beatiful "force to close" message.

I see that imgtec has an emulator named PVRVFrame did you use it? is it free?

Share this post


Link to post
Share on other sites
bubu LV    1436
There are a lot of OpenGL ES 2.0 emulators available:
http://www.imgtec.com/powervr/insider/sdk/KhronosOpenGLES2xSGX.asp
http://www.malideveloper.com/developer-resources/tools/opengl-es-20-emulator.php
http://developer.qualcomm.com/showcase/adreno-sdk
http://developer.nvidia.com/tegra-resources

Each of them supports their hardware specific features (like DXTC for Tegra, or PVRTC for PoverVR).

Also there is option to use Angle project from Google: http://code.google.com/p/angleproject/ It actually emulates OpenGL ES 2.0 on top of DirectX 9. Those emulators above emulates OGLES through regular desktop OpenGL.
I myself like Angle project "emulation" the most, because I can access full source and examine some implementation detail if I need more information.

Share this post


Link to post
Share on other sites
crosstantine    102
[quote name='MartinsM' timestamp='1308150617' post='4823635']
There are a lot of OpenGL ES 2.0 emulators available:
[url="http://www.imgtec.com/powervr/insider/sdk/KhronosOpenGLES2xSGX.asp"]http://www.imgtec.co...enGLES2xSGX.asp[/url]
[url="http://www.malideveloper.com/developer-resources/tools/opengl-es-20-emulator.php"]http://www.malidevel...20-emulator.php[/url]
[url="http://developer.qualcomm.com/showcase/adreno-sdk"]http://developer.qua...case/adreno-sdk[/url]
[url="http://developer.nvidia.com/tegra-resources"]http://developer.nvi...tegra-resources[/url]

Each of them supports their hardware specific features (like DXTC for Tegra, or PVRTC for PoverVR).

Also there is option to use Angle project from Google: [url="http://code.google.com/p/angleproject/"]http://code.google.com/p/angleproject/[/url] It actually emulates OpenGL ES 2.0 on top of DirectX 9. Those emulators above emulates OGLES through regular desktop OpenGL.
I myself like Angle project "emulation" the most, because I can access full source and examine some implementation detail if I need more information.
[/quote]


Great reply, thanks MartinsM, I saw the mali emulator, but what I didn't like is the idea of recompiling the code using their emulator libraries mainly because most of this kind of solution does not ensure the code will run in the real hardware, if you need to recompile your solution is still an emulation? or is just a layer to run a code on another platform? I think the main purpose of an emulation is to provide an environment where you could safely test your application and ensure it will run on the target platform that the emulation is target to. Maybe I'm too skeptical because I had some hard time with emulators in the past (not android emulators)

I will check the other links as well, I'm wondering if you worked with some of them and have some feedback about their pros and cons.

Share this post


Link to post
Share on other sites
bubu LV    1436
All those emulators I listed requires your application to be compiled as Windows (or Linux/MacOSX if they provide libraries for that). By doing this your exe file is linking to libGLESv2.dll and libEGL.dll libraries, that contains GLES emulation. That is true for all the emulators I listed, including Angle project.

Full featured emulator like you are talking about (and what is provided together with Android SDK) is very complex software and I doubt anyone has made such for OpenGL ES 2.0. These emulators just emulate OpenGL ES 2.0 API, nothing else.

Share this post


Link to post
Share on other sites
crosstantine    102
[quote name='MartinsM' timestamp='1308152615' post='4823657']
Full featured emulator like you are talking about (and what is provided together with Android SDK) is very complex software and I doubt anyone has made such for OpenGL ES 2.0. These emulators just emulate OpenGL ES 2.0 API, nothing else.
[/quote]

Nice to know that, I will start to try these emulators starting with the recommended "angle project", thanks.

Share this post


Link to post
Share on other sites
JanRichardson    103
[quote name='Crosstantine' timestamp='1308150319' post='4823631']
Backing to the point of the thread, what emulator for GL ES do you recomend? the one that comes with android sdk does not support OpenGL ES 2 and shows a beatiful "force to close" message.

I see that imgtec has an emulator named PVRVFrame did you use it? is it free?
[/quote]


Its free to use you just need to sign up for an account with them (simple process just a matter of registering with an email address).

[quote name='Crosstantine' timestamp='1308150094' post='4823629']
Jan thanks for the link I will give it a look, but I'm the kind of programmer that likes to build his own frameworks and only use free ones (not because the commercial aren't any good, it's because I don't like to be tied to any major change on some little company... that happens very ofter these days, a good idea is bought by a monster company and change the rules and you get into a trouble in the middle)
[/quote]

We just use the SDK as an emulation layer for running our applications / games on windows, so we can fully utilise Dev Studio in debugging, editing etc. Your not tied to using the SDK in your shipped product, all we do is have a header we include which switches the GL header files based upon which platform is being compiled and we have a thin wrapper which initialises the window using the PVR emulator rather than normal GL. Its quite easy to integrate into your graphics engine pipeline, without it effecting any of your main application code, well it was for us anyway.

Share this post


Link to post
Share on other sites
crosstantine    102
Oh Great Jan, thanks... I will test it.

If I understood it well, you use PVR as emulation, but when you are going to ship your product you don't have PVR linked to your code (using .h and proprietary implementations for the initialization?) if that's correct, how did you manage the user events (touch, clicks, etc?) to be platform agnostic?

Share this post


Link to post
Share on other sites
JanRichardson    103
[quote name='Crosstantine' timestamp='1308155356' post='4823677']
Oh Great Jan, thanks... I will test it.

If I understood it well, you use PVR as emulation, but when you are going to ship your product you don't have PVR linked to your code (using .h and proprietary implementations for the initialization?) if that's correct, how did you manage the user events (touch, clicks, etc?) to be platform agnostic?
[/quote]


Yeah we use it as an emulation layer.

Within our engine, we abstract all the hardware / platform / OS dependant stuff away so this includes input.

For the input we have 2 systems, one being a cursor system, were we can have 0->n cursors active (used for us responding to touch / mouse cursor based input).

We also have a system, where the game can create a series of action mappings which can be Axis / Buttons and as the Game starts up we map these onto a input device, be it a joystick, accelerometer etc which can be supported on that platform. We can also map axis / buttons to respond to touch input as well, either through our UI or by touching certain regions of the screen to allow us to create virtual joypads etc

So basically we stick all input through an intermediate layer.

If you need to be able to test multi touch UI's on the PC you could write something to simulate multiple touch points or you can support multiple mice on windows via a SDK (think its called multipoint mouse SDK)

In most cases testing your UI with one cursor as long as when your implementing you UI click/touch responses in your game code that 2 interfaces can be responded to at the same time, ie checking to make sure you've made those 2 buttons mutually exclusive.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this