Android :: NDK OpenGL - Mixing Java And Native - C - Calls To OpenGL API

Jul 24, 2010

I would like to be able to use the OpenGL API from both Java and C (via NDK).

In Java, there is a GL object passed, which has all GL methods on it.

In C, you just talk to the native library.

In a single onDrawFrame callback (for which Java is passed a GL), can I use methods on the GL object, and also call NDK methods which access the openGL library?

In other words, is the GL object just a wrapper for the same instance of the native library?

Android :: NDK OpenGL - Mixing Java and Native - C - calls to OpenGL API

Android :: OpenGL Speed Issue - Code Contribution To Other OpenGL

Feb 25, 2009

Single Threaded OpenGL game ! (check bottom, you can download and use the helper class) Lighting disabled ! Depth Buffer disabled ! Culling enabled ! Textures disabled !

Just 176 integers (x,y values only) making 88 vertexes along with 132 index numbers making "44 triangles only"

Framerates I get is

with GL_BLENDING disabled - 145 fps approx only! enabled - 110 fps approx only!

I have the screenshot of exact code in the draw function here.. just 2 damn lines ! I have hidden only the comments.. click here to see it

variable details in the 2 lines of code =========================== ipts = 176 elements (only x and y for each vertex) totallinetriangles * 3 = 176 lineindexes = 132 elements - type "short"

Here is the screenshot of output drawing and how it will look like

OpenGL single threaded Initialization Helper ================================ Here is my OpenGL helper class.. makes the OpenGL initialization for newbies a cakewalk

I tested by rendering on the touch event only.. frame rate drops only when u touch and drag and here I have just tested by tapping and releasing gently on the emulator and on the device

Is this the device limitations ? So graphics is actually a lot lot lot slower than on iPhone ?

View 8 Replies View Related

Android :: Java API For OpenGL ES 2.0?

Aug 25, 2010

I am learning Android development, specifically to eventually do OpengL 2.0 ES on it. So far I have read that the NDK supports Opengl 2.0 ES. However, is there also a Java API for it? If there is a Java API for it, which one is recommended? I know both C++ and Java, so it is not a big deal if I have to use the NDK, but I would prefer to work only in Java if possible and without a big performance hit.

View 1 Replies View Related

Android :: Java OpenGL ES 2.0 Bindings Project

Mar 12, 2010

i started a small project over at google code that provides you with bindings for OpenGL ES 2.0 in Java. I started just a couple of hours ago so it's not finished yet. The project includes the original GLSurfaceView plus all the helper classes from the latest Eclair build as well as a modified version of GLJNIView from the NDK samples which is now a fully functional GLSurfaceView subclass called GLSurfaceView20.

OpenGL ES 1.x and 2.0 are exclusive so you have to first check wheter GL ES 2.0 is supported. You can check this via the following method:

