Android :: PNG Transparency And OpenGL ES
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
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
Jul 14, 2010
I would like to change the transparency of a whole View in Android. How can I do that? The View has a nontransparent background.
View 2 Replies
View Related
Mar 20, 2010
Is there a way to set the Astrid widget to be partially transparent/translucent? I'd like it to let some of the background show through like the default search widget and the default calendar widget.
View 5 Replies
View Related
Mar 3, 2010
why is the transparency for drawables attached to ImageButtons not honoured? i have to change them to ImageViews so they look right.
View 5 Replies
View Related
Feb 1, 2010
I need to set initial transparency for a TextView but I don't know how to do it. On iPhone it can be done easily with alpha property. I've tried to set alpha using AlphaAnimation but no good it doesn't work. It just returns to 100% alpha when it ends.
CODE:................
View 2 Replies
View Related
Apr 2, 2010
I am having problems getting transparency to work well on an ImageView. The images at(http://img265.imageshack.us/img265/6233/whatn.png) were screen captured from a Droid (hdpi). The top image I made in Photoshop and left the background white. The bottom image is the same image with the background transparent and the layout's color (white) shows through. Whenever I have transparent backgrounds in images it dithers shadows like this. Also, it only happens on hdpi devices, on my G1 (mdpi) it looks just fine. What is going on? How can I make the bottom image look as good as the top one?
View 1 Replies
View Related
Apr 25, 2009
I have a lot of Views where I have set a background image on the top LinearLayout and then I have nested a new linear layout below with a background that is semi-transparent. This works great in 1.1, but in 1.5 the transparency is just disregarded and this breaks my app as the text on top is now unreadable.
Is this a bug or a feature? Is there a better way of doing this? Very grateful for any tips!
Code example:
CODE:....................
View 13 Replies
View Related
Nov 19, 2010
Basically I have a fully functional ogl program (2D game) in opengl es 1.1, everything works fine except for one problem: glcolor
I'm trying to set some of my texture to half transparent and I would like to do it as follows;
gl.glColor4f(1f, 1f, 1f, .5f);
obj.draw(gl);
...
gl.glColor4f(1f, 1f, 1f, 1f);
I'm using VBO for my vertice, my textures and indices. (if that is relevant)
the problem is that nothing gets set to 50% transparency...
I'm don't think relevant to post all my code (mainly because it is spread out several classes with several GL options changing (blends, scissors etc etc).
What I would like is for people to tell me what state of OGL could prevent glcolor form working like I want, what functions should I check, what state should I call.
View 1 Replies
View Related
Jun 22, 2009
I have tried to replicate the Transparency/Translucency effects created in the API Demo(which works flawlessly) and the code i wrote works on the emulator but not on my actual device(Google ION)I copied the styles and colors.xml files from the API demos code and set the theme of my activity I want to be transparent to "@style/ Theme.Transparent" in my activity i set my content view to a layout which contains only a TextView containing : <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_vertical|center_horizontal" android:text="should have transparent background" /> i have also tried setting the theme using: setTheme (R.style.Theme_Transparent).
View 2 Replies
View Related
Oct 17, 2009
Anyone know if you can make part (i.e. a section which you could measure in pixels) of an image transparent? What graphics features would I need to look at?
View 4 Replies
View Related
Apr 4, 2010
To explain i have a bitmap which is constructed as follows
Paint a rectangle color yellow I want now to paint a smaller circle over the top of the rectangle, but i want to use transparency. so that the circle results as a hole in the rectangle. {like swiss cheese with holes }
So if i painted the bitmap over a background the background would still be visible in the Circle/hole.
setting the drawcolor drawColor(Color.TRANSPARENT) just paints a transparent object. i.e. it doesn't erase the circle area of the rectangle.
How to do...?
One option is to set the circle color to say black and then look for an option to replace black with transparent within the bitmap.... but i can't find a solution for this either.
View 5 Replies
View Related
Aug 7, 2009
When applying an alpha value to an imageview, Eclipse displays the view accurately in layout mode. But when exporting to a target device (such as a phone), the alpha appears to be ignored. This impacts developers trying to create fade ins/outs of elements in a widget. Has anyone else come across this issue yet? Not sure if this behavior is by design or by error.
View 2 Replies
View Related
Jul 19, 2013
I want to edit the transparency in my statusbar (Stock Gingerbread 2.3.5), I read I had to edit in systemui.apk value/drawable.xml. But I only get hide the status bar, really nice, but isn't what i want. I am editing the wrong file.
View 1 Replies
View Related
Jul 31, 2012
How to remove transperency from themes and roms. Galaxy s3
View 1 Replies
View Related
Jun 4, 2014
How to make statusbar transparent only in home launcher and opaque in other apps just like in MIUI.
How can I make the statusbar bg function like in MIUI?
View 1 Replies
View Related
Nov 17, 2009
I got tired of the messing with the people widget so I created shortcuts to people. I have a couple of folders that I put these shortcuts into, one for texting and one for calling. Is there any setting to change the transparency of the folder?
View 3 Replies
View Related
May 24, 2012
I'm looking for a camera app that displays a picture on my screen in transparency when taking another picture with the camera of the phone in order to do the same pic as done before ...
Any app already exists ? Or is there a tip to do this ? Taking a picture with a printed photo in the other hand is not very effective.
View 1 Replies
View Related
May 12, 2013
Is it possible for a Nova theme to make notifier bar and bottom bar (with home back and recent apps) 100% transparency or would that have to be built into the launcher.
If it is possible does such a theme exist?
View 4 Replies
View Related
Aug 24, 2010
Is there a way to load an image file into an ImageView object, and then define a transparent color for this object?
View 1 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
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