Android :: Simple 2D Tile Not Rendering ?
Mar 16, 2010
I'm putting together a simple test made up of two tutorials available online for OpenGL ES on Android. This is really just so that I can learn about the basics of OpenGL ES to better understand how I have to design my program.
Right now, when it tries to render, the mouse movement effect works, but I get no square drawn on the screen.
Here are the two source files I'm dealing with:
CODE:.......
The second one is the tile object itself:
CODE:........
View 1 Replies
Jan 24, 2010
Thank to previous replies, and with a major inspiration from http://insanitydesign.com/wp/projects/nehe-android-ports/ , i started to build a simple Tile Generator for my simple 2D zelda-like game project.I can now generate a map with the same textured tile, using 2 for(..) imbricated iterations to draw horizontal and vertical tiles, and got some basic DPAD key input listeners to scroll over the x and y axis.but now im running into my first performance problems, just with one texture and one model.When trying to build a 10x10 map, scrolling is fine and smooth.When trying with 50x50, things get worse, and with a 100x100, its way unacceptable.Is there a way only to tell OpenGL to render the 'visible' part of my mapset and ignore the hidden tiles? im a totally new to this.
View 2 Replies
View Related
Sep 8, 2010
Like the title. I have a small drawable file, but the ImageView is much larger than it. How I can fill it without left any extra space?
View 1 Replies
View Related
Nov 20, 2010
I am developing checkers application for Android. I have drawn on Canvas gameboard and tiles for each side, also I have made selection of tiles by D-Pad. But what about, Android phone doesn't have D-Pad? There must be a way how to do that in touch (I touch a tile - it is selected now). Do you have any ideas?
View 2 Replies
View Related
Sep 20, 2010
is it possible to draw a 9-patch that tile its border instead of stretching it?
View 2 Replies
View Related
Nov 4, 2010
I've been stuck for ages now trying to implement threading or background image loading for a custom tile overlay class I've been working on. I'm pretty useless when it comes to Java so threading isn't something I've had any experience with. Basically I have extended an ItemizedOverlay and in the draw() method calculate the tiles I need to display over the standard google tiles then fetch those images with a URLConnection and using BitmapFactory decode them and draw them to the canvas at the correct position on the screen so that the images are on top of the google tiles with about 50% opacity (the custom tiles are cellphone network coverage png's which are used for our web app). I initially got this all working with the tiles loading in the correct places but hit issues with memory and "freezing" while panning so implemented some basic caching and memory management to only store the tiles that are displayed on the map in memory and when downloading a tile store it to SD card.
Then I figured the freezing while panning is due to the blocking nature of downloading the images so, have been trying to implement threading. I created a class that extends AsyncTask to download the images in the background and store them to SD, in the onPostExecute method I then try to draw all the tiles. But onPostExecute never seems to fire, now I know that the AsyncTask has to be called in the main ui thread so tried to debug the execution with Thread.currentThread().getId() calls through out the code. The thread Ids through out is 1 and then 10 for the doInBackground method for the AsyncTask. Now I'm not sure if 1 is the main UI thread or not. In the extended MapActivity class I have, the onCreate method's Thread.currentThread().getId() returns 1 but I'm not sure if the MapActivity class is executed in the main ui thread? Here Romain Guy mentions that the onPostExecute method should have @Override but when I do that eclipse flags it as an error
"The method onPostExecute(Boolean...) of type TileCache.ImageLoadTask must override or implement a supertype method"
So I guess something is wrong there but the only fix eclipse offers is to remove the @Override
So I guess with out post all my source code, the question's I have are:
Is the MapActivity onCreate method called in the main ui thread?
What does the @Override error mean? or why does it show that error
Does anyone have an example of a custom tile overlay implementation with background image loading and tile caching?
View 1 Replies
View Related
Nov 10, 2010
I wrote a program in Android for setting different kinds of images as my background image, but it is not working with svg files. I am not getting any errors, it is not displaying any image and I'm getting a blank screen in my emulator when using svg files. Can any one suggest how to read and display svg files in Android with some code? Or should I convert xml code?
View 1 Replies
View Related
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
Sep 10, 2010
There's a decent amount of information out there on the Activity lifecycle. But I'm surprised how difficult it is to find a comprehensive description of the rendering lifecycle. By that I mean the order and rules by which a tree of nested activities, views, and drawables get to be sized and drawn to the screen, and the points at which a developer can modify rendering behavior.
View 1 Replies
View Related
May 13, 2010
I need to find out how big a view will be after attaching it to its parent.I have overridden this method: Do you think there is a way to get this information before rendering the view itself? Basically I need to know the actually size before attaching it and not attach the view at all if it would take more certain amount of space. Code...
View 2 Replies
View Related
Jul 15, 2009
Can anyone help me to understand how WebView decided which content it can render and which it can't? For example I am inside a webview select a link and if the link sends an XML file I want my application to handle to data instead of WebView, Is this possible?
View 4 Replies
View Related
Jun 22, 2010
I have an ImageView object that I'm setting the android:src="@drawable/some_xml_file" instead of a standard png and it seems to not always render the drawable, as you can see in the first row here (it also happens intermittently in other rows as well):
I've tried setting the src & the background property but they both have the same effect. the source code from my list view row item is this:
CODE:...............
Then my res/drawable/action_box.xml is this:
CODE:................
View 1 Replies
View Related
Apr 14, 2010
I need to render video on android. I got sw decoder which decodes stream to YUV or RGB with very reasonable cpu usage, but so far haven't found a nice way how to render frames.
I have tried 3 methods so far: 1) using opengl from native code: * create a texture of type GL_TEXTURE_2D * set coordinates to fill full opengl rendering area * to render a frame update the texture with glTexSubImage2D or glTexImage2D function (more or less the same method that is used in vlc media player)
With this method the performance is most terrible.. VGA rendering @5..7FPS uses up 100% of nexus one cpu!
2) rendering with canvas function Canvas.drawBitmap(int[] colors, int offset, int stride, int x, int y, int width, int height, boolean hasAlpha, Paint paint)Was hoping to use this via JNI. First i just made a simple perfo test: * colors array was initialized in java code * then I just called mSurfaceHolder.lockCanvas(); canvas.drawBitmap(colors, ... ); mSurfaceHolder.unlockCanvasAndPost(canvas); in sequence
Perfo is better than with opengl - VGA@30FPS uses up 40% of nexus one- s cpu...
3) Rendering with canvas function Canvas.drawBitmap(Bitmap bitmap, float left, float top, Paint paint), while updating bitmap in native code * in java code i do:
CODE:.......
To get native pointer to memory (need to link to native android library libskia.so to get these functions) * copy or decode the video frame to this memory
With this method i get only 10% cpu usage when doing VGA@30fps... but lets face it - its a hack which may break in future. Am I missing something or there really isn't any better way to render video? for example some opengl extension function etc..?
View 2 Replies
View Related
Jun 15, 2010
When trying to process this png image, webkit displays it blurry.
View 2 Replies
View Related
Mar 26, 2014
I have an Android app with a C++ library which uses pthreads to break down rendering tasks. This is for devices running Android 4+.
Lets say I have a 100 x 100 array of elements into which I repetitively do CPU-intensive processing. Currently I'm breaking the array up into four 25 x 100 element chunks and handing it off to four Posix threads (from a pool of stalled, pre-created threads). This gives an almost 4x speed increase on iOS and desktop Mac but slower results than single-threading under Android.
So the same code is used successfully to speed up the app on iOS or desktop Mac but in Android it often makes it even slower. I have done some tests on it and only quite big junks of data speed up when using multi threading. If the whole process (all threads) takes around 2 seconds or more it will speed up in multi threading mode but if it is less (say only takes about 400ms) it will be either the same speed or slower than just calling the rendering function normally. Which could point to thread switching being really slow. The bigger the processing tasks, the more they profit from multithreading. My tasks are usually not as big, but not fast enough in single threading mode.
I have also noticed that on ARM builds the speed difference between slower multi threading and the faster single threading is quite significant (almost twice as fast in multi threading rather than single threading) whereas on x86 builds the multi and single threaded versions will run at about the same speed as single threading on ARM builds. So x86 builds do not get slower on multithreading but also not faster.
View 1 Replies
View Related
Aug 26, 2013
how to add quick setting tile in statusbar?
View 1 Replies
View Related
Jul 1, 2010
I'm currently developing my first android app, and my first game. I've been developing on a netbook with a CliqXT (HVGA). Things are going well, it renders perfectly on the smaller screen. I knew I'd have some issues when rendering on larger screens, but the issues I'm having are not what I was expecting and I'm kind of stuck.
So basically the game consists of a main SurfaceView which I'm rendering the tiled game world on to. I followed this tutorial to get started, and my structure is still pretty similar except that it calculates the boundries based on the player location:
http://www.droidnova.com/create-a-scrollable-map-with-cells-part-i,654.html
The game also has various buildings the player can enter. Upon entering it launches another activity for that particular building. The building activities are just normal Views with Android UI stuff defined in XML (Buttons, TextViews, etc).
What I expected to happen:
So I expected the the building UIs to render correctly on the larger screen. I specified all dimensions in "dp" and fonts in "sp" in hopes that they'd scale correctly. I expected the actual game tilemap to render generally correctly, but maybe be really tiny due to the higher resolution / dpi. I'm using a very similar function to the tutorial linked above (calculateLoopBorders(), my version is pasted below) to calculate how many tiles to render based on screen height and width (getHeight() and getWidth()).
What is actually happening:
The whole game is just being rendered as if it's HVGA. The tilemap, and the building UIs are just scaled down to the smaller screen size, leaving black borders around the left, right, and bottom (see images).
View 2 Replies
View Related
Oct 27, 2009
From the adb log of my G1's boot time, it shows "requestGPU returned -1", among other stuff. Does this mean that my OpenGL app is being rendered using software? BTW, I see the same messages on Hero as well.
------------------------------------------ log begin ------------------------------------------
I/SurfaceFlinger( 81): SurfaceFlinger is starting I/SurfaceFlinger( 81): SurfaceFlinger's main thread ready to run. Initializing graphics H/W... D/SurfaceFlinger( 81): pid 81 requesting gpu core (owner = -1) W/SurfaceFlinger( 81): couldn't grant gpu core to pid 81 D/EGL ( 81): requestGPU returned -1 E/libEGL ( 81): h/w accelerated eglGetDisplay() failed (EGL_SUCCESS) I/SurfaceFlinger( 81): EGL informations: I/SurfaceFlinger( 81): # of configs : 6 I/SurfaceFlinger( 81): vendor : Android I/SurfaceFlinger( 81): version : 1.31 Android META-EGL I/SurfaceFlinger( 81): extensions: I/SurfaceFlinger( 81): Client API: OpenGL ES I/EGLDisplaySurface( 81): using (fd=19) I/EGLDisplaySurface( 81): .......
View 2 Replies
View Related
Sep 9, 2010
What is a rendering engine? Is there any for Android?
View 1 Replies
View Related
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
Apr 15, 2010
I'm in the following situation: I have a large bitmap (~1280x1024) that I'd like to display on screen, scaled down in a view that fits the phone's screen (~480x320). This bitmap is frequently updated (couple of tiles per frame at 15 FPS). I first wanted to implement the rendering with a SurfaceView but figured out that all the scaling would be done in software due to limitations in the Android SDK. The second solution would be to load and render textures in an OpenGL context. Would that accelerate the resizing? If yes, isn't the cost of loading textures going to offset what I'll win on the scaling side?
View 2 Replies
View Related
Jun 10, 2013
I was wondering why Android keeps lagging a bit. I mean, quadcore should be fast enough to stop that from happening right? So I started Googling.
I got this article: [URL] .....
Basically it says this: Android's UI rendering thread does not work in real-time (the priority is not set at that), unlike iOS'. It's just about the one thing that's still better about iOS in my opinion.
How to make this thread render in real-time?
View 1 Replies
View Related
Nov 27, 2010
I recently activated timecape and the Sony logo on my homepage was replaced with timescape stuff. How do I turn off timescape or more importantly how to get the Sony Ericsson tile back on my homepage?
View 1 Replies
View Related
Aug 4, 2010
I would really like to remove the timescape tile from my home page. I have some lovely pictures of my boys that I want to us as my wallpaper / display but timescape is right in the way.
View 2 Replies
View Related
Apr 7, 2010
Just got my Xperia X10 & I've already done that! Anyone got any idea why it wont like go away? Its connected up to the internet, facebooks set up etc contacts are all there
View 1 Replies
View Related
Nov 10, 2013
PAC-man ROM
Settings -> PAC-man -> Notification Drawer -> Tiles and layout
It allows me to add / remove tile. However, the quick settings remains unchanged.
Is there any way to fix this?
View 2 Replies
View Related
Sep 21, 2013
There's any app/widget that allows to display a live tile of images from gallery (or any other path) like the one found in launcher8?
View 1 Replies
View Related
Jun 15, 2009
I want to render 3d object on the screen. Before that I would like to compute the screen so that the rendered object can be given relative position. How that can be done?
View 2 Replies
View Related
Sep 13, 2010
For some reason the onPageFinished is firing before the WebView has finished loading -
I can't figure out why...
CODE:.............................
View 3 Replies
View Related
Apr 14, 2013
Is it possible to force specific apps to render themselves in smaller resolution than the native (device's) one and telling the device to rescale them? I'm talking specifically about old Gameloft games that don't work on new devices anymore due to no xhdpi support.
I managed to run Modern Combat 2 on LG Nexus 4 (mako) but it has severe bugs with touch area and aiming that make the game unplayable.
I wouldn't mind playing this game in lower resolution rescaled to fit the entire screen as long as it would actually work (MC2 has smoother gameplay than any other game in the series + smaller maps = better multiplayer experience when there is not much time to play).
View 1 Replies
View Related