private boolean checkGL20Support( Context context ) { EGL10 egl = (EGL10) EGLContext.getEGL(); EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

int[] version = new int[2]; egl.eglInitialize(display, version);...................

View 6 Replies View Related

Android :: Testing OpenGL Rendering In Java Outside?

Aug 30, 2009

I would like to write OpenGL classes and test them in java outside of an Android device or emulator, and then use these in the Android.

Has anybody done this?: If so, are there JOGL implementations that are directly compatible?

I tried doing this on Windows using JOGL and writing wrappers, etc, but it turned out to be a real mess. I finally gave up when I didn't know how to get a GLU instance for a frustrum call.

View 4 Replies View Related

Android :: Writing Portable Java Application Using JOGL And OpenGL

Oct 24, 2009

I plan on writing a Java 3D game that will work both on PC and Android. Unfortunately it looks like there is no common OpenGL API for both platforms.Do the APIs differ significantly? Is there a way I could use the same 3D code in both versions? Is it a good idea?

View 3 Replies View Related

Android :: FPS Using Opengl Es On G1

Jan 27, 2009

I am working on developing a 3d game. I have loaded ms3d model in my project and all texture and everything is working fine. I m not loading any joints.But I am facing two major problems which indeed are related to one thing. 1: I have got FPS problem in my game.Its too low even on G1. 2: When I have touch event to control the game it affects the FPSmore. So plz let me know how to optimize it more because the same game with same code of opengl es is wokring at 45 FPS on Iphone So why its running slow on G1.What is opengl es benchmark for G1 ? Wat can be comparison btwn Iphone and G1 related to hardware acceleration?

View 3 Replies View Related

Android :: OpenGL On 1.6

Oct 11, 2009

Been working with OpenGL a little more recently, and have been noticing pretty bad performance on my G1. Were there any major changes to OpenGL in 1.6 that would change the performance (or made my code incorrect?) on device? As a test, I grabbed the SpriteMethodTest out of Apps-For-Android, and gave it a spin. I had run it a few months ago and noticed pretty decent performance. With a low number of sprites (10-100), every method (Verts, Hardware VBO's, and DrawTex) had easily over 30fps, with drawTex beating out the others. I fired it up on my G1 (recently updated to 1.6), and all 3 methods are giving me performance of around 10-12fps with all methods of OpenGL at 10 sprites. Just for fun, installed the exact same APK on my girlfriends phone, which has yet to be updated to 1.6, and hers shows what I expected to start with, 30-60fps depending on method. So the question is, did anything change in terms of OpenGL, that would make the example code in SpriteMethodTest less than optimal?

View 3 Replies View Related

Android :: Opengl Es 2.0?

Nov 16, 2010

I want ask some questions about Opengl es 2.0?

View 3 Replies View Related

Android : How To Use Png / Jpg In OpenGL ES?

Aug 24, 2010

What is the correct way to save images in png format, if I want to use it in my Android OpenGL ES application as texture?

View 1 Replies View Related

Android :: Bad OpenGL Emulation

Aug 19, 2009

I'm developing a new game and have been having inconsistencies between the device and emulator. The biggest one for me right now is that the elements I draw with an orthographic projection work correctly on the device, but are 1/2 the size on the emulator. I've checked and rechecked the code 100 times and I'm positive I've done it right but am confused as to why I'm seeing that result. I suppose I could go forward doing ALL testing on a device - and I may have to, seeing that the emulator's frame rate is horribly slow - but I was hoping that I could do some of the work on it at least.

View 15 Replies View Related

Android :: OpenGL ES Application

Oct 25, 2010

I am currently trying to develop a game for android in OpenGL ES and I am testing it on my Nexus One. But I have run into some performance problems,and I would like to ask somebody about it,could you help?I currently have a very basic scene - background made of 25 tiles(256x256 texture each), and then a number of textured cubes(128x128 texture for each side of a cube ). However,when I try to display approx. more than 10 cubes, the performance becomes so sluggish that I can't even rotate the scene smoothly. I can't imagine how can I add more objects(player,enemies, all that kind of stuff) when it runs so slowly with 35 objects in total. I mean - games like Raging Thunder 2 probably display hundreds of objects at once(plus they do lots of computations behind the scenes) and they run super- smooth on my nexus one. What am I doing wrong? Could somebody help me please?

View 13 Replies View Related

Android :: PNG Transparency And OpenGL ES

May 27, 2009

I am rendering this PNG with no transparency just fine: However if I try to render this PNG (with transparency) with the exact same code, I just get a white box:

I am loading the PNG into a texture like this: Bitmap bitmap = BitmapFactory.decodeStream(input); int[] temp = new int[1]; gl.glGenTextures(1, temp, 0); textureID = temp[0]; gl.glBindTexture(GL10.GL_TEXTURE_2D, textureID); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST); // GL_LINEAR for quality. gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE); GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); bitmap.recycle();

I am using this blending: gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); How is it possible to render a PNG with transparency in OpenGL ES?

View 7 Replies View Related

Android :: OpenGL And Use Of ByteBuffers

Feb 23, 2010

I'm porting over some software from the iPhone, and the fact that I need to use ByteBuffers for my data structures in order to use OpenGL is killing me. My render loop takes 3ms to actually do the work and render screen, but I do need to perform a ByteBuffer clear / repopulate to update a dynamic texture. The bytebuffer clear, followed by the put() and position(0) to prepare for texture uploading takes about 100ms. This is WAY too slow. Is there a way around using ByteBuffers other than going the NDK route? The texture is 512x256 RGBA. should the ByteBuffer .clear() .put() and .position() be taking 100ms?

View 11 Replies View Related

Android :: OpenGl Drawn Something?

May 10, 2010

glReadPixels is too slow, so I need another way. Without testing object by object, Is there any other way?

View 7 Replies View Related

Android :: GluUnProject - Opengl Bug?

Feb 5, 2010

