Android :: Android Opengl Game - How To Print Images On Screen?
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
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
Nov 2, 2009
I'm basically using the same method of loading bitmaps in OpenGL that the SpriteMethodTest example uses and have been unable to get rid of an annoying outline that appears around all of my images.
For example, If I were to load an image of a white circle on a white background, I would expect to see nothing. Instead, I would see my circle because its edge would be gray. In SpriteMethodTest, I replaced the background image with white and was able to see that the edges of the android images flying around also don't seem to be rendered correctly.
Does anyone know how to load images in OpenGL without having a thin outline appear around the images?
View 4 Replies
View Related
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
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
Jan 17, 2009
Do you guys know of an application/function that will allow you to take a screenshot of your G1 screen?
View 2 Replies
View Related
Apr 3, 2009
Just starting a little game project and have a super basic question. what's the best way to store animation images for a game? I looked at the alien bloodbath code and they store multiple frames in a single png file. Is that the preferred way or is there easier/better way to do it? MP4?
View 2 Replies
View Related
Jan 6, 2010
I developed a game with the g1 in my mind. Now I want to support large screen sizes but I don't want to add in the apk different images for different screen sizes because now the apk is 3mb and when installed thought market it became 6mb (due to protection on). If I have to double the images to support new screens, the apk would be too heavy (about 13mb, I think) so I'm wondering to know if scaling images at runtime by myself (without compatibility mode) maybe the best way for supporting larger screens. Compatibility mode does a great work in scaling images but it slows down drastically the frame rate (I think because the scale operation is made every time an image is used/moved and not only once on the load of the image itself).
View 7 Replies
View Related
Aug 31, 2010
Rather than do this by just creating a lot of strings (which I've already managed), I want to add an integer and then print those list to the screen. At the moment, I'm just trying to get one integer on the screen without even adding it, but the app is "force closed" in the emulator. Why doesn't this work? Add one to it and then print the answer to this for a given loop (say up until 10).
Code:
package com.monkeez.count;
import android.app.Activity;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.TextView;
public class Count extends Activity {
/** Called when the activity is first created. */
TextView countDisplay;
@Override public void onCreate (Bundle savedInstanceState) { int counter = 1;
countDisplay = new TextView(this);
this.setContentView(countDisplay);
countDisplay.setText("counter here");
} }
The log cat is thus:
09-01 09:54:07.051: DEBUG/AndroidRuntime(279): AndroidRuntime START
09-01 09:54:07.051: DEBUG/AndroidRuntime(279): CheckJNI is ON
09-01 09:54:07.401: DEBUG/AndroidRuntime(279): --- registering native functions ---
09-01 09:54:08.891: DEBUG/dalvikvm(193): GC_EXPLICIT freed 320 objects / 19376 bytes in 109ms
09-01 09:54:09.041: DEBUG/PackageParser(65): Scanning package: /data/app/vmdl48927.tmp
09-01 09:54:09.251: INFO/PackageManager(65): Removing non-system package:com.monkeez.count
09-01 09:54:09.251: INFO/ActivityManager(65): Force stopping package com.monkeez.count uid=10037
09-01 09:54:09.991: DEBUG/PackageManager(65): Scanning package com.monkeez.count
09-01 09:54:09.991: INFO/PackageManager(65): Package com.monkeez.count codePath changed from /data/app/com.monkeez.count-2.apk to /data/app/com.monkeez.count-1.apk; Retaining data and using new
09-01 09:54:10.011: INFO/PackageManager(65): /data/app/com.monkeez.count-1.apk changed; unpacking
09-01 09:54:10.054: DEBUG/installd(34): DexInv: --- BEGIN '/data/app/com.monkeez.count-1.apk' ---
09-01 09:54:10.511: DEBUG/dalvikvm(286): DexOpt: load 169ms, verify 64ms, opt 4ms
09-01 09:54:10.591: DEBUG/installd(34): DexInv: --- END '/data/app/com.monkeez.count-1.apk' (success) ---
09-01 09:54:10.602: WARN/PackageManager(65): Code path for pkg : com.monkeez.count changing from /data/app/com.monkeez.count-2.apk to /data/app/com.monkeez.count-1.apk
09-01 09:54:10.602: WARN/PackageManager(65): Resource path for pkg : com.monkeez.count changing from /data/app/com.monkeez.count-2.apk to /data/app/com.monkeez.count-1.apk
09-01 09:54:10.611: DEBUG/PackageManager(65): Activities: com.monkeez.count.Count
09-01 09:54:10.650: INFO/ActivityManager(65): Force stopping package com.monkeez.count uid=10037
09-01 09:54:11.631: INFO/installd(34): move /data/dalvik-cache/data@app@com.monkeez.count-1.apk@classes.dex -> /data/dalvik-cache/data@app@com.monkeez.count-1.apk@classes.dex
09-01 09:54:11.641: DEBUG/PackageManager(65): New package installed in /data/app/com.monkeez.count-1.apk
09-01 09:54:11.821: DEBUG/dalvikvm(65): GC_FOR_MALLOC freed 6733 objects / 446400 bytes in 140ms
09-01 09:54:12.561: INFO/ActivityManager(65): Force stopping package com.monkeez.count uid=10037
09-01 09:54:12.711: DEBUG/dalvikvm(126): GC_EXPLICIT freed 1940 objects / 106408 bytes in 121ms
09-01 09:54:13.351: WARN/RecognitionManagerService(65): no available voice recognition services found
09-01 09:54:13.831: DEBUG/dalvikvm(65): GC_EXPLICIT freed 4667 objects / 280056 bytes in 173ms
09-01 09:54:13.901: DEBUG/dalvikvm(165): GC_EXPLICIT freed 2326 objects / 125088 bytes in 1059ms
09-01 09:54:14.180: INFO/installd(34): unlink /data/dalvik-cache/data@app@com.monkeez.count-2.apk@classes.dex
09-01 09:54:14.271: DEBUG/AndroidRuntime(279): Shutting down VM
09-01 09:54:14.290: DEBUG/dalvikvm(279): Debugger has detached; object registry had 1 entries
09-01 09:54:14.340: INFO/AndroidRuntime(279): NOTE: attach of thread 'Binder Thread #3' failed
09-01 09:54:15.350: DEBUG/AndroidRuntime(291): AndroidRuntime START
09-01 09:54:15.350: DEBUG/AndroidRuntime(291): CheckJNI is ON
09-01 09:54:15.740: DEBUG/AndroidRuntime(291): --- registering native functions ---
09-01 09:54:16.960: INFO/ActivityManager(65): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.monkeez.count/.Count }
09-01 09:54:17.120: DEBUG/AndroidRuntime(291): Shutting down VM
09-01 09:54:17.170: DEBUG/dalvikvm(291): Debugger has detached; object registry had 1 entries
09-01 09:54:17.250: INFO/AndroidRuntime(291): NOTE: attach of thread 'Binder Thread #3' failed
09-01 09:54:17.301: INFO/ActivityManager(65): Start proc com.monkeez.count for activity com.monkeez.count/.Count: pid=298 uid=10037 gids={}
09-01 09:54:18.611: WARN/ResourceType(298): No package identifier when getting value for resource number 0x00000001
09-01 09:54:18.620: DEBUG/AndroidRuntime(298): Shutting down VM
09-01 09:54:18.620: WARN/dalvikvm(298): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): FATAL EXCEPTION: main
09-01 09:54:18.680: ERROR/AndroidRuntime(298): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.monkeez.count/com.monkeez.count.Count}: android.content.res.Resources$NotFoundException: String resource ID #0x1
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.os.Handler.dispatchMessage(Handler.java:99)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.os.Looper.loop(Looper.java:123)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.app.ActivityThread.main(ActivityThread.java:4627)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at java.lang.reflect.Method.invokeNative(Native Method)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at java.lang.reflect.Method.invoke(Method.java:521)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at dalvik.system.NativeStart.main(Native Method)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x1
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.content.res.Resources.getText(Resources.java:201)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.widget.TextView.setText(TextView.java:2817)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at com.monkeez.count.Count.onCreate(Count.java:19)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
09-01 09:54:18.680: ERROR/AndroidRuntime(298): ... 11 more
09-01 09:54:18.940: WARN/ActivityManager(65): Force finishing activity com.monkeez.count/.Count
09-01 09:54:19.470: WARN/ActivityManager(65): Activity pause timeout for HistoryRecord{43fb6718 com.monkeez.count/.Count}
09-01 09:54:19.550: INFO/ARMAssembler(65): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x2de138:0x2de1f4] in 602730 ns
09-01 09:54:22.523: WARN/InputManagerService(65): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43f92978
09-01 09:54:22.681: INFO/Process(298): Sending signal. PID: 298 SIG: 9
09-01 09:54:22.826: INFO/ActivityManager(65): Process com.monkeez.count (pid 298) has died.
And the Count Manifest.xml is thus:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.monkeez.count"
android:versionCode="1" android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Count" android:label="@string/app_name">
<intent-filter> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </activity> </application>
<uses-sdk android:minSdkVersion="8" /> </manifest>
It seems that the parser on this site doesn't like to render my xml file - you can see it at
http://pastebin.com/raw.php?i=W75ak3E9
View 2 Replies
View Related
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
View Related
May 4, 2010
Anyone use an app for print screen on the Incredible?
View 3 Replies
View Related
Jul 19, 2010
Does anyone have a screen print of the $229 price they can post?
View 4 Replies
View Related
Aug 11, 2010
I've read several post on screen capture, most of which seem to be for advanced users and also risk bricking your phone.Is there a screen capture app available or one on the way that does not require rooting phone or installing the SDK?I need to be able to do the screen capture without a PC handy and save the capture as an image to download for later or email it to myself.
View 2 Replies
View Related
Jan 9, 2010
Anyone know if we can print screen (take a screen shot)? Any apps that would allow it?
View 2 Replies
View Related
Oct 7, 2010
I have follow an example of an opengl application and I don't know why is this thing happening...I have a GLSurfaceView with it's corresponding renderer drawing a triangle. But, instead of getting the whole view on screen, I have just the upper half, and it's also duplicated as you can see on the picure. I'm using a Nexus One.
View 3 Replies
View Related
Oct 23, 2009
I've just dusted off an application I did for Android half a year ago. I upgraded to the latest SDK and Eclipse ADT. After some struggeling I get the application to run again. When I debug it I can see that all the right code are executed the right way. The application shows a OpenGL surface and animates stuff on it. It used to work perfectly (I even have it running on my HTC Magic device), but in the new emulator the screen is just white?
View 11 Replies
View Related
Apr 7, 2010
For some reason my code here (this is the entire thing) doesnt actually render anything besides a red screen..
can anyone tell me why?
CODE:.................
View 2 Replies
View Related
Feb 9, 2010
I am very new to OpenGL ES. I am implementing some demo app to load multiple textures on the screen. For demo purpose I have loaded 2 textures in 2 different locations on the screen using glTranslatef() and glBindTextures() twice. Now I am able to see 2 different images on the screen. Now I want to move one particular texture across the screen using mouse.
View 2 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
Jun 27, 2010
Can somebody take me step-by-step how to draw 2D stuff over a 3D scene (such as controls, etc.). What I've been doing so far has not been working (it only draws the 3D scene), which is (in every frame): draw the 3D scene as normal, projection matrix mode, load identity, call GLU.gluOrtho2D(gl, 0, myScreenWidthInPixels, 0, myScreenHeightInPixels), switch the array pointers (vertices and texture coords) to the ones for my 2D stuff, then drawElements with an appropriate index list. (then switch the array pointers back so the 3D stuff works again).I get nothing added to the screen (just the 3D stuff).Do I need to be doing something else for it to draw? Can somebody take me step-by-step?
View 5 Replies
View Related
Nov 2, 2009
Dear all, I want to implement the transition effect ( transparent with Z axis ) when user slip the android home to change home page. therefore, I plan to launch the new activity that is implemented by OpenGL ES to perform this effect. However, i encounter a problem that the screen/display is dark momentarily when launching the OpenGL ES activity.
View 3 Replies
View Related
Nov 10, 2010
I'm developing an Android application. I'm very new on it. I have the following classes:
class CustomGLSurfaceView extends GLSurfaceView
class CustomRenderer implements GLSurfaceView.Renderer
CustomGLSurfaceView uses CustomRenderer to render a cube on onDrawFrame method.
I've added an onTouchEvent(MotionEvent event) on CustomGLSurfaceView to manage touch events:
class CustomGLSurfaceView extends GLSurfaceView {
// For touch inputs - previous touch (x, y)
private float previousX; private float previousY;
private CustomRenderer myRenderer; public CustomGLSurfaceView(Context context) {
super(context); myRenderer = new CustomRenderer(); setRenderer(myRenderer);
} @Override public boolean onTouchEvent(MotionEvent event) {
float currentX = event.getX(); float currentY = event.getY();
switch (event.getAction()) { case MotionEvent.ACTION_MOVE:
myRenderer.handleMovement(currentY, currentY, previousX, previousY);
} // Save current x, y
previousX = currentX; previousY = currentY;
return true; // Event handled } }
May I have to modify onDrawFrame to draw something new or to rotate the cube? I thing I must do it on handleMovement.
View 1 Replies
View Related
Mar 21, 2010
How do I use gl.gluUnproject in my OpenGL ES 1.1 android app to determine what is selected when the user touches the screen?
My understanding is that the touch event results in a line and I have to find the first "thing" it intersects with.
Are there any tutorials on how to do this?
View 4 Replies
View Related
May 3, 2010
I have written a object selection algorithm which picks the objects by their color. i give every object an unique color and then i just have to use the glReadPixels method to check which object was selected
this works fine and is really fast but the problem is that the frame is displayed on the screen with all the picking-colors so the screen flashes every time you select something.
so my question is: how do i write everything in the correct display buffer but dont display it on the screen to avoid these flashes?
View 3 Replies
View Related
Oct 16, 2010
I got Samsung Galaxy 5.
I got some gameloft games (HD versions) installed but as I Run them only Top left (approx 1/4)view of game screen appers.
As whole game can not to fitted on one screen..
|--------------------|
| |
| |
| |
|Gamel |
| |
|--------------------
It looks like half of screen is cut like on "oft" of Gameloft is invisible
View 3 Replies
View Related