Android :: 2D API / OpenGL ES For An Android 2D Game?
Nov 8, 2010
I'm planning to develop a 2D game for Android devices without a dedicated GPU, like the HTC Wildfire. I remember from the PC that OpenGL is generally to be chosen over something like SDL for 2D graphics because of speed and features. On Android, there are two APIs for graphics: A "normal" 2D API (does it have a name?) OpenGL ES 2.0 Which one should I favor for a 2D game that should run on Android devices without a dedicated GPU?
View 1 Replies
Oct 13, 2010
What do you think is the best phone for OpenGL ES based game development? Large screen, OS 2.0.1+. Maybe even having the shaders path accessible from NDK.
View 19 Replies
View Related
Sep 14, 2010
im currently playing around with a Game that architecture is basically like the example 2d Games like JetBoy / LunarLander and so on. But as things now running (and animating continuously) they have kind of "hiccups" when the GC is running. I have done all i can to allocate as much Objects in front. There is nearly nothing that is created "new" besindes some Strings that are used to set the Score and so on. (TextView doesn't take int's =( - So do you have similar Problems that the GC is "lagging" your 2s game ? any solutions ?
View 12 Replies
View Related
Feb 12, 2009
I need to draw a background of 320 x 480 (fullscreen) for a OpenGL game. What I did was to stretch the texture to 512 x 512 and mapped it to 320,480 quad and then drew the rest of the game elements. I tried changing the texture image to 256x256 and no noticeable improvement in speed. Game was horribly slow even on the real device. It is actually slower on the device than on the emulator... I think i am the first one to have such a situation.. I am drawing a max of 12 triangles only 2 for background and rest are 64 x 64 textures. on 5 quad made with 10 triangles. I have disabled Depth, Lighting already. Only blending enabled as I use transparent PNG for texture of sprites. render cycle is like this - draw the background - draw the sprites (only 5) [with 10 triangles only] - swapbuffer... Please don't advice me to use 2d canvas, bitmap etc... I need to do it in OpenGL only. don't think OpenGL ES 1.0 is so incapable that it can't give me atleast 25-30 fps with just 12 triangles which you one 256x256 texture and one 64x64 textures (used by 5 quads...
View 20 Replies
View Related
Nov 16, 2009
I have a the beginnings of an Open GL game running, and have gotten to the point where it would be nice to have the FPS displayed. Since I will probably want to be able to put score or other info up anyway, I started searching for how to do that. I found the SpriteTest example, It looks nice, but really complex. Is there an easier way?
View 5 Replies
View Related
Jun 18, 2009
My game runs fairly well on my phone, but i want to increase the performance by using opengl. However currently i use the Canvas. I am a beginner in opengl. I have to port all my drawing code to opengl. However can somebody give me directions. For example how do i do the following in opengl:
c.save();c.scale(0.3f+scale, 0.3f+scale, width/2, height/2) c.drawBitmap( bMsg.bitmap, width/2 - bMsg.bitmap.getWidth()/2,dy+height/2 - bMsg.bitmap.getHeight()/2, MESSAGE_PAINT);c.restore();
And why cant i just use Canvas as an abstraction layer (facade) for opengl. An implementation of canvas could call the correct opengl methods in order to render. Why do i have to port all my code. I thought the canvas was a good abstraction interface to a drawing surface, why do i have to bother with opengl? It looks like this is possible, when is see the following contructor: "public Canvas (GL gl)" Also the this seems usefull. SURFACE_TYPE_GPU Surface type: creates a surface suited to be used with the GPU So what should i do? Re implementing the GamePainter completely and call opengl functions directly? Or is there some kind of abstraction mechanism, so that i can use OpenGL with just a few lines of code?
View 4 Replies
View Related
Sep 18, 2009
I've been working on a game framework for a little while, and while its far from perfect, I've put the current version online. To be honest, I haven't used much OpenGL in the past. Before last week I had never tried using it. If anyone would like to take a look, please do, I'd appreciate all the help possible on speeding it up. There are many features I have in mind and am planning at the minute, but so far it supports:
# Texture and Sprite management # Text, using TTF fonts # Organised layers # Two audio management classes, one optimized for music, the other for sound effects # Sprite dynamics (acceleration, terminal velocity, collisions) # Animation # Handlers to manage events fired through movement, animation, screen touches, accelerometer input, device shaking and collisions # Several minor features aimed at speeding development, such as screen settings and vibration.
View 1 Replies
View Related
Feb 4, 2010
I'm trying to develop a 2D game to android using opengl. I know how to print images on the screen and animate them. But in my game I have a map and a want to zoom in and out and scroll the map. But I can't figure out the best way of doing it.
View 2 Replies
View Related
Apr 8, 2010
Surprisingly, I don't seem to have issues with the OpenGL side of things (which is very unusual), but my problems stem from getting a clear idea for app architecture and a few other problems. Right now, most tutorials on the net just describe the render portion. I know that when I create a GLSurfaceView and hook a Renderer into it, it uses it's own thread for rendering.
I want to do logic operations and other gameplay stuff (like moving characters and whatnot) in it's own thread as well. Can anyone explain a good approach to this? I'm guessing the two threads will have to be synchronized (do logic, render, repeat), and limited based on time so that it performs smoothly across different devices.
View 1 Replies
View Related
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 http://prasna991.googlepages.com/drawframe.png
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 http://prasna991.googlepages.com/screen.png
OpenGL single threaded Initialization Helper ================================ Here is my OpenGL helper class.. makes the OpenGL initialization for newbies a cakewalk http://prasna991.googlepages.com/OpenGLHelperclass.txt
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
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?
View 3 Replies
View Related
May 22, 2010
I have a square grid, for a turn based game ( grid is similar to the chess board ), but the moves in the games are different based on whether you have lapped your opponent pawn at least once or not.i.e if you have not lapped (beaten any of the opponents pawns) in the outer most grid as below.if you have lapped your opponent pawn once at least, then you get to reach home,this way.Any player having all his pawns reaching "home" first wins.The ones in yellow are safe-houses, i.e both the opponent pawn and the player's pawn get to stay in the same grid, this is not considered to be lapping ( the opponent ).The lapped pawn will return to its start point.Now the question is, what is the effective way to store the paths for the all the pawns.we will have 4 pawns for the player and 4 opponent pawns.Is there any pattern to store such static information, in a elegant way?
View 1 Replies
View Related
Nov 12, 2010
I have a puzzle game with a 7x7 grid of graphics, and a timer, its just about ready to go. But I am stuck on how to go about saving/continuing game. For example when someone exits I want them to be able to save and exit, then come back and click continue to pick up where they left off with all of the graphics in the right place, timer and score. I looked at onSaveInstanceState android examples, but not sure if this is what I need or how to implement it in my case.
View 8 Replies
View Related
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
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
Nov 16, 2010
I want ask some questions about Opengl es 2.0?
View 3 Replies
View Related
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
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
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
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
May 27, 2009
I am rendering this PNG with no transparency just fine: http://n4te.com/temp/test.png However if I try to render this PNG (with transparency) with the exact same code, I just get a white box: http://n4te.com/temp/ball.png
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
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
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
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: http://www.thenewsh.com/~newsham/unproj/ In particular:
unproj.java - full source to example unproj-debug.apk - resulting apk file unproj - directory with full ant-buildable project unproj.zip - zip of directory
View 7 Replies
View Related
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
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
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
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
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:
CODE:......
Then I load all of that info into the approriate buffers and draw it to the screen with a call to:
CODE:..
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
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