I'm having problems with gluUnProject. I saw other discussions on this message base regarding this function and they did not solve my problem. When I use GLU.gluUnProject I get values that are close, but not quite right. I'm manually keeping track of my model matrix and I replicate the projection matrix manually. (I have also tried setting the projection matrix to identity and manually incorporating a projection matrix into my model matrix, and I ended up with the same results). I tried using the builtin GLU.gluUnProject function and I also implemented my own based on reading that source and reading the C GLU sources and both seemed to give substantially similar results. So I put together a small demo, trying to keep it as minimal as possible and still get the point across. Either this demo shows a misunderstanding I have of gluUnProject or it shows a bug in the function or opengl projections. Can someone check this over and see if I'm just doing something wrong or if there's a bug that needs to be filed? The files are here: In particular: - full source to example unproj-debug.apk - resulting apk file unproj - directory with full ant-buildable project - zip of directory

View 7 Replies View Related

Android :: OPenGL - XML Integration

Aug 26, 2010

I'm making a media player application in android where one part of my screen has a animation which is made in OpenGL (ofcourse with Android/JAVA).....So my screen consists of 2 parts:

1) Left hand side consists of all the widgets (using xml).

2) Right hand side consists of the animation made in OpenGL.

I'm able to make the Gui (xml part) and also the animation (opengl). Can i integrate the GUI made in XML file with the animation (made using GLSurfaceview)?

View 1 Replies View Related

Android :: OpenGL ES Libraries

Jul 13, 2010

I looked around for info on this in the group but couldn't find any... so far in my OpenGL programming I've just done everything directly, but I was curious if anyone had written any "wrapper" libraries for it besides min3d. Min3d is great (or is getting there) but it's GPL'd, making it unsuitable for a commercial product (if my understanding of the license is correct).

View 5 Replies View Related

Android :: G1 Support For OpenGL ES 1.1?

Feb 2, 2009

Does anyone know whether the G1 device is capable of supporting OpenGL ES 1.1? Is this something that depends on both the graphics chip and the OS, or is it purely software? If Android/the G1 only supports OpenGL ES 1.0, are there any pieces of the 1.1 spec that are supported?

View 3 Replies View Related

Android :: OpenGL-ES 2.0 Support

Feb 5, 2009

Is there any plan to support OpenGL-ES 2.0 in Android? Is it possible to write a renderer youself based on OpenGL-ES 2.0? In that case, where to start.

View 2 Replies View Related

Android :: OpenGL Textures

Feb 17, 2010

I'm learning OpenGL on my own atm and I have a question about texturing a surface:

I can create a simple polygon like this:


Then I load all of that info into the approriate buffers and draw it to the screen with a call to:


My question:

I'm looking for a good example of how to take an image and texture it to the surface.

View 4 Replies View Related

Android :: OpenGL ES Canvas ?

Jun 13, 2010

I'm working on an OpenGL ES game using the NDK. My min SDK version is 1.6. I have created an OpenGL Es 1.0 renderer in Java and am calling a native JNI method in that renderloop.

The problem I'm having is that it seems that the resolution of the rendering context is limited. When using the emulator I'm getting a rendering canvas of 480x320, which is fine. Now; when I use my HTC Desire I am only getting a canvas of 533x320 while the native resolution of this phone is 800x480px.

View 2 Replies View Related

Android :: OpenGL ES 2.0 On Eclair

Dec 24, 2009

Eclair has supported OpenGL ES 2.0. But I can not find related JNI wrapper for OpenGL ES API. How a Java application use OpenGL ES 2.0 functions?

View 1 Replies View Related

Android :: HTC Hero OpenGL Bug

Dec 10, 2009

I was playing around with OpenGL on my HTC Hero (latest OS version) and i think i found a bug.

Here's the situation: I have the following triangle


Basic setup, uses a VBO with vertex position and texture coordinates components. Additionally i load 2 textures. For rendering i set the projection matrix to identity so i have a basic 2D setup with the x and y axis each spaning the interval [-1,1]. I render the mesh once with texture 1 and a second time displaced by 0.5 on the x axis with the second texture. Additionally i set the texture matrix to identity for the first triangle rendering and for the second i gradually increase the displacement in u. The rendering code looks as follows (methods call equivalent opengl procedures):


The effect is that the texture on the second triangle is moving to the left. Texture wrap is set to WRAP in u and v, texture filters are set to LINEAR. The code works as expected on all emulators i setup for all OS versions. However, it does not work on my HTC Hero with the latest OS update. The texture matrix is not set to identity for the second triangle and i can't figure out what is wrong. Again, the same code works perfectly fine in the emulator.

Did anyone else stumble across this bug? Is there a solution to it? It would be a big show stopper for me as i need to rely on proper texture matrix manipulation.

