[android-developers] Re: OpenGL ES loading textures after onSurfaceChanged
> > HI, please i need your help i want to put my object 3d that i import in android with min3d library in canvas but i don't know how ,i want to make it a custom view . safa -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/fd8cd150-7baa-4bfa-87e1-9de5ab667d67%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] Re: OpenGL Tracer not working with a Nexus 7?
I'm also seeing the same problem with a Galaxy Nexus, just like this guy: http://stackoverflow.com/questions/15317083/android-opengl-tracer-not-working :( Anyone have any idea? On Monday, March 18, 2013 2:05:41 PM UTC-4, Digipom wrote: Hello, I have a Nexus 7 running 4.2.2. I'm trying to trace an OpenGL ES 2.0 application, but I can never seem to get OpenGL ES Tracer to work. I'm following the instructions here: http://developer.android.com/tools/help/gltracer.html The tracer seems to load fine, and when I put in the package and activity class, the right application is launched and the activity starts, and Tracer says that it's tracing. However, the size always stays at 0MB and the trace file remains at 0 bytes. Occasionally I'll see a socket write error right away, but usually I won't. If I then click Enable next to Collect Framebuffer contents on glDraw*(), then I always see a Connection reset by peer: socket write error error message. I'd really like to get this to work. I played around with different settings in the Developer options to no avail. I even tried on OS X in case it was a Windows issue, and I had the same problems there. Thanks! https://lh6.googleusercontent.com/-Cjjc0k7qa2g/UUdW6TKRDcI/AAM/s1q3j4RZat8/s1600/socket-write-error.png https://lh6.googleusercontent.com/-va1y14LW0y8/UUdXENDe2PI/AAc/SzoBs9P33cs/s1600/socket-write-error-2.png -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: OpenGL regular
I don't think so. OpenGL ES isn't so much training wheels as it is a design paradigm- its about maximizing speed over extra features. Even major, highpowered platforms (like the Playstation 3) still use OpenGL ES despite, to the best of my knowledge, having the computing power to run OpenGL. I also haven't heard any indication from Google devs that they're going to bring it back. That being said, you could look through OpenGL implementation source code to just port the extras straight to the device. See how other platforms implement the accum buffer and then run that source code in your program. On Wednesday, December 26, 2012 9:21:42 AM UTC-8, bob wrote: When mobile devices get more powerful, will it ever make sense for Android to simply support OpenGL instead of just OpenGL ES? I wouldn't mind being able to use the accum buffer and other regular OpenGL features. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL regular
I'm not sure if that would be useful. From what I've read, OpenGL ES is actually more modern and streamlined and loses a lot of the crud that OpenGL has gained over the years. In effect it's a cleaner more modern implementation anyway. On Wednesday, December 26, 2012 11:21:42 AM UTC-6, bob wrote: When mobile devices get more powerful, will it ever make sense for Android to simply support OpenGL instead of just OpenGL ES? I wouldn't mind being able to use the accum buffer and other regular OpenGL features. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: opengl and requestRender update order
See below: On Tuesday, September 4, 2012 3:45:27 PM UTC+1, guich wrote: Hi, I'm changing a program from standard graphics to opengl. The way that my program behave was: 1. Update internal bitmap information. 2. Draw on the offscreen. 3. Draw the offscreen image on screen. On opengl, i just noticied that anything that you draw before calling requestRender is IGNORED. My idea was to first send opengl commands and then request opengl's surface to draw these. Is there a way to let it work like this? Which version of OpenGL ES are you targeting? Another way to look at the problem: suppose two threads are updating part of the screen using opengl. OpenGL ES does not support 2 threads using the same context. Context sharing between threads is possible on some devices but is not supported on all. How exactly can one thread update the part of the screen that it is drawing, leaving the other part untouched? Only draw on the part of the screen that you need to update. thanks guich -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: opengl and requestRender update order
Hi, I'm using GLES20. I'm not sure about how the opengl es 2 works. For me, the requestRender should update the screen with the contents sent by the last opengl commands. However, it seems to do the opposite: start looking for commands and then (at some misterious moment), update the screen. thanks guich -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: opengl and requestRender update order
I just realized that i'm doing the GLES20 commands in a thread that is not the ui thread. Are there any requirements about this? Actually, all my gles commands are done natively. thx guich -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: opengl and requestRender update order
Reading in the web i found that only one context can be used in a single thread. So, its not possible to use opengl outside the ui thread. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: opengl and requestRender update order
All OpenGL calls should be made from the callbacks in your class that implements the GLSurfaceView.Renderer interface http://developer.android.com/reference/android/opengl/GLSurfaceView.Renderer.html Your drawing code should be in your onDrawFrame() implementation. On Tuesday, September 4, 2012 8:23:20 PM UTC+1, guich wrote: Reading in the web i found that only one context can be used in a single thread. So, its not possible to use opengl outside the ui thread. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL using multiple classes
Resolved. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL using multiple classes
You have an infinite loop, and you're getting a stack overflow. In BlaRenderer, you create a new Player object: Player player = new Player(); Since it inherits from BlaRenderer, it tries to create a new Player object: Player player = new Player(); Since it inherits from BlaRenderer, it tries to create a new Player object: Player player = new Player(); This continues until you are out of stack space. One solution: Remove this line from BlaRenderer: Player player = new Player(); On Wednesday, August 15, 2012 7:37:03 PM UTC-5, Braindrool wrote: I've been programming for years, but I have very little experience with 3D graphics. I thought OpenGL would be the most efficient in this project. It's coming along alright, I am still studying the API and documentation. But I have encountered a problem using multiple classes. For instance, here I try to use a separate class for the player model. (Yes, currently it's just a cube.) Renderer: Code: package com.braindrool.bla; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.nio.ShortBuffer; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; import android.opengl.GLSurfaceView.Renderer; public class BlaRenderer implements Renderer { int nrOfVertices; float A; Player player = new Player(); public void onSurfaceCreated(GL10 gl, EGLConfig config) { // TODO Auto-generated method stub gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY); gl.glEnable(GL10.GL_CULL_FACE); gl.glFrontFace(GL10.GL_CCW); gl.glCullFace(GL10.GL_BACK); gl.glClearColor(0.3f, 0.8f, 0.9f, 1); // initTriangle(); player.initPlayer(); } public void onDrawFrame(GL10 gl) { // TODO Auto-generated method stub gl.glLoadIdentity(); gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // gl.glRotatef(A * 2, 1f, 0f, 0f); // gl.glRotatef(A, 0f, 1f, 0f); // // gl.glColor4f(0.5f, 0, 0, 1); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); gl.glColorPointer(4, GL10.GL_FLOAT, 0, colorBuffer); gl.glDrawElements(GL10.GL_TRIANGLES, nrOfVertices, GL10.GL_UNSIGNED_SHORT, indexBuffer); // A++; } public void onSurfaceChanged(GL10 gl, int width, int height) { // TODO Auto-generated method stub gl.glViewport(0, 0, width, height); } private FloatBuffer vertexBuffer; private ShortBuffer indexBuffer; private FloatBuffer colorBuffer; private void initTriangle() { float[] coords = { 0, 0.5f, 0, -0.5f, -0.5f, 0.5f, 0.5f, -0.5f, 0.5f, 0, 0, -0.5f }; nrOfVertices = coords.length; ByteBuffer vbb = ByteBuffer.allocateDirect(nrOfVertices * 3 * 4); vbb.order(ByteOrder.nativeOrder()); vertexBuffer = vbb.asFloatBuffer(); ByteBuffer ibb = ByteBuffer.allocateDirect(nrOfVertices * 2); ibb.order(ByteOrder.nativeOrder()); indexBuffer = ibb.asShortBuffer(); ByteBuffer cbb = ByteBuffer.allocateDirect(4 * nrOfVertices * 4); cbb.order(ByteOrder.nativeOrder()); colorBuffer = cbb.asFloatBuffer(); float[] colors = { 1f, 0f, 0f, 1f, // point 1 0f, 1f, 0f, 1f, // point 2 0f, 0f, 1f, 1f, // point 3 }; short[] indices = new short[] { // indices 0, 1, 2, 0, 2, 3, 0, 3, 1, 3, 1, 2 }; vertexBuffer.put(coords); indexBuffer.put(indices); colorBuffer.put(colors); vertexBuffer.position(0); indexBuffer.position(0); colorBuffer.position(0); } } And now the player class. Code: package com.braindrool.bla; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.nio.ShortBuffer; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; public class Player extends BlaRenderer{ private FloatBuffer vertexBuffer; private ShortBuffer indexBuffer; private FloatBuffer colorBuffer; private int nrOfVertices; float A; public void initPlayer() { float[] coords = { -0.5f, 0.5f, 0, // P0 -0.5f, 0, 0, // P1 0.5f, 0, 0, // P2
[android-developers] Re: OpenGL using multiple classes
I think you are overestimating my knowledge of Java. I don't quite understand how to incorporate multiple classes. How do I include my initPlayer() function? On Wednesday, August 15, 2012 7:37:03 PM UTC-5, Braindrool wrote: I've been programming for years, but I have very little experience with 3D graphics. I thought OpenGL would be the most efficient in this project. It's coming along alright, I am still studying the API and documentation. But I have encountered a problem using multiple classes. For instance, here I try to use a separate class for the player model. (Yes, currently it's just a cube.) Renderer: Code: package com.braindrool.bla; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.nio.ShortBuffer; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; import android.opengl.GLSurfaceView.Renderer; public class BlaRenderer implements Renderer { int nrOfVertices; float A; Player player = new Player(); public void onSurfaceCreated(GL10 gl, EGLConfig config) { // TODO Auto-generated method stub gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY); gl.glEnable(GL10.GL_CULL_FACE); gl.glFrontFace(GL10.GL_CCW); gl.glCullFace(GL10.GL_BACK); gl.glClearColor(0.3f, 0.8f, 0.9f, 1); // initTriangle(); player.initPlayer(); } public void onDrawFrame(GL10 gl) { // TODO Auto-generated method stub gl.glLoadIdentity(); gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // gl.glRotatef(A * 2, 1f, 0f, 0f); // gl.glRotatef(A, 0f, 1f, 0f); // // gl.glColor4f(0.5f, 0, 0, 1); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); gl.glColorPointer(4, GL10.GL_FLOAT, 0, colorBuffer); gl.glDrawElements(GL10.GL_TRIANGLES, nrOfVertices, GL10.GL_UNSIGNED_SHORT, indexBuffer); // A++; } public void onSurfaceChanged(GL10 gl, int width, int height) { // TODO Auto-generated method stub gl.glViewport(0, 0, width, height); } private FloatBuffer vertexBuffer; private ShortBuffer indexBuffer; private FloatBuffer colorBuffer; private void initTriangle() { float[] coords = { 0, 0.5f, 0, -0.5f, -0.5f, 0.5f, 0.5f, -0.5f, 0.5f, 0, 0, -0.5f }; nrOfVertices = coords.length; ByteBuffer vbb = ByteBuffer.allocateDirect(nrOfVertices * 3 * 4); vbb.order(ByteOrder.nativeOrder()); vertexBuffer = vbb.asFloatBuffer(); ByteBuffer ibb = ByteBuffer.allocateDirect(nrOfVertices * 2); ibb.order(ByteOrder.nativeOrder()); indexBuffer = ibb.asShortBuffer(); ByteBuffer cbb = ByteBuffer.allocateDirect(4 * nrOfVertices * 4); cbb.order(ByteOrder.nativeOrder()); colorBuffer = cbb.asFloatBuffer(); float[] colors = { 1f, 0f, 0f, 1f, // point 1 0f, 1f, 0f, 1f, // point 2 0f, 0f, 1f, 1f, // point 3 }; short[] indices = new short[] { // indices 0, 1, 2, 0, 2, 3, 0, 3, 1, 3, 1, 2 }; vertexBuffer.put(coords); indexBuffer.put(indices); colorBuffer.put(colors); vertexBuffer.position(0); indexBuffer.position(0); colorBuffer.position(0); } } And now the player class. Code: package com.braindrool.bla; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.nio.ShortBuffer; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; public class Player extends BlaRenderer{ private FloatBuffer vertexBuffer; private ShortBuffer indexBuffer; private FloatBuffer colorBuffer; private int nrOfVertices; float A; public void initPlayer() { float[] coords = { -0.5f, 0.5f, 0, // P0 -0.5f, 0, 0, // P1 0.5f, 0, 0, // P2 0.5f, 0.5f, 0, // P3 0.5f, 0.5f, 0.5f, // P4 -0.5f, 0.5f, 0.5f, // P5 -0.5f, 0, 0.5f, // P6 0.5f, 0, 0.5f // P7 }; nrOfVertices = coords.length;
[android-developers] Re: OpenGL ES on Camera Preview
I ran your code. I think it was working. Then it crashed: 08-07 19:44:05.724: W/CameraView(5786): Exception: 08-07 19:44:05.724: W/CameraView(5786): java.lang.RuntimeException: setParameters failed 08-07 19:44:05.724: W/CameraView(5786): at android.hardware.Camera.native_setParameters(Native Method) 08-07 19:44:05.724: W/CameraView(5786): at android.hardware.Camera.setParameters(Camera.java:1468) 08-07 19:44:05.724: W/CameraView(5786): at com.example.cameratest.CameraView.surfaceChanged(CameraView.java:33) 08-07 19:44:05.724: W/CameraView(5786): at android.view.SurfaceView.updateWindow(SurfaceView.java:586) 08-07 19:44:05.724: W/CameraView(5786): at android.view.SurfaceView.access$000(SurfaceView.java:81) 08-07 19:44:05.724: W/CameraView(5786): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:169) 08-07 19:44:05.724: W/CameraView(5786): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:590) 08-07 19:44:05.724: W/CameraView(5786): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1829) 08-07 19:44:05.724: W/CameraView(5786): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2658) 08-07 19:44:05.724: W/CameraView(5786): at android.os.Handler.dispatchMessage(Handler.java:99) 08-07 19:44:05.724: W/CameraView(5786): at android.os.Looper.loop(Looper.java:137) 08-07 19:44:05.724: W/CameraView(5786): at android.app.ActivityThread.main(ActivityThread.java:4514) 08-07 19:44:05.724: W/CameraView(5786): at java.lang.reflect.Method.invokeNative(Native Method) 08-07 19:44:05.724: W/CameraView(5786): at java.lang.reflect.Method.invoke(Method.java:511) 08-07 19:44:05.724: W/CameraView(5786): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980) 08-07 19:44:05.724: W/CameraView(5786): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747) 08-07 19:44:05.724: W/CameraView(5786): at dalvik.system.NativeStart.main(Native Method) On Tuesday, August 7, 2012 7:36:30 AM UTC-5, Tobias Reich wrote: Hello everyone, I have some serious problems with my GL SurfaceView rendering on a Camera-Preview. The transparent pixels/fragments I rasterize are giving wrong colors. Since I'm not sure if my phone has a problem (it is working on the S1 and the S2 but not the Galaxy S3) I wanted to ask anyone here to try my code. Would you please do this for me and tell me at least if it works or not. Or perhaps if you have the same problem, we may find a solution for this. Thank you very much! Tobias P.S. You can find an image that shows my problem here: https://dl.dropbox.com/u/13527005/glProblem.jpg and if you don't want to compile my Test-Project you may find an apk here: https://dl.dropbox.com/u/13527005/CameraGLTest.apk Please help me! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL and Camera Problem
Seemed like it was working on the Galaxy S3, then another crash: W/CameraView( 6405): Exception: W/CameraView( 6405): java.lang.RuntimeException: setParameters failed W/CameraView( 6405): at android.hardware.Camera.native_setParameters(Native Method) W/CameraView( 6405): at android.hardware.Camera.setParameters(Camera.java:1468) W/CameraView( 6405): at com.example.cameratest.CameraView.surfaceChanged(CameraView.java:34) W/CameraView( 6405): at android.view.SurfaceView.updateWindow(SurfaceView.java:586) W/CameraView( 6405): at android.view.SurfaceView.access$000(SurfaceView.java:81) W/CameraView( 6405): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:169) W/CameraView( 6405): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:590) W/CameraView( 6405): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1829) W/CameraView( 6405): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2658) W/CameraView( 6405): at android.os.Handler.dispatchMessage(Handler.java:99) W/CameraView( 6405): at android.os.Looper.loop(Looper.java:137) W/CameraView( 6405): at android.app.ActivityThread.main(ActivityThread.java:4514) W/CameraView( 6405): at java.lang.reflect.Method.invokeNative(Native Method) W/CameraView( 6405): at java.lang.reflect.Method.invoke(Method.java:511) W/CameraView( 6405): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980) W/CameraView( 6405): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747) W/CameraView( 6405): at dalvik.system.NativeStart.main(Native Method) On Tuesday, August 7, 2012 4:12:53 PM UTC-5, Tobias Reich wrote: Hello together, I recently reported about a problem with my OpenGl ES Scene drawn on top of a camera preview on my Galaxy S3. I made a second test and tried it with OpenGL1.0 Still, the colors of transparent fragments don't match. Has anyone any idea about that? What changed? After all on my S1 and my S2 everything works fine, even if I create a GLSurfaceView on top of my Camera Preview. I attached my project so everyone can try. Thanks for your help, Tobias -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES on Camera Preview
Huh, sorry, might be that I made a mistake when compiling. Please try it again. Do you have a Galaxy S3? And there are no distortions in the lower grey area? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL and Camera Problem
Huh, that is strange. So it worked and than it crashed? And it looks like it was crashing at the setParameters(); That is a place where it shoudln't crash at all!! Which Android Version do you have? Did you take the complete project? So there is no mistake in the Manifest (e.g. for the Camera rights)? Thank you anyway. I just got some other replys that it didn't work on other phones as well. So I wonder what was changed. Does anyone know a working Augmented Reality App for the S3? Anyway, thank you for your help, Tobias -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL Button
You have already asked this and got an answer from a Android framework engineer https://groups.google.com/d/msg/android-developers/boL9eyiFtWI/7tRSfT8a7-0J On Wednesday, August 1, 2012 10:01:08 PM UTC+1, bob wrote: So, I want to make a button that uses OpenGL effects. I was thinking of deriving from Button. Then, I thought of deriving from GLSurfaceView. However, I can't derive from both. Any ideas? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Opengl ES scaling (zoom out) shows rare square tiles on my textures. How to avoid it?
I tryed it, it is not the solution El sábado, 21 de abril de 2012 20:23:26 UTC+2, Nightwolf escribió: Change zNear and zFar parameters in GLU.gluPerspective(gl, 45.0f, (float)width / (float)height, 0.1f, 100.0f) to 1 and 1000. If it helps then your square is near far clipping plane. пятница, 20 апреля 2012 г., 19:41:54 UTC+4 пользователь saex написал: Hi I'm displaying a OPENGL ES 1.X square with a texture, and the user can zoom in and out the square scaling it. When the user zoom's out the square (the square get's scaled going smaller in the screen) the texture of the square get's rare translucent squares, like tiles from googlemaps. I think that the scaling function from OpenGL is now working in the better way. How can i improve it? These are my OpenGL GLSurfaceView main functions: public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glDisable(GL10.GL_DITHER); //dithering OFF gl.glEnable(GL10.GL_TEXTURE_2D);//Texture Mapping ON gl.glShadeModel(GL10.GL_SMOOTH);//Smooth Shading gl.glClearDepthf(1.0f); //Depth Buffer Setup gl.glEnable(GL10.GL_DEPTH_TEST);//Depth Testing ON gl.glDepthFunc(GL10.GL_LEQUAL); gl.glClearColor(0,0,0,0); //fondo transparente gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); //Cargamos la textura del cubo. for (int i=0;isquares.size();i++){ if (squares.get(i)!=null) squares.get(i).loadGLTexture(gl, context); } } public void onDrawFrame(GL10 gl) { //Limpiamos pantalla y Depth Buffer gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); mg.getCurrentProjection(gl); //volvemos a generar las matrices por que es un bucle mg.getCurrentModelView(gl); . . . . gl.glTranslatef(X, Y, Z); //Move z units into the screen gl.glRotatef(zrot, 0.0f, 0.0f, 1.0f); //Z gl.glScalef(scale, scale, 1.0f); for (int i=0;isquares.size();i++){ if (squares.get(i)!=null) squares.get(i).draw(gl); //Draw the Cube } } public void onSurfaceChanged(GL10 gl, int width, int height) { if(height == 0) { //Prevent A Divide By Zero By height = 1; //Making Height Equal One } gl.glViewport(0, 0, width, height); //Reset The Current Viewport gl.glMatrixMode(GL10.GL_PROJECTION);//Select The Projection Matrix gl.glLoadIdentity();//Reset The Projection Matrix //Calculate The Aspect Ratio Of The Window GLU.gluPerspective(gl, 45.0f, (float)width / (float)height, 0.1f, 100.0f); gl.glMatrixMode(GL10.GL_MODELVIEW); //Select The Modelview Matrix gl.glLoadIdentity();//Reset The Modelview Matrix } and these are my square polygon class main functions: public void draw(GL10 gl) { gl.glFrontFace(GL10.GL_CCW); //Bind our only previously generated texture in this case gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); //Point to our vertex buffer gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer); //Enable vertex buffer gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); //Draw the vertices as triangle strip gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 3); //Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); } //Carga de texturas public void loadGLTexture(GL10 gl, Context context) { //Generamos un puntero de texturas gl.glDeleteTextures(1, textures, 0); //libero memoria gl.glGenTextures(1, textures, 0); //y se lo asignamos a nuestro array gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); //Creamos filtros de texturas 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_LINEAR); //Diferentes parametros de textura posibles GL10.GL_CLAMP_TO_EDGE gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT); //Usamos Android GLUtils para espcificar una textura de 2 dimensiones para nuestro bitmap GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); //Checkeamos si el GL context es versión 1.1 y generamos los Mipmaps por Flag.
[android-developers] Re: Opengl ES scaling (zoom out) shows rare square tiles on my textures. How to avoid it?
Change zNear and zFar parameters in GLU.gluPerspective(gl, 45.0f, (float)width / (float)height, 0.1f, 100.0f) to 1 and 1000. If it helps then your square is near far clipping plane. пятница, 20 апреля 2012 г., 19:41:54 UTC+4 пользователь saex написал: Hi I'm displaying a OPENGL ES 1.X square with a texture, and the user can zoom in and out the square scaling it. When the user zoom's out the square (the square get's scaled going smaller in the screen) the texture of the square get's rare translucent squares, like tiles from googlemaps. I think that the scaling function from OpenGL is now working in the better way. How can i improve it? These are my OpenGL GLSurfaceView main functions: public void onSurfaceCreated(GL10 gl, EGLConfig config) { gl.glDisable(GL10.GL_DITHER); //dithering OFF gl.glEnable(GL10.GL_TEXTURE_2D);//Texture Mapping ON gl.glShadeModel(GL10.GL_SMOOTH);//Smooth Shading gl.glClearDepthf(1.0f); //Depth Buffer Setup gl.glEnable(GL10.GL_DEPTH_TEST);//Depth Testing ON gl.glDepthFunc(GL10.GL_LEQUAL); gl.glClearColor(0,0,0,0); //fondo transparente gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); //Cargamos la textura del cubo. for (int i=0;isquares.size();i++){ if (squares.get(i)!=null) squares.get(i).loadGLTexture(gl, context); } } public void onDrawFrame(GL10 gl) { //Limpiamos pantalla y Depth Buffer gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); mg.getCurrentProjection(gl); //volvemos a generar las matrices por que es un bucle mg.getCurrentModelView(gl); . . . . gl.glTranslatef(X, Y, Z); //Move z units into the screen gl.glRotatef(zrot, 0.0f, 0.0f, 1.0f); //Z gl.glScalef(scale, scale, 1.0f); for (int i=0;isquares.size();i++){ if (squares.get(i)!=null) squares.get(i).draw(gl); //Draw the Cube } } public void onSurfaceChanged(GL10 gl, int width, int height) { if(height == 0) { //Prevent A Divide By Zero By height = 1; //Making Height Equal One } gl.glViewport(0, 0, width, height); //Reset The Current Viewport gl.glMatrixMode(GL10.GL_PROJECTION);//Select The Projection Matrix gl.glLoadIdentity();//Reset The Projection Matrix //Calculate The Aspect Ratio Of The Window GLU.gluPerspective(gl, 45.0f, (float)width / (float)height, 0.1f, 100.0f); gl.glMatrixMode(GL10.GL_MODELVIEW); //Select The Modelview Matrix gl.glLoadIdentity();//Reset The Modelview Matrix } and these are my square polygon class main functions: public void draw(GL10 gl) { gl.glFrontFace(GL10.GL_CCW); //Bind our only previously generated texture in this case gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); //Point to our vertex buffer gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer); //Enable vertex buffer gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); //Draw the vertices as triangle strip gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 3); //Disable the client state before leaving gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); } //Carga de texturas public void loadGLTexture(GL10 gl, Context context) { //Generamos un puntero de texturas gl.glDeleteTextures(1, textures, 0); //libero memoria gl.glGenTextures(1, textures, 0); //y se lo asignamos a nuestro array gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); //Creamos filtros de texturas 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_LINEAR); //Diferentes parametros de textura posibles GL10.GL_CLAMP_TO_EDGE gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT); //Usamos Android GLUtils para espcificar una textura de 2 dimensiones para nuestro bitmap GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); //Checkeamos si el GL context es versión 1.1 y generamos los Mipmaps por Flag. Si no, llamamos a nuestra propia implementación if(gl instanceof GL11) {
[android-developers] Re: OpenGL lockups in 2.2
We just did a big profiling, optimizing and tuning session on our engine and found that we had LOTS of redundant Shader and Geometry binds and unbinds. We found that we never need to unbind from shaders or disable vertex attributes because they are automatically all disabled when switching shaders - then we made it so that glGetError is only called when we have our debugging flags on... Result? The game that was crashing instantly on the EVO now runs without any problems until the battery dies. So - just another thing to look into. Run your code in the Adreno profiler with glFinish() on, remove all the redundant state changes and unnecessary unbinds like texture, shader or vbo binds to 0 or anything like that and see how it goes. This worked for us. On Apr 12, 10:59 am, cybice istar...@gmail.com wrote: Please look athttps://developer.qualcomm.com/forum/qdevnet-forums/mobile-gaming-gra... i have no rooted phone, so please anybody who affected this bug, send to Qualcomm a stack trace (using gdb) of all the threads of the system_server process -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL lockups in 2.2
Please look at https://developer.qualcomm.com/forum/qdevnet-forums/mobile-gaming-graphics-optimization-adreno/11525#comment-6928 i have no rooted phone, so please anybody who affected this bug, send to Qualcomm a stack trace (using gdb) of all the threads of the system_server process -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL lockups in 2.2
It looks like i found workaround. In all my apps error waitForCondition(LockCondition) timed out disappeared. The workaround is next. I preload two copy of each texture into GPU - texture1 and texture1copy, and in onDrawFrame one call i use first texture copy, next call i use second texture copy and so on code sample: int _seed=0; public void onDrawFrame(GL10 gl) { if(_seed%2==0) { GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture1 ); }else { GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture1copy); } _seed++; } -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL es and min3d - textures only load on certain hardware and how to fix.
Hey thanks for the reply :) I figured out that it was on certain builds of android even when you have images that are in the power of two, once you pull them from a stream and pass them by reference some how theres a chance that they will be resized. I went through and made sure that anywhere I was making a copy by reference I used BitmapFactory.Options ops = new BitmapFactory.Options(); ops.inScaled = false; And this prevents the system from messing with the images. On Thursday, March 1, 2012 10:53:42 PM UTC-8, Yan wrote: Well there's an API calls that can easily load several different standard graphics file formats, for example: //Get the texture from the Android resource directory InputStream is = context.getResources().openRawResource(R.drawable.onlylowercasefilenameshere); Bitmap bitmap = null; try { //BitmapFactory is an Android graphics utility for images bitmap = BitmapFactory.decodeStream(is); } finally { //Always clear and close try { is.close(); is = null; } catch (IOException e) { } } If you are concerned about people replacing your image files with something else, then you can make that more difficult by doing some sort of checksum before using them. Otherwise, if you are concerned with people getting exact copies of standard image files, I don't know what to tell you. I wonder if anybody can suggest an efficient solution for that? On Thursday, March 1, 2012 4:34:00 AM UTC-7, Jim Andresakis wrote: Im using min3d to draw 3d boxes and Im applying textures to them in the updateScene method which works great on some devices and on others the textures wont load. Ive tried debugging by turning on the glflags but I dont see any errors what so ever. Ive done a lot of reading and googling the past two days on the matter and it looks like theres no real good answer on why opengl would work on one device and not on another. So far Ive tried making sure the images were in the power of two and that wasnt it. The way that Im accessing the images to use as bitmaps is by pulling bitmaps from images that are stored on the devices internal file system. I read in one thread some where that instead of decoding a file to make a bitmap you could turn the file into a stream and then decode that as a bitmap and that would work but I havent even tried doing that since I spent most of my time trying to debug to find any nullpointers or anything. At first I thought I had found some null textures but they were just textures that hadnt initialized yet. So as this is a common problem on android I was hoping others could help me out by shedding some light on how they tackled the problem of opengl textures not loading on certain devices. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL es and min3d - textures only load on certain hardware and how to fix.
Well there's an API calls that can easily load several different standard graphics file formats, for example: //Get the texture from the Android resource directory InputStream is = context.getResources().openRawResource(R.drawable.onlylowercasefilenameshere); Bitmap bitmap = null; try { //BitmapFactory is an Android graphics utility for images bitmap = BitmapFactory.decodeStream(is); } finally { //Always clear and close try { is.close(); is = null; } catch (IOException e) { } } If you are concerned about people replacing your image files with something else, then you can make that more difficult by doing some sort of checksum before using them. Otherwise, if you are concerned with people getting exact copies of standard image files, I don't know what to tell you. I wonder if anybody can suggest an efficient solution for that? On Thursday, March 1, 2012 4:34:00 AM UTC-7, Jim Andresakis wrote: Im using min3d to draw 3d boxes and Im applying textures to them in the updateScene method which works great on some devices and on others the textures wont load. Ive tried debugging by turning on the glflags but I dont see any errors what so ever. Ive done a lot of reading and googling the past two days on the matter and it looks like theres no real good answer on why opengl would work on one device and not on another. So far Ive tried making sure the images were in the power of two and that wasnt it. The way that Im accessing the images to use as bitmaps is by pulling bitmaps from images that are stored on the devices internal file system. I read in one thread some where that instead of decoding a file to make a bitmap you could turn the file into a stream and then decode that as a bitmap and that would work but I havent even tried doing that since I spent most of my time trying to debug to find any nullpointers or anything. At first I thought I had found some null textures but they were just textures that hadnt initialized yet. So as this is a common problem on android I was hoping others could help me out by shedding some light on how they tackled the problem of opengl textures not loading on certain devices. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 for Android
Thanks for the link. I was looking for a free copy of the orange book. On Dec 27, 11:52 pm, Indicator Veritatis mej1...@yahoo.com wrote: I'll take your word on that one, since I haven't had time to look at at that thoroughly myself yet; but I do know that a genuine must read is The Orange Book, which is downloadable in an earlier edition fromhttp://wiki.labomedia.org/images/1/10/Orange_Book_-_OpenGL_Shading_La... or you can buy the latest from Amazon. This book has the best explanation I have ever seen of the programmable pipeline in OpenGL 2.0. Unfortunately, it is all about OpenGL rather than OpenGL ES, but such is true of most of the reference this thread has shown to date. Then again, the basic concepts are best explained in books like this one, then you can rely on the difference specification from Khronos to learn to apply it to OpenGL ES. On Dec 26, 10:26 pm, bob b...@coolfone.comze.com wrote: On Dec 26, 8:52 am, the_edge123 theedge...@gmail.com wrote: On Dec 26, 11:05 am, bob b...@coolfone.comze.com wrote: What is the best way to learn OpenGL ES 2.0 for Android? What kind of tutorial are you looking for ? are you a beginner ? What did you already find ? This is really good too: http://en.wikibooks.org/wiki/GLSL_Programming/Vector_and_Matrix_Opera... Plus, I wrote my own shader: private final String mFragmentShader = precision mediump float;\n + varying vec2 vTextureCoord;\n + uniform sampler2D sTexture;\n + void main() {\n + vec2 center = vec2(0.5,0.5);\n + float intensity = 1.0 - distance(vTextureCoord,center);\n + gl_FragColor = texture2D(sTexture, vTextureCoord) * vec4(0.0, 1.0, 0.0, 1.0) * intensity;\n + }\n; Here's a pic of it: http://i1190.photobucket.com/albums/z449/m75214/122711002015.jpg -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 for Android
I'll take your word on that one, since I haven't had time to look at at that thoroughly myself yet; but I do know that a genuine must read is The Orange Book, which is downloadable in an earlier edition from http://wiki.labomedia.org/images/1/10/Orange_Book_-_OpenGL_Shading_Language_2nd_Edition.pdf or you can buy the latest from Amazon. This book has the best explanation I have ever seen of the programmable pipeline in OpenGL 2.0. Unfortunately, it is all about OpenGL rather than OpenGL ES, but such is true of most of the reference this thread has shown to date. Then again, the basic concepts are best explained in books like this one, then you can rely on the difference specification from Khronos to learn to apply it to OpenGL ES. On Dec 26, 10:26 pm, bob b...@coolfone.comze.com wrote: On Dec 26, 8:52 am, the_edge123 theedge...@gmail.com wrote: On Dec 26, 11:05 am, bob b...@coolfone.comze.com wrote: What is the best way to learn OpenGL ES 2.0 for Android? What kind of tutorial are you looking for ? are you a beginner ? What did you already find ? This is really good too: http://en.wikibooks.org/wiki/GLSL_Programming/Vector_and_Matrix_Opera... Plus, I wrote my own shader: private final String mFragmentShader = precision mediump float;\n + varying vec2 vTextureCoord;\n + uniform sampler2D sTexture;\n + void main() {\n + vec2 center = vec2(0.5,0.5);\n + float intensity = 1.0 - distance(vTextureCoord,center);\n + gl_FragColor = texture2D(sTexture, vTextureCoord) * vec4(0.0, 1.0, 0.0, 1.0) * intensity;\n + }\n; Here's a pic of it: http://i1190.photobucket.com/albums/z449/m75214/122711002015.jpg -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 for Android
The best way? Probably to use the Orange Book (see post below) and study the sample code in both Android and Apple iPhone online documentation, which is quite good on OpenGL ES. On Dec 26, 2:05 am, bob b...@coolfone.comze.com wrote: What is the best way to learn OpenGL ES 2.0 for Android? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 for Android
On Dec 26, 11:05 am, bob b...@coolfone.comze.com wrote: What is the best way to learn OpenGL ES 2.0 for Android? What kind of tutorial are you looking for ? are you a beginner ? What did you already find ? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 for Android
On Dec 26, 8:52 am, the_edge123 theedge...@gmail.com wrote: On Dec 26, 11:05 am, bob b...@coolfone.comze.com wrote: What is the best way to learn OpenGL ES 2.0 for Android? What kind of tutorial are you looking for ? A book hopefully. are you a beginner ? Yes. What did you already find ? http://www.khronos.org/registry/gles/specs/2.0/GLSL_ES_Specification_1.0.17.pdf -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 for Android
On Dec 26, 8:52 am, the_edge123 theedge...@gmail.com wrote: On Dec 26, 11:05 am, bob b...@coolfone.comze.com wrote: What is the best way to learn OpenGL ES 2.0 for Android? What kind of tutorial are you looking for ? are you a beginner ? What did you already find ? This is really good too: http://en.wikibooks.org/wiki/GLSL_Programming/Vector_and_Matrix_Operations Plus, I wrote my own shader: private final String mFragmentShader = precision mediump float;\n + varying vec2 vTextureCoord;\n + uniform sampler2D sTexture;\n + void main() {\n + vec2 center = vec2(0.5,0.5);\n + float intensity = 1.0 - distance(vTextureCoord,center);\n + gl_FragColor = texture2D(sTexture, vTextureCoord) * vec4(0.0, 1.0, 0.0, 1.0) * intensity;\n + }\n; Here's a pic of it: http://i1190.photobucket.com/albums/z449/m75214/122711002015.jpg -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 for Android
On Dec 26, 8:52 am, the_edge123 theedge...@gmail.com wrote: On Dec 26, 11:05 am, bob b...@coolfone.comze.com wrote: What is the best way to learn OpenGL ES 2.0 for Android? What kind of tutorial are you looking for ? are you a beginner ? What did you already find ? Also, I like this shader: private final String mFragmentShader = precision mediump float;\n + varying vec2 vTextureCoord;\n + uniform sampler2D sTexture;\n + void main() {\n + vec2 center = vec2(0.5,0.5);\n + float intensity = 1.0 - distance(vTextureCoord,center);\n + gl_FragColor = texture2D(sTexture, vTextureCoord) * vec4(1.0, 1.0, 1.0, intensity);\n + }\n; Be sure to have blending on: GLES20.glEnable(GL10.GL_BLEND); GLES20.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); Here's what it looks like: http://i1190.photobucket.com/albums/z449/m75214/myshade.png -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 weirdness - app works on Samsung Galaxy S2, but not Nexus One or HTC Desire
Perhaps I should give more information about what the app is doing. It uses a single 1024*1024 texture with type GL_UNSIGNED_BYTE. It runs a shader on the texture to perform a palette-shifting animation. The shader compiles without errors, even on the devices where the app doesn't work. On Dec 25, 8:47 pm, Christopher Van Kirk christopher.vank...@gmail.com wrote: There are many, many differences between devices when it comes to OpenGL ES 2.0 rendering. It's a profound problem, actually, because it more or less demands that you either buy each kind of device for testing (and there are 600+ devices), or buy graphics engine from someone else who has...neither of which are particularly palatable options from an expense perspective because the value of the app is likely to be far less than the cost of the tool or devices needed to test it. On 12/26/2011 9:34 AM, Michael wrote: I have an app which uses OpengGL ES 2.0 which works fine on my Galaxy S2, but only displays a black screen on the Nexus One and HTC Desire. The logs report no errors. Are there known differences between the Samsung Galaxy S2 OpenGL ES 2.0 implementation and that of other devices? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OpenGL ES 2.0 weirdness - app works on Samsung Galaxy S2, but not Nexus One or HTC Desire
1) I would check every GL call's error code after you run it to make sure nothing is reporting an error. If the shader is compiling chances are good that it's okay (there are exceptions). 2) Different devices handle texture unit mappings in different ways. I've had problems binding a texture to a unit and leaving it there. I found that re-binding the texture unit every time I use the shader seems to be portable, if not particularly desirable. Having said that, I haven't found a way to get my own app to run on the PowerVR chips...so...who knows. 3) Check that your really giving it the texture format that you think you are. I remember having problems with the SGS 2 because some textures needed to be bound as 565 instead of unsigned byte. The bad news is that there's really no repository of knowledge for this stuff. You just have to slog through it by yourself or buy an engine that has done it for you. Unfortunate, and unhealthy for Android, but that's just the way it is with Android OpenGL. Fragmentation at its most diabolical. On 12/26/2011 10:33 AM, Michael wrote: Perhaps I should give more information about what the app is doing. It uses a single 1024*1024 texture with type GL_UNSIGNED_BYTE. It runs a shader on the texture to perform a palette-shifting animation. The shader compiles without errors, even on the devices where the app doesn't work. On Dec 25, 8:47 pm, Christopher Van Kirk christopher.vank...@gmail.com wrote: There are many, many differences between devices when it comes to OpenGL ES 2.0 rendering. It's a profound problem, actually, because it more or less demands that you either buy each kind of device for testing (and there are 600+ devices), or buy graphics engine from someone else who has...neither of which are particularly palatable options from an expense perspective because the value of the app is likely to be far less than the cost of the tool or devices needed to test it. On 12/26/2011 9:34 AM, Michael wrote: I have an app which uses OpengGL ES 2.0 which works fine on my Galaxy S2, but only displays a black screen on the Nexus One and HTC Desire. The logs report no errors. Are there known differences between the Samsung Galaxy S2 OpenGL ES 2.0 implementation and that of other devices? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Opengl ES implement light in 2d isometric game
I think it should work, just look up OpenGL lighting tutorials. In my Vintage Tripeaks game I use OpenGL lights (two of them). The only thing I still don't understand 100% is the lighting coordinates. I just worked on it enough to get it to work like I wanted, I didn't experiment much further. Someone else here on the list no doubt has some good tips on lighting coordinates. They are treated different than mesh coordinates. Just google some tuts. -niko On Dec 13, 8:00 am, Dani eraofw...@gmail.com wrote: Hello, I'm developening an isometric 2D game using Opengl ES. Now I'm trying to implement a light system like Diablo I and II, i.e. with the source light positionated on the main character that follows him and radiates the surrounding dark environment. What's the best way to do that? I found only tutorial about shader for a 3D system, I don't know if it is the right way for 2D or if there is a better (and simple) solution. Thank you Dani -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL doesnt work- not even sample
Thank you for your posts. I guess the emulator just isnt capable of opengl es 2, but the demos are very misleading. You can go to api demosgraphicsopengl es 2 and it will run. If you see the code in the sdk samples folder, it is opengl es 2. I will try to run the sample on my phone asap On Nov 22, 11:53 am, Christopher Van Kirk christopher.vank...@gmail.com wrote: Sorry, I'll solve your problem as well. The reason you're getting that error is that you've requested an EGL configuration that your device doesn't support for whatever reason, so the EGL configuration chooser factory is ending with no 'valid' configuration. That throws an exception that the GLSurfaceView is not particularly friendly about dealing with because it gets thrown into the render thread, which can't easily be caught by your activity (that I know of). What you need to do is loosen your constraints a bit so that you can get a valid configuration, or do some investigation about what EGL settings the device does support. Cheers, Chris... On 11/23/2011 12:45 AM, Stephen Lee wrote: When my emulator (API 14.0) is running, I can go through API Demos and select BasicGLSurfaceView (OpenGLES2), the app runs and a triangle spins. When I load the project into Eclipse and build, the same program stops working in the emulator as soon as I unlock the phone and let it load, or load it from list of apps. For this reason, I'm 90% sure the problem is Eclipse building it. I've already spent 2 days trying to resolve this and it's frustrating. I've reinstalled already and have everything properly installed. This seems to be the only problem of its kind- Ive googled for hours, so probably a stupid error Heres what I get from running the untouched sample into Eclipse Logcat at crash- 11-19 21:35:52.887: E/AndroidRuntime(556): FATAL EXCEPTION: GLThread 75 11-19 21:35:52.887: E/AndroidRuntime(556): java.lang.IllegalArgumentException: No configs match configSpec 11-19 21:35:52.887: E/AndroidRuntime(556): at android.opengl.GLSurfaceView$BaseConfigChooser.cho oseConfig(GLSurfaceView.java:825) 11-19 21:35:52.887: E/AndroidRuntime(556): at android.opengl.GLSurfaceView$EglHelper.start(GLSur faceView.java:981) 11-19 21:35:52.887: E/AndroidRuntime(556): at android.opengl.GLSurfaceView$GLThread.guardedRun(G LSurfaceView.java: 1335) 11-19 21:35:52.887: E/AndroidRuntime(556): at android.opengl.GLSurfaceView$GLThread.run(GLSurfac eView.java:1189) Console-- [2011-11-19 21:34:40 - BasicGLSurfaceView] New emulator found: emulator-5554 [2011-11-19 21:34:40 - BasicGLSurfaceView] Waiting for HOME('android.process.acore') to be launched... [2011-11-19 21:35:16 - BasicGLSurfaceView] WARNING: Application does not specify an API level requirement! [2011-11-19 21:35:16 - BasicGLSurfaceView] Device API version is 14 (Android 4.0.1) [2011-11-19 21:35:16 - BasicGLSurfaceView] HOME is up on device 'emulator-5554' [2011-11-19 21:35:16 - BasicGLSurfaceView] Uploading BasicGLSurfaceView.apk onto device 'emulator-5554' [2011-11-19 21:35:16 - BasicGLSurfaceView] Installing BasicGLSurfaceView.apk... [2011-11-19 21:35:49 - BasicGLSurfaceView] Success! [2011-11-19 21:35:50 - BasicGLSurfaceView] Starting activity com.example.android.basicglsurfaceview.BasicGLSurf aceViewActivity on device emulator-5554 [2011-11-19 21:35:52 - BasicGLSurfaceView] ActivityManager: Starting: Intent { act=... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OpenGL doesnt work- not even sample
The emulator does not support OpenGL ES 2.0 at the moment. You'll need a device to run them. On Tue, Nov 22, 2011 at 10:16 AM, Stephen Lee stephenl7...@yahoo.comwrote: Thank you for your posts. I guess the emulator just isnt capable of opengl es 2, but the demos are very misleading. You can go to api demosgraphicsopengl es 2 and it will run. If you see the code in the sdk samples folder, it is opengl es 2. I will try to run the sample on my phone asap On Nov 22, 11:53 am, Christopher Van Kirk christopher.vank...@gmail.com wrote: Sorry, I'll solve your problem as well. The reason you're getting that error is that you've requested an EGL configuration that your device doesn't support for whatever reason, so the EGL configuration chooser factory is ending with no 'valid' configuration. That throws an exception that the GLSurfaceView is not particularly friendly about dealing with because it gets thrown into the render thread, which can't easily be caught by your activity (that I know of). What you need to do is loosen your constraints a bit so that you can get a valid configuration, or do some investigation about what EGL settings the device does support. Cheers, Chris... On 11/23/2011 12:45 AM, Stephen Lee wrote: When my emulator (API 14.0) is running, I can go through API Demos and select BasicGLSurfaceView (OpenGLES2), the app runs and a triangle spins. When I load the project into Eclipse and build, the same program stops working in the emulator as soon as I unlock the phone and let it load, or load it from list of apps. For this reason, I'm 90% sure the problem is Eclipse building it. I've already spent 2 days trying to resolve this and it's frustrating. I've reinstalled already and have everything properly installed. This seems to be the only problem of its kind- Ive googled for hours, so probably a stupid error Heres what I get from running the untouched sample into Eclipse Logcat at crash- 11-19 21:35:52.887: E/AndroidRuntime(556): FATAL EXCEPTION: GLThread 75 11-19 21:35:52.887: E/AndroidRuntime(556): java.lang.IllegalArgumentException: No configs match configSpec 11-19 21:35:52.887: E/AndroidRuntime(556): at android.opengl.GLSurfaceView$BaseConfigChooser.cho oseConfig(GLSurfaceView.java:825) 11-19 21:35:52.887: E/AndroidRuntime(556): at android.opengl.GLSurfaceView$EglHelper.start(GLSur faceView.java:981) 11-19 21:35:52.887: E/AndroidRuntime(556): at android.opengl.GLSurfaceView$GLThread.guardedRun(G LSurfaceView.java: 1335) 11-19 21:35:52.887: E/AndroidRuntime(556): at android.opengl.GLSurfaceView$GLThread.run(GLSurfac eView.java:1189) Console-- [2011-11-19 21:34:40 - BasicGLSurfaceView] New emulator found: emulator-5554 [2011-11-19 21:34:40 - BasicGLSurfaceView] Waiting for HOME('android.process.acore') to be launched... [2011-11-19 21:35:16 - BasicGLSurfaceView] WARNING: Application does not specify an API level requirement! [2011-11-19 21:35:16 - BasicGLSurfaceView] Device API version is 14 (Android 4.0.1) [2011-11-19 21:35:16 - BasicGLSurfaceView] HOME is up on device 'emulator-5554' [2011-11-19 21:35:16 - BasicGLSurfaceView] Uploading BasicGLSurfaceView.apk onto device 'emulator-5554' [2011-11-19 21:35:16 - BasicGLSurfaceView] Installing BasicGLSurfaceView.apk... [2011-11-19 21:35:49 - BasicGLSurfaceView] Success! [2011-11-19 21:35:50 - BasicGLSurfaceView] Starting activity com.example.android.basicglsurfaceview.BasicGLSurf aceViewActivity on device emulator-5554 [2011-11-19 21:35:52 - BasicGLSurfaceView] ActivityManager: Starting: Intent { act=... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Romain Guy Android framework engineer romain...@android.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OpenGL lockups in 2.2
Hey I am new to the android game development please reply with some get started tips as I am very much new bee here for graphics and gaming physics theory . Kindly help me to get some basic kick start. I shall be thankful to you . On Tue, Oct 11, 2011 at 9:32 PM, calderwa alancalderwoo...@googlemail.comwrote: Nope, 'fraid not. That code seems if anything to makes things a little worse for me = intermittent screen glitches, with rectangular areas garbled, and the less frequesnt hangup for a second or so, with the even less frequent reboot. I am using Samsung Galaxy S, 2.3.3, so clearly not restricted to HTC. All hangs seem to be locking problems in SharedBufferStack. glFlush calls have no effect on my problem. Switching from glDrawArrays to VBOs and glDrawElements had no effect. This bug is SO bad and i have spent SO long on it now that I am pretty much at the stage of junking many months of work and not publishing the openGL version of my app. This comes on top of unacknowledged problems in java 2d drawing routines, the ridiculous DirectBuffer problem in 3.0+ where it allocates 4* as much memory as you ask for. The list is nearly endless. Apple, here I come? On Aug 13, 8:18 am, Herko Lategan herko.late...@gmail.com wrote: Guys! *SOLUTION* I finally *found the solution* while watching one of the Google IO talks! I have been struggling with this problem for over 2 months now, while developing on my HTC Desire, and it made me so demotivated knowing my application will freeze randomly for some users! But after hours of searching I found a solution done by a Google Developer! *solution*: Here is the link to the solution for GLSurfaceView, http://replicaisland.googlecode.com/svn/trunk/src/com/replica/replica... Search for *mSafeMode, **check all the results*, he gives a description as to why the error occurs (it is because of broken drivers for certain chipsets). I have downloaded the source for this game, so if the links disappear you can email me and I'll be happy to share. Good luck to everyone! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL lockups in 2.2
Nope, 'fraid not. That code seems if anything to makes things a little worse for me = intermittent screen glitches, with rectangular areas garbled, and the less frequesnt hangup for a second or so, with the even less frequent reboot. I am using Samsung Galaxy S, 2.3.3, so clearly not restricted to HTC. All hangs seem to be locking problems in SharedBufferStack. glFlush calls have no effect on my problem. Switching from glDrawArrays to VBOs and glDrawElements had no effect. This bug is SO bad and i have spent SO long on it now that I am pretty much at the stage of junking many months of work and not publishing the openGL version of my app. This comes on top of unacknowledged problems in java 2d drawing routines, the ridiculous DirectBuffer problem in 3.0+ where it allocates 4* as much memory as you ask for. The list is nearly endless. Apple, here I come? On Aug 13, 8:18 am, Herko Lategan herko.late...@gmail.com wrote: Guys! *SOLUTION* I finally *found the solution* while watching one of the Google IO talks! I have been struggling with this problem for over 2 months now, while developing on my HTC Desire, and it made me so demotivated knowing my application will freeze randomly for some users! But after hours of searching I found a solution done by a Google Developer! *solution*: Here is the link to the solution for GLSurfaceView,http://replicaisland.googlecode.com/svn/trunk/src/com/replica/replica... Search for *mSafeMode, **check all the results*, he gives a description as to why the error occurs (it is because of broken drivers for certain chipsets). I have downloaded the source for this game, so if the links disappear you can email me and I'll be happy to share. Good luck to everyone! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OpenGL lockups in 2.2
It's insane to throw away months of work. Are you seeing this behavior in other 2 or 3d games running on that device? If so, it's probably a device fault that you simply can't get around, and should just be ignored. There are other devices in the world that, in theory, it should work on. In your market publish, just mention that you had problems with that device and that it's not recommended to be run there, then move on. If you aren't seeing the behavior elsewhere, then what you have is an application problem. Have you considered that plugging and unplugging the USB cable is introducing thread locking that is absent in your code? When you connect the USB cable, if you have development enabled, you instantly start reading out logging info, which may have locking in there that's fixing some problem you have. Anyway, giving up smacks of throwing the baby out with the bath water because of difficulties with one device. I wouldn't do it. On 10/12/2011 12:02 AM, calderwa wrote: Nope, 'fraid not. That code seems if anything to makes things a little worse for me = intermittent screen glitches, with rectangular areas garbled, and the less frequesnt hangup for a second or so, with the even less frequent reboot. I am using Samsung Galaxy S, 2.3.3, so clearly not restricted to HTC. All hangs seem to be locking problems in SharedBufferStack. glFlush calls have no effect on my problem. Switching from glDrawArrays to VBOs and glDrawElements had no effect. This bug is SO bad and i have spent SO long on it now that I am pretty much at the stage of junking many months of work and not publishing the openGL version of my app. This comes on top of unacknowledged problems in java 2d drawing routines, the ridiculous DirectBuffer problem in 3.0+ where it allocates 4* as much memory as you ask for. The list is nearly endless. Apple, here I come? On Aug 13, 8:18 am, Herko Lateganherko.late...@gmail.com wrote: Guys! *SOLUTION* I finally *found the solution* while watching one of the Google IO talks! I have been struggling with this problem for over 2 months now, while developing on my HTC Desire, and it made me so demotivated knowing my application will freeze randomly for some users! But after hours of searching I found a solution done by a Google Developer! *solution*: Here is the link to the solution for GLSurfaceView,http://replicaisland.googlecode.com/svn/trunk/src/com/replica/replica... Search for *mSafeMode, **check all the results*, he gives a description as to why the error occurs (it is because of broken drivers for certain chipsets). I have downloaded the source for this game, so if the links disappear you can email me and I'll be happy to share. Good luck to everyone! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL lockups in 2.2
Difficulties with one device I have no way of knowing how many makes/models of device this problem is on. I know that it happens all the time on my Samsung Galaxy (I9000). Others report exactly the same thing as being a feature of a number of HTC devices - these two make up a major part of the market I believe. I think I may well have two faults - one is the standard eglSwapBuffers hang, which none of the suggested fixes have had any effect on -square textures, different GLSurfaceView, wait, flush, finish etc. The second one, which I think might be related, is my intermittent framebuffer corruption, I am willing to accept this may be my fault in some way I have been unable to pinpoint. http://www.fordartworks.co.uk/dodgyS.png - the ractilinear dodgy area just above the left and right arrow buttons. smacks of throwing the baby out... At the moment, I am just hugely frustrated by the long list of problems I have faced with Android - halts on writing to SD card, gradients that don't work at one particular angle and so on. I have been a software designer and developer for over 25 years - parallel architecture research, trading room systems, real time etc (assembler, Fortran, Prolog, Occam, C, C++, Java) and I have never been so frustrated by any system - there has always been a different way of doing things, getting round problems. With this /these? OpenGL problem(s) it appears to be a black box. Without a genuine understanding of what is wrong, any fix is pure conjecture. should just be ignored I am extremely reluctant to put out an App that looks flakey or, much worse, shuts down people's phones. Ignoring a problem that I can't get round is not a viable solution I feel. plugging and unplugging the USB cable The USB cable stuff was a problem I had with very jerky OpenGL performance when the rendering load was heavy - this was caused by the CPU clock reducing when the GPU was active, I believe. seeing the behavior elsewhere I haven't experienced this problem with other programs on this phone. (I have not detected the problem on my Asus Transformer either, but I have tested that far less. It will also have very different performance characteristics.) I don't play games, 2D or 3D. Many of the openGL demonstrators, testers or benchmarkers don't stress the system sufficiently - i can get 50 or 60 fps. The problem is very timing dependent- i have one picture definition for my App that fails vaguely regularly - i have 2 or 3 others that do very occasionally, and I have 100+ that i haven't seen go wrong yet. I simply haven't the time to sit and fiddle about with a 3rd party app on the off-chance of catching a glitch. If I did - that would prove relatively little. I could sit there till doomsday with my own app under the right conditions and never see anything untoward. I'll maybe just take a break from this (go and paint a few pictures :-) ) - i've been on this problem 7 days a week for nearly 3 weeks now. I might even go get a real job again, lol. It's insane Thank you for your concerns over my mental health :-) On Oct 11, 7:28 pm, Christopher Van Kirk christopher.vank...@gmail.com wrote: It's insane to throw away months of work. Are you seeing this behavior in other 2 or 3d games running on that device? If so, it's probably a device fault that you simply can't get around, and should just be ignored. There are other devices in the world that, in theory, it should work on. In your market publish, just mention that you had problems with that device and that it's not recommended to be run there, then move on. If you aren't seeing the behavior elsewhere, then what you have is an application problem. Have you considered that plugging and unplugging the USB cable is introducing thread locking that is absent in your code? When you connect the USB cable, if you have development enabled, you instantly start reading out logging info, which may have locking in there that's fixing some problem you have. Anyway, giving up smacks of throwing the baby out with the bath water because of difficulties with one device. I wouldn't do it. On 10/12/2011 12:02 AM, calderwa wrote: Nope, 'fraid not. That code seems if anything to makes things a little worse for me = intermittent screen glitches, with rectangular areas garbled, and the less frequesnt hangup for a second or so, with the even less frequent reboot. I am using Samsung Galaxy S, 2.3.3, so clearly not restricted to HTC. All hangs seem to be locking problems in SharedBufferStack. glFlush calls have no effect on my problem. Switching from glDrawArrays to VBOs and glDrawElements had no effect. This bug is SO bad and i have spent SO long on it now that I am pretty much at the stage of junking many months of work and not publishing the openGL version of my app. This comes on top of unacknowledged problems in java 2d drawing routines, the ridiculous DirectBuffer problem in 3.0+ where it allocates 4* as much memory as you ask
[android-developers] Re: OpenGL lockups in 2.2
Difficulties with one device I have no way of knowing how many makes/models of device this problem is on. I know that it happens all the time on my Samsung Galaxy (I9000). Others report exactly the same thing as being a feature of a number of HTC devices - these two make up a major part of the market I believe. I think I may well have two faults - one is the standard eglSwapBuffers hang, which none of the suggested fixes have had any effect on -square textures, different GLSurfaceView, wait, flush, finish etc. The second one, which I think might be related, is my intermittent framebuffer corruption, I am willing to accept this may be my fault in some way I have been unable to pinpoint. http://www.fordartworks.co.uk/dodgyS.png - the ractilinear dodgy area just above the left and right arrow buttons. smacks of throwing the baby out... At the moment, I am just hugely frustrated by the long list of problems I have faced with Android - halts on writing to SD card, gradients that don't work at one particular angle and so on. I have been a software designer and developer for over 25 years - parallel architecture research, trading room systems, real time etc (assembler, Fortran, Prolog, Occam, C, C++, Java) and I have never been so frustrated by any system - there has always been a different way of doing things, getting round problems. With this /these? OpenGL problem(s) it appears to be a black box. Without a genuine understanding of what is wrong, any fix is pure conjecture. should just be ignored I am extremely reluctant to put out an App that looks flakey or, much worse, shuts down people's phones. Ignoring a problem that I can't get round is not a viable solution I feel. plugging and unplugging the USB cable The USB cable stuff was a problem I had with very jerky OpenGL performance when the rendering load was heavy - this was caused by the CPU clock reducing when the GPU was active, I believe. seeing the behavior elsewhere I haven't experienced this problem with other programs on this phone. (I have not detected the problem on my Asus Transformer either, but I have tested that far less. It will also have very different performance characteristics.) I don't play games, 2D or 3D. Many of the openGL demonstrators, testers or benchmarkers don't stress the system sufficiently - i can get 50 or 60 fps. The problem is very timing dependent- i have one picture definition for my App that fails vaguely regularly - i have 2 or 3 others that do very occasionally, and I have 100+ that i haven't seen go wrong yet. I simply haven't the time to sit and fiddle about with a 3rd party app on the off-chance of catching a glitch. If I did - that would prove relatively little. I could sit there till doomsday with my own app under the right conditions and never see anything untoward. I'll maybe just take a break from this (go and paint a few pictures :-) ) - i've been on this problem 7 days a week for nearly 3 weeks now. I might even go get a real job again, lol. It's insane Thank you for your concerns over my mental health :-) On Oct 11, 7:28 pm, Christopher Van Kirk christopher.vank...@gmail.com wrote: It's insane to throw away months of work. Are you seeing this behavior in other 2 or 3d games running on that device? If so, it's probably a device fault that you simply can't get around, and should just be ignored. There are other devices in the world that, in theory, it should work on. In your market publish, just mention that you had problems with that device and that it's not recommended to be run there, then move on. If you aren't seeing the behavior elsewhere, then what you have is an application problem. Have you considered that plugging and unplugging the USB cable is introducing thread locking that is absent in your code? When you connect the USB cable, if you have development enabled, you instantly start reading out logging info, which may have locking in there that's fixing some problem you have. Anyway, giving up smacks of throwing the baby out with the bath water because of difficulties with one device. I wouldn't do it. On 10/12/2011 12:02 AM, calderwa wrote: Nope, 'fraid not. That code seems if anything to makes things a little worse for me = intermittent screen glitches, with rectangular areas garbled, and the less frequesnt hangup for a second or so, with the even less frequent reboot. I am using Samsung Galaxy S, 2.3.3, so clearly not restricted to HTC. All hangs seem to be locking problems in SharedBufferStack. glFlush calls have no effect on my problem. Switching from glDrawArrays to VBOs and glDrawElements had no effect. This bug is SO bad and i have spent SO long on it now that I am pretty much at the stage of junking many months of work and not publishing the openGL version of my app. This comes on top of unacknowledged problems in java 2d drawing routines, the ridiculous DirectBuffer problem in 3.0+ where it allocates 4* as much memory as you ask
[android-developers] Re: OpenGL ES 2.0 Tutorial
I had the same problem, but it turned out to be a syntax error in the shader code. You should check it out, as this is not checked by eclipse. On 16 Sep, 16:44, Oliver Santschi oliver.sants...@gmail.com wrote: I tried the OpenGL ES 2.0 Tutorial (http://developer.android.com/ resources/tutorials/opengl/opengl-es20.html#projection-and-views). First part (Drawing the triangle without projection or camera view) was no problem. The second part (Apply Projection and Camera View) does not work with my Samsung Galaxy II. There is no triangle on the screen. I think there is something wrong in the tutorial. Has anybody completed the tutorial? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 question
I do not understand step 5) create a framebuffer and bind it to the texture from #3 do you call *glFramebufferTexture *attaching texture as GL_COLOR_ATTACHMENT* i* or what? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OpenGL ES 2.0 question
Yes. I figured out what my problem was in this case. I was creating more texture image units than were provided by the phone, so only the last n image units worked. The SGS 2 has very few image units, apparently. Interestingly, making calls to invalid image units didn't raise any errors. Once I put resource management around image units everything started working as it should. Thanks for the reply though! Cheers On 9/18/2011 6:11 PM, cybice wrote: I do not understand step 5) create a framebuffer and bind it to the texture from #3 do you call *glFramebufferTexture *attaching texture as GL_COLOR_ATTACHMENT/i/ or what? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL Problem
The *more information* you provide, the better your results will be. But the easiest solutions: If you draw all in 3d see glEnable(GL_DEPTH_TEST) also glDepthFunc If 2D you can create sprites with alpha channel (png), disable GL_DEPTH_TEST, set blending GLES20.glEnable(GLES20.GL_BLEND); GLES20.glBlendFunc(GLES20.GL_ONE,GLES20.GL_ONE_MINUS_SRC_ALPHA); and draw in back to front order -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL Samsung Galaxy S2 S II Problem With Rotation
There is an ARM MALI400 in SAMSUNG GALAXY S2 as a GPU, Maybe it's MALI's problem? Other devices u tested ok maybe use another GPU such as Qualcomm Adreno On 9月5日, 下午7时03分, emanuele padula e.pad...@gmail.com wrote: Thank you Christopher. I'll do some test regarding the mipmapping, but i'm not sure that it will work. Thank you for you suggestion. 2011/9/5 Christopher Van Kirk christopher.vank...@gmail.com I'm seeing a similar problem on that device, but I haven't spent any time looking for an answer yet. I see that you're using VBOs...I've read somewhere that some devices have trouble with them but I don't know if it's true or which devices might be affected. I also know that in my case I'm also using VBOs, but I'm not rotating the texture, I'm stretching it without a mipmap, and it's a JPEG. Sorry couldn't be more help. On 9/5/2011 10:15 PM, pad wrote: Hi, I have a huge problem ONLY with SAMSUNG GALAXY S2 and i cannot figure out if the problem is my code or of this device!! ON ALL OTHER PHONES IT WORKS GREAT!! I'm Using ONLY OpenGL 1.0. The problem is that with the code below my game cannot draw the object that need rotation (the objects are not visualized on the screen). Objects with no rotation (angle = 0.0) are drawn perfectly. ONLY on samsung galaxy s2 the rotated images are not visualized on the screen. There is some bug in SG2 that i have to take in cosideration or some specific initialization? Can you help me??? Thank you in advance public static void drawBitmap(final GL10 gl, final float x, final float y, final float rotate_x, final float rotate_y, final MyImage m, final float angle) { // Draw using verts or VBO verts. gl.glPushMatrix(); // gl.glLoadIdentity(); final int indexPerTile = TextureManager.INDEX_PER_TILE; final int indexRow = m.fx.row * TextureManager.INDEX_PER_TILE * TextureManager.TILE_PER_ROW; if (angle == 0.0f) { gl.glTranslatef(x, y, 0f); gl.glScalef(m.scaleWidth, m.scaleHeight, 1); m.fx.grid.drawStrip(gl, true, indexRow, indexPerTile);// the code of this method is below if (m.alpha != 1 || m.red != 1 || m.blue != 1 || m.green != 1) { gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } } else { final float xt = rotate_x; final float yt = rotate_y; gl.glTranslatef(xt, yt, 0f); gl.glRotatef(-angle, 0f, 0f, 1.0f); gl.glTranslatef(-xt + x, -yt + y, 0f); gl.glScalef(m.scaleWidth, m.scaleHeight, 1); m.fx.grid.drawStrip(gl, true, indexRow, indexPerTile); // the code of this method is below if (m.alpha != 1 || m.red != 1 || m.blue != 1 || m.green != 1) { gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } } gl.glPopMatrix(); } public void drawStrip(final GL10 gl, final boolean useTexture, final int startIndex, final int indexCount) { int count = indexCount; if (startIndex + indexCount= this.mIndexCount) { count = this.mIndexCount - startIndex; } gl.glDrawElements(GL10.GL_**TRIANGLES, count, GL10.GL_UNSIGNED_SHORT, this.mIndexBuffer.position(**startIndex)); }- 隐藏被引用文字 - - 显示引用的文字 - -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL lockups in 2.2
Guys! *SOLUTION* I finally *found the solution* while watching one of the Google IO talks! I have been struggling with this problem for over 2 months now, while developing on my HTC Desire, and it made me so demotivated knowing my application will freeze randomly for some users! But after hours of searching I found a solution done by a Google Developer! *solution*: Here is the link to the solution for GLSurfaceView, http://replicaisland.googlecode.com/svn/trunk/src/com/replica/replicaisland/GLSurfaceView.java Search for *mSafeMode, **check all the results*, he gives a description as to why the error occurs (it is because of broken drivers for certain chipsets). I have downloaded the source for this game, so if the links disappear you can email me and I'll be happy to share. Good luck to everyone! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Opengl ES Texture working on Emulator but not on Device
Try using bitmap with power of two dimensions or even square bitmap with power of two dimensions. Something like 64*64 or 128*128. On 16 июл, 19:00, odrya12 odr...@gmail.com wrote: I tried everything.. Source: Texture class: public class XAndroidTexture { private int[] textures = new int[1]; public int width, height; Bitmap bmp; public XAndroidTexture(GL10 gl, Bitmap bitmap) { gl.glEnable(GL10.GL_TEXTURE_2D); this.bmp = bitmap; width = bmp.getWidth(); height = bmp.getHeight(); gl.glGenTextures(1, textures, 0); // ...and bind it to our array gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); // create nearest filtered texture 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_LINEAR); 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); gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_MODULATE); // Use Android GLUtils to specify a two-dimensional texture image from our bitmap GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); //GLUtils.texSubImage2D(GL10.GL_TEXTURE_2D, 0, 0, 0, bmp); // Clean up bitmap.recycle(); } public void bind(GL10 gl) { gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); } public static XAndroidTexture createTextureFromBitmap(GL10 gl, Bitmap bmp) { return new XAndroidTexture(gl, bmp); } } Texture loading function: XAndroidTexture Textureload(String path) { InputStream is; Bitmap bmp = null; try { is = this.getAssets().open(path); BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inDither = true; Bitmap tBmp = BitmapFactory.decodeStream(is, null, opts); bmp = Bitmap.createBitmap(tBmp.getWidth(), tBmp.getHeight(), Bitmap.Config.ARGB_); Canvas canvas = new Canvas(bmp); canvas.drawBitmap(tBmp, 0, 0, null); canvas.save(); tBmp.recycle(); tBmp = null; } catch (IOException e) { e.printStackTrace(); } if(bmp == null) return null; else return new XAndroidTexture(gl, bmp); } It working on Emulator perfect, but not on device Can anyone post here texture class that work on device? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL on Original Droid stutters
I found the problem. I have an OC droid and SetCPU was set to on demand. The app must have been on the edge of CPU use so SetCPU was speeding up/ slowing down the CPU randomly. If I set SetCPU to performance than the animation is 100% smooth. That's also probably why touching the screen and moving my finger caused it to run smooth - it forced it to use more CPU cycles. I think that shows how fast OpenGL is! It was fast enough to not use enough CPU when only doing one textured quad. -niko On May 21, 5:34 pm, niko20 nikolatesl...@yahoo.com wrote: Hi I've been experimenting with the NDK san-angeles example in android- ndk-r5b for doingOpenGL. However, I've trimmed out all code in the sample and instead changed it to simply display one texture mapped cube that rotates (to learnOpenGLES). I have aOpenGLwindow of 480x320. I do a simple glClearColor, and then draw a textured quad using a triangle strip and Vertex Arrays. I also have a texture array too of course. The texture is Alpha-blended so I can mask the image out. I then rotate the quad in the Render loop. I've noticed on my original Droid the quad sort of stutters in the sense that it will start out rotating normally, and then slow down a bit, speed up, slow down, and just act weird. I thought this was possibly a artifact of the frame rate changing a lot, so I rearranged my code to average the frame rate and adjust the rotation of the quad based on real time. However, on the Droid this doesn't seem to make any difference. It still randomly slows down. The other strange thing is I can smooth it out by simply touching the screen and rubbing my finger on it back and forth. As long as I'm rubbing the screen the animation is nice and smooth. It's weird like some sort of thread priority thing or something. I also tested the same exact APK on a Motorola XOOM and on a Samsung Galaxy Tablet, and they do not exhibit this behavoir. The quad rotates nice a smooth continously and without and lag/stutter. Does anybody have any tips or ideas of what may be causing this to occur? The slowdown happens even when I disable the texture and only display the quad (as a white quad). I've uploaded the code I used to test this if anyone had the time to check it out: https://rapidshare.com/files/488012630/san-angeles.zip Thanks! -niko -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES for Android tutorial
GDC 2011 had a better example for OGLES2.0 https://code.google.com/p/gdc2011-android-opengl/ On 5 Apr, 18:41, J javier.sed...@gmail.com wrote: Hi, anybody can sugest a tutorial for OpenGL ES on Android? The official documentation is not very extensive... Thanks, J -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 Shader Access Client Memory
You can do lots of interesting tricks with memory with shaders, particularly pixel shaders. Many implementations put all types of wild data into textures that aren't images and access that with a swizzle in the pixel shader as whatever 32 bit values they needed. You need to learn GLES2 to understand better. You can basically only pass uniforms, vertex attributes and texture samplers to shaders. Everything you can do must be through that API. Yes you can draw a quad from 4 verts. You just need to either do 2 indexes triangles if drawing multiple 4-vert quads in one draw batch or you can do it as a single draw using trianglefan or trianglestrip. On Apr 5, 3:19 pm, Jonathan jonat...@minescape.ca wrote: From what I understand, the GPU in Android devices uses shared memory-RAM. So I'm thinking it must be possible to have a shader access client memory directly. The ideal would be to be able to pass an array pointer to the shader and be able to access a value in that array using that pointer, in the shader. If this is not possible I would still like to know the best way of doing something like this. (I also have another small question: would it be possible to draw a quad from only 4 vertices in OpenGL ES 2.0?) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: openGL texture render size
After two days thinking your explanation, i have understand very well now, thanks very much! There are two point with my acquaintance: 1. --x at the first, it advoid next power of two is double with the power of two, like 1000(dec is 8), it will became 16. 2. i=1 (doing i++ in the for loop), it is very very profound and effective. I coat almost 2 hours about this. 2011/4/2 Hari Edo hari@gmail.com: On Apr 1, 11:16 pm, a a harvey.a...@gmail.com wrote: But i can't understand the following algorithm function nextHighestPowerOfTwo(x) { --x; for (var i = 1; i 32; i = 1) { x = x | x i; } return x + 1; } On the first loop, take the value and smear its bits once rightward: x was: 10010111 x 1: 01001011 x | x 1: 11010001 On the second loop, you could smear the bits once rightward again (doing i++ in the for loop), but that would be a waste of time since there can be no more single 1 bits. All the runs of 1 bits are now fatter. So on the second loop, smear the bits TWICE rightward, by doing (i = 1) in the for loop instead. x was: 11010001 x 2: 00110100 x | x 2: 1101 On the third loop, smear the bits FOUR rightward, since any 1 bit is now fatter. x was: 1101 x 4: x | x 4: We're done in this example, but the loop here also tries to smear by 8 and smear by 16. We then add 1, to roll over to the next power of two. x was: next power: 0001 However, because you don't want to have the nextHighestPowerOfTwo(2048) to return 4096, the function starts with x-1 instead of x. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: openGL texture render size
On Apr 1, 11:16 pm, a a harvey.a...@gmail.com wrote: But i can't understand the following algorithm function nextHighestPowerOfTwo(x) { --x; for (var i = 1; i 32; i = 1) { x = x | x i; } return x + 1; } On the first loop, take the value and smear its bits once rightward: x was:10010111 x 1: 01001011 x | x 1: 11010001 On the second loop, you could smear the bits once rightward again (doing i++ in the for loop), but that would be a waste of time since there can be no more single 1 bits. All the runs of 1 bits are now fatter. So on the second loop, smear the bits TWICE rightward, by doing (i = 1) in the for loop instead. x was:11010001 x 2: 00110100 x | x 2: 1101 On the third loop, smear the bits FOUR rightward, since any 1 bit is now fatter. x was:1101 x 4: x | x 4: We're done in this example, but the loop here also tries to smear by 8 and smear by 16. We then add 1, to roll over to the next power of two. x was: next power: 0001 However, because you don't want to have the nextHighestPowerOfTwo(2048) to return 4096, the function starts with x-1 instead of x. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OpenGL rendering blank with min SDK set
Thanks that worked. Do you know what the reason for this behavior is? On 29 March 2011 05:41, Nightwolf mikh...@gmail.com wrote: Do you use textures and store images in res\drawable? Try storing them in drawable-nodpi. On Mar 28, 12:42 am, joe bain mrjoeb...@gmail.com wrote: Hi all, I'm about to release a game and have been developing without a min sdk version set in the manifest. The game uses opengl in a GLSurfaceView but now I have set a min sdk version the opengl part is completely white. The game overlays some standard android widgets which still appear fine and work. Does anyone know why changing the min sdk requirement would affect the opengl rendering? I can find no errors in the logs and I'm really at a loss to work out what is happening here. Thanks, Joe -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL rendering blank with min SDK set
Do you use textures and store images in res\drawable? Try storing them in drawable-nodpi. On Mar 28, 12:42 am, joe bain mrjoeb...@gmail.com wrote: Hi all, I'm about to release a game and have been developing without a min sdk version set in the manifest. The game uses opengl in a GLSurfaceView but now I have set a min sdk version the opengl part is completely white. The game overlays some standard android widgets which still appear fine and work. Does anyone know why changing the min sdk requirement would affect the opengl rendering? I can find no errors in the logs and I'm really at a loss to work out what is happening here. Thanks, Joe -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL texture display properly on my phone. But 'white box' on some device?
Hi. Sorry for taking so long to get back to you. It works now. =) The problem here is the alpha. I tried setting the alpha to 1.0 instead of 0.0 and it works. //solution gl.glColor4f(0.0f, 0.0f, 0.0f, 1.0f); Also thank you for the tips about drawable-nodpi/debugging the actual bitmap after decoding. Although it's not the case here(I tried debugging as you advise), it's good to know. =) Thank you everyone. =) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OpenGL texture display properly on my phone. But 'white box' on some device?
It seems like you are setting color to be completely transparent. Try setting alpha to 1.0 instead of 0.0? Also make sure that depth to -9 is visible. Quickly test with -1 for example. 17. mars. 2011 21.23 Robert Green rbgrn@gmail.com: Debug the actual bitmap dimensions after you decode it. It could be getting scaled if you don't have it in drawable-nodpi. I also remember something about clamp vs repeat with non-square power- of-two textures on some chips, but that may be for something else. I see you're not using mips here but if you do, remember they must be square, not just PoT. What dir is the texture file you're loading in? On Mar 17, 11:41 am, Kakyoin lgmc...@gmail.com wrote: *** Update *** Today I just updated m... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL - Works on Emulator, - Not on Phone
I forgot to say that the textures are all of power of 2. 2011/3/17 Terje Olsen terje...@gmail.com: Hello. I'm writing a simple game with OpenGL. I've been using the emulator to test it up until now, and it has worked fine there. Today I deployed it to my phone, and some parts of the rendering was not working. I load textures with the following settings. 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_LINEAR); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT); GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); Now, rectangles textures with a 1:1 size works on the phone. (A rectangle of dimension 16*16 with a texture of dimension 16*16 for example). However, my background, which utilizes the GL_REPEAT parameter to texture a a larger surface does not work. Neither does a background overlay which is essentially a vertex array of ~2000 vertices. Everything's just black. Are there any gotcha's I'm missing, or does anyone have an inkling as to why this is the case? Both Emulator and Phone are Android 2.1-Update 1. -Terje -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL texture display properly on my phone. But 'white box' on some device?
*** Update *** Today I just updated my Motorola Milestone to Android 2.2 and this bug is now happening on my device !! The texture was displaying fine when my Milestone was Android 2.1 yesterday. I hope this piece of info will greatly help solving this problem. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL texture display properly on my phone. But 'white box' on some device?
Debug the actual bitmap dimensions after you decode it. It could be getting scaled if you don't have it in drawable-nodpi. I also remember something about clamp vs repeat with non-square power- of-two textures on some chips, but that may be for something else. I see you're not using mips here but if you do, remember they must be square, not just PoT. What dir is the texture file you're loading in? On Mar 17, 11:41 am, Kakyoin lgmc...@gmail.com wrote: *** Update *** Today I just updated my Motorola Milestone to Android 2.2 and this bug is now happening on my device !! The texture was displaying fine when my Milestone was Android 2.1 yesterday. I hope this piece of info will greatly help solving this problem. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL texture display properly on my phone. But 'white box' on some device?
Looking at your code, it appears that the source image is in res/raw, which is a good practice for textures. It should insure that they don't prescale. Nonetheless, Robert's advice is good: debug into it and check the actual dimensions. In my experience, non-power-of-two dimensions is almost always the reason behind the dreaded white box. String -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL texture display properly on my phone. But 'white box' on some device?
It's usually either NPOT or not handling texture IDs and bindings correctly :) I've seen code where people made their own texture IDs incrementally as they didn't know to use glGenTextures - and it works on many drivers but certainly breaks on some. On Mar 17, 2:25 pm, String sterling.ud...@googlemail.com wrote: Looking at your code, it appears that the source image is in res/raw, which is a good practice for textures. It should insure that they don't prescale. Nonetheless, Robert's advice is good: debug into it and check the actual dimensions. In my experience, non-power-of-two dimensions is almost always the reason behind the dreaded white box. String -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 for Live Wallpapers
ok i found errors in your code: - you need to find the sTexture location in the shader program - texture non square doesn't work. I force 512*512 for the test For the second point, i have no idea why it works in an activity and not in the LWP. diff --git a/src/cxa/lineswallpaper/GLES20LinesRenderer.java b/src/cxa/ lineswallpaper/GLES20LinesRenderer.java index 7b9c5c5..730edec 100644 --- a/src/cxa/lineswallpaper/GLES20LinesRenderer.java +++ b/src/cxa/lineswallpaper/GLES20LinesRenderer.java @@ -80,6 +80,7 @@ public class GLES20LinesRenderer implements GLSurfaceView.Renderer { private int position_handle_; private int texture_handle_; + private int texture_loc_; private int line_MVP_matrix_handle_; private int line_position_handle_; @@ -236,8 +237,8 @@ public class GLES20LinesRenderer implements GLSurfaceView.Renderer { surface_width_ = width; surface_height_ = height; - framebuffer_width_ = width; - framebuffer_height_ = height; + framebuffer_width_ = 512;//width; + framebuffer_height_ = 512;//height; /* * framebuffer_width_ = 1 (int)(Math.log(width)/ Math.log(2)); * if(framebuffer_width_ == surface_width_) framebuffer_width_ = 1; @@ -265,6 +266,7 @@ public class GLES20LinesRenderer implements GLSurfaceView.Renderer { GLES20.glActiveTexture(GLES20.GL_TEXTURE0); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, target_texture_); +GLES20.glUniform1i(texture_loc_,0); triangle_vertices_.position(TRIANGLE_VERTICES_DATA_POS_OFFSET); GLES20.glVertexAttribPointer(position_handle_, 3, GLES20.GL_FLOAT, @@ -376,6 +378,13 @@ public class GLES20LinesRenderer implements GLSurfaceView.Renderer { throw new RuntimeException( Could not get attrib location for aTextureCoord); } +texture_loc_ = GLES20.glGetUniformLocation(program_, sTexture); +Log.i(lolo, + texture_loc_); +checkGlError(glGetAttribLocation sTexture); +if (texture_loc_ == -1) { +throw new RuntimeException( +Could not get attrib location for sTexture); +} MVP_matrix_handle_ = GLES20 .glGetUniformLocation(program_, uMVPMatrix); On 16 fév, 18:52, Michael meicpal...@gmail.com wrote: I am testing my live wallpaper on a Galaxy Tab, and it works. On Feb 16, 5:12 am, laurent mallet laurent.mal...@gmail.com wrote: The blurred lines livewallpaper doesn't work on Samsung Galaxy S (and Galaxy Tab), Droid, and Milestone. It works only on my Nexus One. The GLWallpaperService doesn't work either. We have a black screen or green screen. That's strange because many LWP with OpenGL ES 1.x as Aquarium are working. Using baksmali, we can see that they use thehttp://www.rbgrn.net/code. On 16 fév, 02:03, Michael meicpal...@gmail.com wrote: In the time before my first post was approved by the moderators, I found a solution athttps://github.com/ghisguth/blurred-lines-live/blob/master/src/cxa/li... . -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 for Live Wallpapers
My Galaxy Tab ROM is XWJJ4. The problem with OpenGL ES 2.0 Livewallpaper seems related to FBO. If i use them, it crashes on many phones. Only my N1 (CM7 alpha version 47) works. On 16 fév, 18:52, Michael meicpal...@gmail.com wrote: I am testing my live wallpaper on a Galaxy Tab, and it works. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 for Live Wallpapers
I tried your livewallpaper with the official (carier Orange) ROM on my GalaxyTab and it doesn't work either. The problem is clearly the FBO. When you use a FBO in a LiveWallPaper, on your main surface you will have a Black Screen. The problem doesn't really crash your phone but you have no painting. If i remove your FBO and draw lines without blur, your LWP is working on all my devices (N1, A101, Galaxy S, Galaxy Tab, Milestone ...) otherwise only N1. The same code in an Activity has no problem. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 for Live Wallpapers
The blurred lines livewallpaper doesn't work on Samsung Galaxy S (and Galaxy Tab), Droid, and Milestone. It works only on my Nexus One. The GLWallpaperService doesn't work either. We have a black screen or green screen. That's strange because many LWP with OpenGL ES 1.x as Aquarium are working. Using baksmali, we can see that they use the http://www.rbgrn.net/ code. On 16 fév, 02:03, Michael meicpal...@gmail.com wrote: In the time before my first post was approved by the moderators, I found a solution athttps://github.com/ghisguth/blurred-lines-live/blob/master/src/cxa/li... . -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 for Live Wallpapers
I am testing my live wallpaper on a Galaxy Tab, and it works. On Feb 16, 5:12 am, laurent mallet laurent.mal...@gmail.com wrote: The blurred lines livewallpaper doesn't work on Samsung Galaxy S (and Galaxy Tab), Droid, and Milestone. It works only on my Nexus One. The GLWallpaperService doesn't work either. We have a black screen or green screen. That's strange because many LWP with OpenGL ES 1.x as Aquarium are working. Using baksmali, we can see that they use thehttp://www.rbgrn.net/code. On 16 fév, 02:03, Michael meicpal...@gmail.com wrote: In the time before my first post was approved by the moderators, I found a solution athttps://github.com/ghisguth/blurred-lines-live/blob/master/src/cxa/li... . -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 for Live Wallpapers
Having used GLWallpaperService for several live wallpapers (and if you're reading this, Robert, my thanks) - albeit no OGLES2.0 - my advice would be to just extend it for the methods you need. It's a very straightforward port from GLSurfaceView; the methods line up very nicely, so if OGLES2.0 adds one that you need, just try implementing it with the same footprint, and see how it goes. String -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2.0 for Live Wallpapers
In the time before my first post was approved by the moderators, I found a solution at https://github.com/ghisguth/blurred-lines-live/blob/master/src/cxa/lineswallpaper/Wallpaper.java . -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL textures fail to load, white image
Have you looked at logcat? Are there any suspicious messages? Probably there's a problem with freeing bitmaps and you run out of memory. On Feb 14, 5:21 am, peter petero...@gmail.com wrote: Greetings, I've been having an interesting problem with a game I'm developing. The game is being built using the cocos2d-android-1 library. All sprites are loaded from ARGB files. They are of varying size (not powers of 2). When I deploy a test build to my Nexus One after making any code changes (anything that forces the device to redeploy the APK) all the sprites show up just fine. Alpha shows up correctly, etc. If I rerun the application from my N1, it will be missing some or all of the textures at random. Occasionally this is my splash screen sprite. Sometimes it is sprites of individual items on the screen. There doesn't seem to be any rhyme or reason as to what sprites are rendered and which are not. All the items move and behave correctly, but the sprites have been rendered with white textures. If I reboot my phone, the game loads fine for the initial play through, but subsequent play throughs have the bug again. Now I've done some research and it looks like some people had issues using non-power of 2 images for openGL textures. However this doesn't explain why my non-power of 2 textures render fine on the first passthrough, and fail on subsequent passthroughs. Also I've noticed that this problem seems to occur more often when I have the application loading images from the sdcard. If I load the images from the assets folder and use the AssetManager I don't run into the issue as much, although I did see it very rarely. Is there some type of file locking going on here that is preventing subsequent playthroughs from accessing the image file? When a bitmap is loaded, does it prevent other applications from reading the image file while it's in use? I'm going to try using sprite sheets and/or switching everything to use powers of 2, but I'm not sure if that will fix it. I swear it is something wrong with how the files are loaded (asset folder vs folder on sdcard) that is prevent subsequent playthroughs from correctly loading the texture. This is the code I'm using to read in the files: private static HashMapString, CCTexture2D textureMappings = new HashMapString, CCTexture2D(); public static final CCTexture2D addTexture(String filePath) { if(filePath.contains(../)) { return null; } CCTexture2D rtn = textureMappings.get(filePath); if (rtn == null) { String path = Constants.DEFAULT_PATH + filePath; File f = new File(path); if (f.exists()) { Bitmap bmp = BitmapFactory.decodeFile(Constants.DEFAULT_PATH + filePath); rtn = new CCTexture2D(bmp); textureMappings.put(filePath, rtn); } } return rtn; } This is the constructor for CCTexture2D: public CCTexture2D(Bitmap image) { CGSize imageSize = CGSize.make(image.getWidth(), image.getHeight()); CGAffineTransform transform = CGAffineTransform.identity(); int width = toPow2((int) imageSize.width); int height = toPow2((int) imageSize.height); while (width kMaxTextureSize || height kMaxTextureSize) { width /= 2; height /= 2; transform = transform.getTransformScale(0.5f, 0.5f); imageSize.width *= 0.5f; imageSize.height *= 0.5f; } if (imageSize.width != width || imageSize.height != height) { Bitmap bitmap = Bitmap.createBitmap(width, height, image.hasAlpha() ? Bitmap.Config.ARGB_ : Bitmap.Config.RGB_565); Canvas canvas = new Canvas(bitmap); canvas.drawBitmap(image, 0, 0, null); image.recycle(); image = bitmap; } init(image, imageSize); } This is what happens in init: private void init(Bitmap image, CGSize imageSize) { mBitmap = image; mWidth = image.getWidth(); mHeight = image.getHeight(); mContentSize = imageSize; // _format = image.getConfig(); _maxS = mContentSize.width / (float) mWidth; _maxT = mContentSize.height / (float) mHeight; _texParams = _gTexParams; ByteBuffer vfb = ByteBuffer.allocateDirect(4 * 3 * 4); vfb.order(ByteOrder.nativeOrder()); mVertices = vfb.asFloatBuffer(); ByteBuffer tfb = ByteBuffer.allocateDirect(4 * 2 * 4); tfb.order(ByteOrder.nativeOrder()); mCoordinates = tfb.asFloatBuffer(); if(mBitmap.getConfig() == Bitmap.Config.ARGB_)
[android-developers] Re: opengl textures
If not mipmapping, you can do rectangular powers of two (512x256, 1024x512) but if using mips, you need to keep it square (256x256, 512x512). Some devices can do non power of two, but a good rule of thumb is to always use it. If you have some reason not to, you can check the extensions for the NPOT extension and if it's present, you can use any dimensions under 2k I believe. On Feb 7, 10:23 am, Marcin Orlowski webnet.andr...@gmail.com wrote: On 7 February 2011 19:22, Marcin Orlowski webnet.andr...@gmail.com wrote: On 7 February 2011 18:57, bob b...@coolgroups.com wrote: Do opengl textures on Android have to be a width and height that is a power of 2? In general: yes as some devices will won't handle your textures otherwise. It applies to width (for quite obvious reasons), yet I am not sure about height and can't check now. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: opengl textures
Non-power-of-2 textures became a standard feature in OpenGL ES 2.0, so if you're using that, you can rely on them being supported. Peter -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL Problem with Sphere Texture Mapping
I solved all my problmes, there was a little stupid little issues during the copy of my Vertex and CoordTexture on the buffers... Thanks lot however, the theory I read is a good exercise for the next time! Bye! On 28 Dic, 01:52, Robert Green rbgrn@gmail.com wrote: Well said Kostya. Pedro - I defined the formula to get your normal above. A normal is a unit vector (a 3D vector of length 1.) Each vertex must have a normal for proper shading, as that's how light is calculated. The normal of a vertex of a sphere is a easy to calculate. Think of it as the direction from the center of the sphere through the vertex. That's your vector. I provided a formula, though you'll have to javafy it a little to make that work for you. If you're struggling to understand this, I suggest reading some 3D primer books before moving on. They are very, very helpful. Cheers On Dec 27, 7:59 am, Kostya Vasilyev kmans...@gmail.com wrote: Pedro, A normal is a unit vector (length == 1) that is perpendicular to the surface. Normals are used for shading, so don't worry about them too much for now. Texture coordinates, as was already pointed out here, are in 2D space, i.e. two coordinates. The reason is that textures are 2-dimensional, and texture coordinates specify which point within the texture should be mapped to a particular vertex in 3D space. Imagine that the texture is a stretchable, initially square, piece of fabric. Each UV coordinate represents a point within that square. For each vertex, the point within the texture specified for that vertex by UV coordinates is glued to the vertex. Then the texture is allowed to stretch between vertexes. What sort of texture coordinates you generate is entirely up to you. A simple way to texture map a sphere is to wrap the texture into a vertical cylinder around the sphere, then pull the top and bottom towards the sphere, so you have singularities at the top and bottom of the sphere. If you generate your sphere as a bunch of horizontal bands, each having equal angular size, and further subdivided around into equal patches, then you can your use loop variables (band / patch index) to compute UV coordinates. Just remember that UV are 0 to 1 (unless you want tiling). -- Kostya 27.12.2010 18:35, pedr0 пишет: But normal.x what is it? Is the abs(x) ? On 23 Dic, 20:41, Robert Greenrbgrn@gmail.com wrote: UV unwrapping/mapping is standard practice in 3d games. It's how the artist lines up the textures onto the skin/model. You're doing UV coordinate generation, which is similar but is mathematically specified instead of placed by a 3D modeling application. On Dec 23, 12:37 am, pedr0pulsarpie...@gmail.com wrote: What do you think about it? http://en.wikipedia.org/wiki/UV_mapping On 23 Dic, 09:19, pedr0pulsarpie...@gmail.com wrote: Thanks a lot, especially at Robert Green for his very good explanation! The absurd thing is that the code which I posted above is 100% right in a iPhone iOS, but when I port the same code on the Android platform I have these issues. I will try to do what you are talking about normals and I let you know about my progress! Thanks again. pedr0 On 23 Dic, 04:10, Mario Zechnerbadlogicga...@gmail.com wrote: On 22 Dez., 20:42, Robert Greenrbgrn@gmail.com wrote: 3DVec normal = (sphereCenter - point).normalize(); 3DVec normal = (point - sphereCenter).normalize(); Or your world will be upside down. Unless my brain is totally borked :) (could well be, 4am here...) -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: openGL problem
I'm not sure why are you disabling depth test for a sphere and also you should clear color/depth buffer in onDrawFrame On Dec 27, 12:10 pm, pedr0 pulsarpie...@gmail.com wrote: img198(dot)imageshack(dot)us/img198/6370/failfs.png -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: openGL problem
This a link of my issues -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: openGL problem
img198(dot)imageshack(dot)us/img198/6370/failfs.png -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL Problem with Sphere Texture Mapping
But normal.x what is it? Is the abs(x) ? On 23 Dic, 20:41, Robert Green rbgrn@gmail.com wrote: UV unwrapping/mapping is standard practice in 3d games. It's how the artist lines up the textures onto the skin/model. You're doing UV coordinate generation, which is similar but is mathematically specified instead of placed by a 3D modeling application. On Dec 23, 12:37 am, pedr0 pulsarpie...@gmail.com wrote: What do you think about it? http://en.wikipedia.org/wiki/UV_mapping On 23 Dic, 09:19, pedr0 pulsarpie...@gmail.com wrote: Thanks a lot, especially at Robert Green for his very good explanation! The absurd thing is that the code which I posted above is 100% right in a iPhone iOS, but when I port the same code on the Android platform I have these issues. I will try to do what you are talking about normals and I let you know about my progress! Thanks again. pedr0 On 23 Dic, 04:10, Mario Zechner badlogicga...@gmail.com wrote: On 22 Dez., 20:42, Robert Green rbgrn@gmail.com wrote: 3DVec normal = (sphereCenter - point).normalize(); 3DVec normal = (point - sphereCenter).normalize(); Or your world will be upside down. Unless my brain is totally borked :) (could well be, 4am here...) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OpenGL Problem with Sphere Texture Mapping
Pedro, A normal is a unit vector (length == 1) that is perpendicular to the surface. Normals are used for shading, so don't worry about them too much for now. Texture coordinates, as was already pointed out here, are in 2D space, i.e. two coordinates. The reason is that textures are 2-dimensional, and texture coordinates specify which point within the texture should be mapped to a particular vertex in 3D space. Imagine that the texture is a stretchable, initially square, piece of fabric. Each UV coordinate represents a point within that square. For each vertex, the point within the texture specified for that vertex by UV coordinates is glued to the vertex. Then the texture is allowed to stretch between vertexes. What sort of texture coordinates you generate is entirely up to you. A simple way to texture map a sphere is to wrap the texture into a vertical cylinder around the sphere, then pull the top and bottom towards the sphere, so you have singularities at the top and bottom of the sphere. If you generate your sphere as a bunch of horizontal bands, each having equal angular size, and further subdivided around into equal patches, then you can your use loop variables (band / patch index) to compute UV coordinates. Just remember that UV are 0 to 1 (unless you want tiling). -- Kostya 27.12.2010 18:35, pedr0 пишет: But normal.x what is it? Is the abs(x) ? On 23 Dic, 20:41, Robert Greenrbgrn@gmail.com wrote: UV unwrapping/mapping is standard practice in 3d games. It's how the artist lines up the textures onto the skin/model. You're doing UV coordinate generation, which is similar but is mathematically specified instead of placed by a 3D modeling application. On Dec 23, 12:37 am, pedr0pulsarpie...@gmail.com wrote: What do you think about it? http://en.wikipedia.org/wiki/UV_mapping On 23 Dic, 09:19, pedr0pulsarpie...@gmail.com wrote: Thanks a lot, especially at Robert Green for his very good explanation! The absurd thing is that the code which I posted above is 100% right in a iPhone iOS, but when I port the same code on the Android platform I have these issues. I will try to do what you are talking about normals and I let you know about my progress! Thanks again. pedr0 On 23 Dic, 04:10, Mario Zechnerbadlogicga...@gmail.com wrote: On 22 Dez., 20:42, Robert Greenrbgrn@gmail.com wrote: 3DVec normal = (sphereCenter - point).normalize(); 3DVec normal = (point - sphereCenter).normalize(); Or your world will be upside down. Unless my brain is totally borked :) (could well be, 4am here...) -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL Problem with Sphere Texture Mapping
Well said Kostya. Pedro - I defined the formula to get your normal above. A normal is a unit vector (a 3D vector of length 1.) Each vertex must have a normal for proper shading, as that's how light is calculated. The normal of a vertex of a sphere is a easy to calculate. Think of it as the direction from the center of the sphere through the vertex. That's your vector. I provided a formula, though you'll have to javafy it a little to make that work for you. If you're struggling to understand this, I suggest reading some 3D primer books before moving on. They are very, very helpful. Cheers On Dec 27, 7:59 am, Kostya Vasilyev kmans...@gmail.com wrote: Pedro, A normal is a unit vector (length == 1) that is perpendicular to the surface. Normals are used for shading, so don't worry about them too much for now. Texture coordinates, as was already pointed out here, are in 2D space, i.e. two coordinates. The reason is that textures are 2-dimensional, and texture coordinates specify which point within the texture should be mapped to a particular vertex in 3D space. Imagine that the texture is a stretchable, initially square, piece of fabric. Each UV coordinate represents a point within that square. For each vertex, the point within the texture specified for that vertex by UV coordinates is glued to the vertex. Then the texture is allowed to stretch between vertexes. What sort of texture coordinates you generate is entirely up to you. A simple way to texture map a sphere is to wrap the texture into a vertical cylinder around the sphere, then pull the top and bottom towards the sphere, so you have singularities at the top and bottom of the sphere. If you generate your sphere as a bunch of horizontal bands, each having equal angular size, and further subdivided around into equal patches, then you can your use loop variables (band / patch index) to compute UV coordinates. Just remember that UV are 0 to 1 (unless you want tiling). -- Kostya 27.12.2010 18:35, pedr0 пишет: But normal.x what is it? Is the abs(x) ? On 23 Dic, 20:41, Robert Greenrbgrn@gmail.com wrote: UV unwrapping/mapping is standard practice in 3d games. It's how the artist lines up the textures onto the skin/model. You're doing UV coordinate generation, which is similar but is mathematically specified instead of placed by a 3D modeling application. On Dec 23, 12:37 am, pedr0pulsarpie...@gmail.com wrote: What do you think about it? http://en.wikipedia.org/wiki/UV_mapping On 23 Dic, 09:19, pedr0pulsarpie...@gmail.com wrote: Thanks a lot, especially at Robert Green for his very good explanation! The absurd thing is that the code which I posted above is 100% right in a iPhone iOS, but when I port the same code on the Android platform I have these issues. I will try to do what you are talking about normals and I let you know about my progress! Thanks again. pedr0 On 23 Dic, 04:10, Mario Zechnerbadlogicga...@gmail.com wrote: On 22 Dez., 20:42, Robert Greenrbgrn@gmail.com wrote: 3DVec normal = (sphereCenter - point).normalize(); 3DVec normal = (point - sphereCenter).normalize(); Or your world will be upside down. Unless my brain is totally borked :) (could well be, 4am here...) -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL Problem with Sphere Texture Mapping
Thanks a lot, especially at Robert Green for his very good explanation! The absurd thing is that the code which I posted above is 100% right in a iPhone iOS, but when I port the same code on the Android platform I have these issues. I will try to do what you are talking about normals and I let you know about my progress! Thanks again. pedr0 On 23 Dic, 04:10, Mario Zechner badlogicga...@gmail.com wrote: On 22 Dez., 20:42, Robert Green rbgrn@gmail.com wrote: 3DVec normal = (sphereCenter - point).normalize(); 3DVec normal = (point - sphereCenter).normalize(); Or your world will be upside down. Unless my brain is totally borked :) (could well be, 4am here...) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL Problem with Sphere Texture Mapping
What do you think about it? http://en.wikipedia.org/wiki/UV_mapping On 23 Dic, 09:19, pedr0 pulsarpie...@gmail.com wrote: Thanks a lot, especially at Robert Green for his very good explanation! The absurd thing is that the code which I posted above is 100% right in a iPhone iOS, but when I port the same code on the Android platform I have these issues. I will try to do what you are talking about normals and I let you know about my progress! Thanks again. pedr0 On 23 Dic, 04:10, Mario Zechner badlogicga...@gmail.com wrote: On 22 Dez., 20:42, Robert Green rbgrn@gmail.com wrote: 3DVec normal = (sphereCenter - point).normalize(); 3DVec normal = (point - sphereCenter).normalize(); Or your world will be upside down. Unless my brain is totally borked :) (could well be, 4am here...) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL Problem with Sphere Texture Mapping
UV unwrapping/mapping is standard practice in 3d games. It's how the artist lines up the textures onto the skin/model. You're doing UV coordinate generation, which is similar but is mathematically specified instead of placed by a 3D modeling application. On Dec 23, 12:37 am, pedr0 pulsarpie...@gmail.com wrote: What do you think about it? http://en.wikipedia.org/wiki/UV_mapping On 23 Dic, 09:19, pedr0 pulsarpie...@gmail.com wrote: Thanks a lot, especially at Robert Green for his very good explanation! The absurd thing is that the code which I posted above is 100% right in a iPhone iOS, but when I port the same code on the Android platform I have these issues. I will try to do what you are talking about normals and I let you know about my progress! Thanks again. pedr0 On 23 Dic, 04:10, Mario Zechner badlogicga...@gmail.com wrote: On 22 Dez., 20:42, Robert Green rbgrn@gmail.com wrote: 3DVec normal = (sphereCenter - point).normalize(); 3DVec normal = (point - sphereCenter).normalize(); Or your world will be upside down. Unless my brain is totally borked :) (could well be, 4am here...) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL Problem with Sphere Texture Mapping
pedro, your problem has nothing to do with android. I think you may need a 3D refresher to solve it. Normals are not UVs. Your UVs will depend on how you want to map, but the easiest way to do it is to map from the sphere center out using angles, like this. Since GL has 2D texture coordinate 0,0 as upper left, you will want to define where upper left is on your sphere. I'd use straight up and center as a unit vector, or (0, 0, 1) if z is up in your world. If y is up, then (0,1,0) will be 0,0 in UVs. so starting with that, you can calculate the UV of any point by getting the difference of angle of that starting angle and the new point. Remember that if they both come from the sphere center, you'll have complete 2PI radian coverage on both axis... so naturally dividing the resulting angle by 2PI will give you a UV number between 0 and 1. The process is like this (assuming z=up) For each point: // for U just look at the sphere from overhead U = (atan2(point.x - center.x, point.y - center.y) + PI) / (2PI) hyp = distance(point, center); V = ((point.z - center.z) / hyp) + 1) / 2 I believe that is correct and there will be a more elegant way to do it but today my head is in 2D math world so I can't remember how to dot it out. The idea though is that for every point, you can determine the angle needed for U by looking at the sphere from overhead and just using an arctan of the xy differences (assuming z=up) of the center to the point. The resulting range is in radians (- PI to PI) so you have to add PI to change it from 0 to 2PI and then dividing by 2PI gives you 0 to 1. Then for the V value, you can just examine the height (z) of the point and in conjunction with its distance from the center, you've got an opposite over hypotenuse which is the same as the sine of the angle, which is what you want to get a evenly distributed texture top to bottom. The number will also be ranged from -1 to 1 so you need to add 1 and divide it by 2 to get the 0 to 1 range. The texture should touch in the corners and if you use the right one, look seamless. If any of my math is wrong, please correct it after debugging, but at least this should get you going in the right direction. Cheers On Dec 22, 9:09 am, pedr0 pulsarpie...@gmail.com wrote: Please see the link and reply inside this post if you have not an account on OpenGL forum, the question is over there. http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflatN... Thanks a lot. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL Problem with Sphere Texture Mapping
Also I should add that your sphere normal should be (sphereCenter - point).Normalize() and will be a 3D vector. Normals are 3D, UVs are 2D. On Dec 22, 9:09 am, pedr0 pulsarpie...@gmail.com wrote: Please see the link and reply inside this post if you have not an account on OpenGL forum, the question is over there. http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflatN... Thanks a lot. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL Problem with Sphere Texture Mapping
Oh here is a faster method - http://www.mvps.org/directx/articles/spheremap.htm For each point (Assuming Y=up): 3DVec normal = (sphereCenter - point).normalize(); float U = asin(normal.x)/PI + 0.5 float V = asin(normal.y)/PI + 0.5 for z=up: float U = asin(normal.x)/PI + 0.5 float V = asin(normal.z)/PI + 0.5 But in your code example I don't know if you were calculating normals correctly. Your normal should be a vector pointing from the center of your sphere out the vertex, which is done by subtracting and then normalizing to make it a unit-vector. On Dec 22, 11:33 am, Robert Green rbgrn@gmail.com wrote: pedro, your problem has nothing to do with android. I think you may need a 3D refresher to solve it. Normals are not UVs. Your UVs will depend on how you want to map, but the easiest way to do it is to map from the sphere center out using angles, like this. Since GL has 2D texture coordinate 0,0 as upper left, you will want to define where upper left is on your sphere. I'd use straight up and center as a unit vector, or (0, 0, 1) if z is up in your world. If y is up, then (0,1,0) will be 0,0 in UVs. so starting with that, you can calculate the UV of any point by getting the difference of angle of that starting angle and the new point. Remember that if they both come from the sphere center, you'll have complete 2PI radian coverage on both axis... so naturally dividing the resulting angle by 2PI will give you a UV number between 0 and 1. The process is like this (assuming z=up) For each point: // for U just look at the sphere from overhead U = (atan2(point.x - center.x, point.y - center.y) + PI) / (2PI) hyp = distance(point, center); V = ((point.z - center.z) / hyp) + 1) / 2 I believe that is correct and there will be a more elegant way to do it but today my head is in 2D math world so I can't remember how to dot it out. The idea though is that for every point, you can determine the angle needed for U by looking at the sphere from overhead and just using an arctan of the xy differences (assuming z=up) of the center to the point. The resulting range is in radians (- PI to PI) so you have to add PI to change it from 0 to 2PI and then dividing by 2PI gives you 0 to 1. Then for the V value, you can just examine the height (z) of the point and in conjunction with its distance from the center, you've got an opposite over hypotenuse which is the same as the sine of the angle, which is what you want to get a evenly distributed texture top to bottom. The number will also be ranged from -1 to 1 so you need to add 1 and divide it by 2 to get the 0 to 1 range. The texture should touch in the corners and if you use the right one, look seamless. If any of my math is wrong, please correct it after debugging, but at least this should get you going in the right direction. Cheers On Dec 22, 9:09 am, pedr0 pulsarpie...@gmail.com wrote: Please see the link and reply inside this post if you have not an account on OpenGL forum, the question is over there. http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflatN... Thanks a lot. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL Problem with Sphere Texture Mapping
On 22 Dez., 20:42, Robert Green rbgrn@gmail.com wrote: 3DVec normal = (sphereCenter - point).normalize(); 3DVec normal = (point - sphereCenter).normalize(); Or your world will be upside down. Unless my brain is totally borked :) (could well be, 4am here...) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: openGL ES animation rendering is coming out choppy
For first gen devices, 20,000 triangles is way too many to get a good framerate. I found that anything over about 2500 becomes a burden for them. New devices should be able to handle 20k much better. What device are you testing on? On Dec 13, 3:27 pm, Avtar Khalsa akhals...@gmail.com wrote: Hi All I am an Android beginner working with openGL ES to try to make some simple 3d animations. I only have one glDrawElements call per screen refresh and I have it set to RENDERMODE_CONTINUOUSLY. Unfortunately, for some reason, my animation is coming out very choppy with a frame rate of around 2FPS. I am drawing about 20,000 triangles, but I would think that is not too many considering some of the complex things you can render. I would be happy to post my code if anyone has any thoughts on why the animation might be so choppy? Thanks in advance Avtar -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL on multiple threads with sharegroups
Yes, it does. http://code.google.com/p/earth-live-wallpaper/source/browse/trunk/+earth-live-wallpaper/SLWP/src/com/seb/SLWP/GLWallpaperService.java?r=37 On Nov 26, 4:20 am, Phil Endecott spam_from_goo...@chezphil.org wrote: On Nov 26, 11:08 am, Adam Hammer adamhamm...@gmail.com wrote: I do bitmap loading in another thread, but I do glBindTexture in the main graphics thread. Works well for me, I load bitmaps stored in zips delivered by contentproviders into textures. Yes; thanks; I'm actually doing something like that at the moment, and it's not ideal. (I think you mean calling glTexImage2D(), not just glBindTexture(), don't you?) I think opengl es does have mechanisms for sharing textures across GL contexts Yes. I've investigated some more and eglCreateContext() takes an EGLContext to share from: If share_context is not EGL_NO_CONTEXT, then all shareable data ... will be shared by share_context ... and the newly created context (from the EGL spec, section 3.7.1.) So the question is, can I call eglCreateContext() from my C++ code, and/or is there a way to access this functionality from Java? Looking through the Java docs I have found the EGLContext and EGLContextFactory reference pages, but they are almost totally content- free. Does Android really implement EGL? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL on multiple threads with sharegroups
Hi Adam, On Dec 6, 11:26 am, Adam Hammer adamhamm...@gmail.com wrote: Yes, it does. Not sure exactly what you're replying to there. Maybe this: Does Android really implement EGL? Anyway, based on this: http://groups.google.com/group/android-ndk/browse_thread/thread/6d60f6bcc5cec83a (See Dianne Hackborn's reply dated Dec 1, 6:48 am) I've decided not to try to create multiple contexts in different threads for the time being, since they're unlikely to work reliably. Thanks, Phil. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL on multiple threads with sharegroups
On Nov 26, 5:29 am, String sterling.ud...@googlemail.com wrote: Is that an OpenGL ES feature, or something specific to iOS? My understanding is that creating OpenGL contexts is always platform- specific. EGL seems to define textures and vertex buffers as shared by default; see section 2.4 of the EGL spec (http://www.khronos.org/registry/egl/ specs/eglspec.1.4.20101006.pdf). Does Android claim to support EGL? Earlier I found another post saying that this didn't work, but now I can't find it... Generally, all your Android threads run in one process, and it's not hard to share data between them. Might it be possible to save your OpenGL context from your rendering thread, then use it to create textures in another thread? You would need a mutex since there is so much state in the context (currently bound texture, etc). So it would be easier to move everything onto one thread. Thanks, Phil. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL on multiple threads with sharegroups
I do bitmap loading in another thread, but I do glBindTexture in the main graphics thread. Works well for me, I load bitmaps stored in zips delivered by contentproviders into textures. I think opengl es does have mechanisms for sharing textures across GL contexts, but the above method should be fine, except for a slight delay when the actual bindtexture happens. Adam On Nov 25, 8:44 am, Phil Endecott spam_from_goo...@chezphil.org wrote: Dear All, I'm porting some iPhone OpenGL code that uses a separate thread for OpenGL texture loading. To do this, I create a new OpenGL context in the same sharegroup as the main rendering context, and then the textures loaded in one context are available to the other. I've not seen any equivalent to this on Android. Is this correct, or am I missing something? My code is C++, but as far as I can see the situation is the same for Java OpenGL code. Thanks for any suggestions. Phil. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL on multiple threads with sharegroups
On Nov 26, 11:08 am, Adam Hammer adamhamm...@gmail.com wrote: I do bitmap loading in another thread, but I do glBindTexture in the main graphics thread. Works well for me, I load bitmaps stored in zips delivered by contentproviders into textures. Yes; thanks; I'm actually doing something like that at the moment, and it's not ideal. (I think you mean calling glTexImage2D(), not just glBindTexture(), don't you?) I think opengl es does have mechanisms for sharing textures across GL contexts Yes. I've investigated some more and eglCreateContext() takes an EGLContext to share from: If share_context is not EGL_NO_CONTEXT, then all shareable data ... will be shared by share_context ... and the newly created context (from the EGL spec, section 3.7.1.) So the question is, can I call eglCreateContext() from my C++ code, and/or is there a way to access this functionality from Java? Looking through the Java docs I have found the EGLContext and EGLContextFactory reference pages, but they are almost totally content- free. Does Android really implement EGL? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL on multiple threads with sharegroups
On Nov 25, 4:44 pm, Phil Endecott spam_from_goo...@chezphil.org wrote: I'm porting some iPhone OpenGL code that uses a separate thread for OpenGL texture loading. To do this, I create a new OpenGL context in the same sharegroup as the main rendering context, and then the textures loaded in one context are available to the other. Is that an OpenGL ES feature, or something specific to iOS? Generally, all your Android threads run in one process, and it's not hard to share data between them. Might it be possible to save your OpenGL context from your rendering thread, then use it to create textures in another thread? One approach would be static vars in your rendering subclass: static GL10 glContext; static int textures[] = new int[3]; public void onSurfaceCreated(GL10 gl, EGLConfig config) { glContext = gl; gl.glGenTextures(3, textures, 0); ... } Something like that might work, anyway. String -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL glScissor not working on HTC phones
I do not do a gl.glClear(GL10.GL_COLOR_BUFFER_BIT); so the bits that were drawn previously should remain. Actually this isn't the default behavior. I think you need to request EGL_BUFFER_PRESERVED for the EGL_SWAP_BEHAVIOR. Unfortunately this currently (froyo) isn't possible because Android only supports EGL 1.0 + some extensions. The eglSurfaceAttrib() API entry point was added at a later version of EGL. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL glScissor not working on HTC phones
Try to render static part of the screen twice so both back and front buffers have the same content. However I think it's better to render static scene, store it as texture and draw simple quad at the beginning of each frame. On Nov 14, 7:42 pm, Jeff Boody jeffbo...@gmail.com wrote: I do not do a gl.glClear(GL10.GL_COLOR_BUFFER_BIT); so the bits that were drawn previously should remain. Actually this isn't the default behavior. I think you need to request EGL_BUFFER_PRESERVED for the EGL_SWAP_BEHAVIOR. Unfortunately this currently (froyo) isn't possible because Android only supports EGL 1.0 + some extensions. The eglSurfaceAttrib() API entry point was added at a later version of EGL. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL glScissor not working on HTC phones
I also tested this on an HTC Droid Incredible with the same bad result there. Also, I tested by only drawing over part of the background instead of using glScissor(). Same result again. It would appear that the OpenGl library on HTC phones fills the color buffer with garbage on each swap. Why would this happen? Does anyone know if HTC changed the OpenGl library on its phones? Is there a place to file a bug report just for HTC versions of Android? Warren On Nov 10, 4:25 pm, Warren warrenba...@gmail.com wrote: I am optimizing a game for performance. A large part of the screen remains the same from frame to frame and it takes a while to render, so I intend to use glScissor() to limit new drawing to only certain parts of the screen. I do not do a gl.glClear(GL10.GL_COLOR_BUFFER_BIT); so the bits that were drawn previously should remain. This provides a large speed increase and works very well on the Droid and on the emulator. However, it is not working on the G1 or Droid Eris, both made by HTC. The areas outside the scissor region are still being drawn over in a strange way. It's as if what's being drawn inside the scissor region is being wrapped outside the region. There is a large rectangle in the middle of the screen that has the correct contents. This is the defined scissor region. Immediately below the scissor region is a row, maybe 150-200 pixels high that looks like an exact copy of the bottom of the scissor region. Again, this only is happening on the HTC phones. I believe that unless I specifically clear the color bits, they should remain from frame to frame. Is this correct? Any ideas? Is this an HTC OpenGL library bug? Thank you, Warren -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL more textures for one rect
This is what glBindTexture() is for :) On Nov 1, 3:15 pm, AFgan adolfaild...@gmail.com wrote: In Android OpenGL ES, I want to be able to switch textures for a given Rectangle. I have one rect and I put two textures, depending on different conditions. I just want to switch between textures. I followed this code to create the textures:http://blog.poweredbytoast.com/loading-opengl-textures-in-androidbut it seems that this is only for one texture. If I use only one texture, it renders fine, but then I don't know how to tell the rect to use another texture (same rect, different texture). Do I do something like setTexture with the ID that is generated in loadTextures()? Do I have to have an array with texture names (numbers) that I then change .. I just don't get it.. Help is really appreciated. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2D and 3D mixed graphics?
Thanks for the advice, guys. Googling OpenGL HUD is a step in the right direction for anyone else looking to do this. Here's some quick code: private void viewOrtho2(GL10 gl, int x, int y) { // Set Up An Ortho View gl.glDisable(GL10.GL_DEPTH_TEST); gl.glMatrixMode(GL10.GL_PROJECTION); // Select Projection gl.glPushMatrix(); // Push The Matrix gl.glLoadIdentity(); // Reset The Matrix gl.glOrthof(0, x, 0, y, -5, 1); // Select Ortho Mode gl.glMatrixMode(GL10.GL_MODELVIEW); // Select Modelview Matrix gl.glLoadIdentity(); // Reset The Matrix // This fixes some 2D perspective issues gl.glTranslatef(0.375f, 0.375f, 0.375f); } Test it out with some squares: private void testmethod(GL10 gl) { ByteBuffer vbb = ByteBuffer.allocateDirect(squareVertices.length * 4); vbb.order(ByteOrder.nativeOrder()); FloatBuffer vertexBuffer = vbb.asFloatBuffer(); vertexBuffer.put(squareVertices); vertexBuffer.position(0); gl.glLineWidth(3.0f); gl.glColor4f(0.0f, 0.0f, 1.0f, 1.0f); // blue gl.glTranslatef(5.0f, 0.0f, 0.0f); gl.glVertexPointer(2, GL10.GL_FLOAT, 0, vertexBuffer); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, 4); gl.glTranslatef(100.0f, 0.0f, 0.0f); gl.glColor4f(1.0f, 0.0f, 0.0f, 1.0f); // Red gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, 4); gl.glTranslatef(100.0f, 0.0f, 0.0f); gl.glColor4f(1.0f, 1.0f, 0.0f, 1.0f); // Yellow gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, 4); // Switch back to the previous view gl.glEnable(GL10.GL_DEPTH_TEST); gl.glMatrixMode(GL10.GL_PROJECTION); gl.glPopMatrix(); gl.glMatrixMode(GL10.GL_MODELVIEW); } This essentially shows how, even in a 3D display, you can switch to a 2D projection. Key lines of code: gl.glOrthof(0, x, 0, y, -5, 1); // Select Ortho Mode by mapping (0,0)- (width,height) (320x480) gl.glDisable(GL10.GL_DEPTH_TEST); // Remove 3D depth testing -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2D and 3D mixed graphics?
well you can create an orthoview with the dimensions of the screen. ie glOrtho(0,0,320,480,0,20); then you can use pixel coords to draw your stuff.. it would be non perspective though. Peter On 29 Okt., 04:40, Matt Quigley matthew.quig...@gmail.com wrote: I'm making a 2D game, with sprites drawn using the glDrawTexfOES() method. I'm wondering if there are ways to draw things like lines and squares along side this. Now, I know that technically there's nothing stopping me from drawing 3D cubes and such. But, you see, glDrawTexfOES draws using pixel coordinates, i.e. draw texture at 30,30. What I'd like is a similar approach to boxes and lines, using pixel coordinates, i.e. draw line from (5,5) to (10,10). Is this possible? I don't want to simulate 3D coordinates because it would be very hard to try to get the camera and perspective in such a perfect way where I could say draw cube from (5,5,0) to (10,10,0), as well as from (300,300,0) to (310, 310, 0), with no perspective warping in the different corners. (Also, as a backup plan I can always create my line and box effects with sprite textures as well, but I thought I'd ask) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: OpenGL ES 2D and 3D mixed graphics?
I just draw all my 3d stuff using a projection matrix, and then I just change the projection matrix and clear the depth buffer and draw all the 2d stuff. As for coordinates, in opengl you set them whatever you want to be. I use floats, you can use ints, I use -1 to 1, you can use 1000 to 10,000 if you want. Study the projection matrix more if you want to know how to switch between 2d and 3d. Adam On Oct 28, 7:40 pm, Matt Quigley matthew.quig...@gmail.com wrote: I'm making a 2D game, with sprites drawn using the glDrawTexfOES() method. I'm wondering if there are ways to draw things like lines and squares along side this. Now, I know that technically there's nothing stopping me from drawing 3D cubes and such. But, you see, glDrawTexfOES draws using pixel coordinates, i.e. draw texture at 30,30. What I'd like is a similar approach to boxes and lines, using pixel coordinates, i.e. draw line from (5,5) to (10,10). Is this possible? I don't want to simulate 3D coordinates because it would be very hard to try to get the camera and perspective in such a perfect way where I could say draw cube from (5,5,0) to (10,10,0), as well as from (300,300,0) to (310, 310, 0), with no perspective warping in the different corners. (Also, as a backup plan I can always create my line and box effects with sprite textures as well, but I thought I'd ask) -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en