View 2 Replies View Related

Android :: OpenGL Material ?

Jul 20, 2010

I'm fairly new to OpenGL ES and am having a heck of a time trying to get my material to show up. Right now all I'm looking at is a shaded gray rotating triangle. At least it looks shaded (light and dark parts), but now color other than gray.

I've posted my code here:

The triangle coordinates, normals, and material:

The renderer: [url]

I'm using ambient, diffuse, and emission to create the material. And ambient and diffuse for the light.

I'm testing on a G1 running Android 1.6.

View 7 Replies View Related

Android :: OpenGL ES Tutorials ?

Jun 30, 2010

As I am one who cannot find any decent Android-based OpenGL ES references, I have decided to start one. You can check it out at As I am not a seasoned GL programmer, any and all comments and/or questions are greatly appreciated!

My mission is to first create an OpenGL version of an application on Mac OS X, and then port to Android. Once the port is done, I go through each program, step-by-step, and contrast and compare how the port was done. I also explicitly point out any and all differences between the two, subtle or obvious.

View 2 Replies View Related

Android :: OpenGL Lockups In 2.2

Sep 12, 2010

There's been a couple threads about this in the last year or so, but I wanted to draw attention to it again, as I've spent most of the last couple of days trying to confirm it wasn't anything I'm doing.

The short story is, I'm pretty sure there's a very serious lock-up-the- phone level bug that happens when using OpenGL applications. When it occurs the phone will freeze for at least two minutes before rebooting itself, sometimes requiring that the battery be pulled. This didn't seem to happen often on 2.1, but I'm seeing it with a lot more regularity on 2.2 (particularly on HTC phones, though that may be a coincidence) and am really hoping to draw some attention from someone in a position to fix it.

Typically, you'll end up seeing hundreds of lines of this in the LogCat log:


There won't be any callstack or error of any kind preceding this. In this case 2005 is my app (a live wallpaper), and 71 appears to be the UI/system process. I'm assuming this is a race condition within SharedBufferStack. I've seen cases where four or five process IDs were all printing the message, all OpenGL apps of some kind.

Replicating the problem is very, very difficult and seems very random... in the last case I had to leave the wallpaper running and active on the home screen for about seven hours before it occurred. Sometimes I've had it go days, other times it'll happen within a few minutes. My log output demonstrates no unusual activity at all before the crash, loading/unloading/visibility/etc doesn't seem to be a factor. It's very rare.

I kind of feel like this got glossed over the last couple times people have reported it here, but based on my reading it's a long-standing problem with Android and OpenGL and is having a chilling effect on its usage. Is there anyone who can explain if there's anything I can do to discourage problems here? This is beyond my ken honestly, does anyone know this part of the system well?

View 1 Replies View Related

Android :: SW - 2D API - Vs HW - OpenGL - Rendering

Apr 27, 2009

I'm trying to compare the difference in speed between software and hardware graphics rendering. I have 2 apps right now - one written with only java/android 2D APIs, and one written with openGL calls...

View 6 Replies View Related

Android :: OpenGL ES Pixel ?

Aug 24, 2009

I am new to Android and OpenGL world. I've created a new ap using openGL ES. The package is attached with this mail. Android Simulator LCD size is 320 x 455 and i've set same size for OpenGL Viewport. But For creating visible rectangle i've to use vertices, which are of very high value.



View 2 Replies View Related

Android : How To Test OpenGL

Aug 1, 2010

After a frustrating day of having the Emulator render lines strangely, and then discovering that my G1 renders them exactly as I expect, I am left to wonder how to test OpenGL (using GLSurfaceView).

Is the emulator sufficient to test code for correctness? I ask because I experienced the following on the emulator, but not on the G1, all using Ortho projection.

1) Line width depending on length! I drew a series of lines, most fairly short but several with endpoints close to the edge of the fixed- point number range. The long lines were rendered as wide. The short lines were rendered as 1 pixel wide.

2) Lines exploding to fill the whole screen when not appropriate to the scale (double the scale, line goes from 1/10th screen width to filling screen (or more).

3) Lines not appearing at all if horizontal.

Is the emulator a correct openGL implementation? If I see problems on the emulator, am I likely to see them on some hardware platforms?

Can I use my G1 as a reference platform?

Or do I need a whole slew of phones to verify that an openGl app (scientific graphics, not animated) works across all platforms?

View 17 Replies View Related

Copyrights 2005-15, All rights reserved