Android :: OpenGL More Textures For One Rect
Nov 1, 2010
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-android but 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..
View 2 Replies
Nov 1, 2010
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: link text
and they render fine, but then I don't know how to tell the given rect to use another 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..
View 1 Replies
View Related
Feb 17, 2010
I'm learning OpenGL on my own atm and I have a question about texturing a surface:
I can create a simple polygon like this:
CODE:......
Then I load all of that info into the approriate buffers and draw it to the screen with a call to:
CODE:..
My question:
I'm looking for a good example of how to take an image and texture it to the surface.
View 4 Replies
View Related
Jun 21, 2010
I can't seem to get GLUtils.texImage2D to use my full RGBA (A=my alpha component).
I've tried doing setEGLConfigChooser(8, 8, 8, 8, 0, 0); getHolder().setFormat(PixelFormat.RGBA_8888);
I've tried converting the source image (.png in ARGB) to RGBA.. which works ok for the ordering of data before texImage2D, but when it draws, it draws yellow where it should be "transparent white"... which suggests it's diminishing the "B"(blue) component instead of the A(alpha) component. But the same thing happens when I just use the orignal ARGB data instead ("B" diminishes instead of "A", leaving yellow).
View 5 Replies
View Related
Feb 19, 2010
I need to enlarge(Zoom) Textures when I hold&drag at the corners.
I am using glOrtho() to setup ModelView.
CODE:.............
I am able to do hit-test and detect corners of the images(Textures) on the screen.
Now I need to enlarge(zoom) the image(texture). I have offset values, means how far I moved on the screen in X,Y directions.
If I need to use glScalef(), it will accept values in percentage(I think). How can I map the offset values to this percentage value.
or is there any other way to zoom(ie by enlarging the background polygon vertices, so that the mapped texture will automatically get zoomed) ? In this method, I am fixing the polygon sides at time of Surface Creation.
View 1 Replies
View Related
Mar 23, 2010
Good pattern for loading textures in an Android Java & OpenGL ES app.
My first concern is determining how many texture names to allocate and how I can efficiently go about doing this prior to rendering my vertices.
My second concern is in loading the textures, I have to infer the texture to be loaded based on my game data. This means I'll be playing around with strings, which I understand is something I really shouldn't be doing in my GL thread.
Overall I understand what's happening when loading textures, I just want to get the best lifecycle out of it. Are there any other things I should be considering?
View 1 Replies
View Related
Jul 2, 2009
I have a texture-mapped cube based in part on the Kube API demo and the Textured Cube example from anddev.org, It is working fine using bitmaps loaded from R.drawable.. what I need to do now is to make the texture for each face dynamic (using Bitmaps created in code). I'm having trouble understanding how to change the textures on the fly and I'm hoping someone can point me in the right direction.What would I need to change in this code to allow an existing texture to be replaced (eg. a new Bitmap would be passed in instead of loading the resource, but when I try this the texture remains unchanged).
View 5 Replies
View Related
Jun 19, 2010
How do I track the memory used by OpenGL textures in Android? I understand the texture memory is on the Video RAM, but do they get swapped in with the RAM? If I call glGenTextures and do not call glDeleteTextures, how does it impact the memory usage of my current process?
View 1 Replies
View Related
Jan 30, 2010
So I'm doing some simple 2D stuff with OpenGL on Android and found the performance to be very, very poor. To give you an example, I made an app with a full screen LSurfaceView. I loaded a 512x1024 texture (containing a 480x854 image), set up an orthogonal 2D matrix, and set it to draw a 480x854 pixel quad with that texture, using vertex and texture arrays. Lighting, dither, blending, etc. is disabled.
I would expect this to run at 60fps without problem, but that simple operation already drags the frame drawing time to 19ms/frame. If I add some more small textured quads around the screen, the drawing time goes up to 22/24ms. If I enable blending it balloons to 28/30ms. This is testing on a Motorola Milestone, running 2.0.1. Is this normal? Am I doing something wrong or is it just a common problem in Android?
View 24 Replies
View Related
Dec 28, 2009
I ran into a rather strange problem with my OpenGL game. While most textures look good, five or six are not drawn on Droid, and I don't see anything special about these images/models. For example, my HUD is made of 4 elements. The upper part is drawn correctly, while the lower part appears as white rectangles. The code used for loading and drawing these models and textures is exactly the same. Textures are 32-bit TGAs in both cases, POT dimensions, in - nodpi, inScaled==false, using GLSurfaceView to rule out configuration issues. No problems on G1 and Hero (and of course on emulator). And I don't have the Droid, so I can't just try whatever comes to my mind. Asked users to send me logs - no errors, all models and images appear to load normally.
View 2 Replies
View Related
Dec 5, 2009
I'm using GLSurfaceView for one of my applications and I've encountered a problem. It seems I can only create textures when in onSurfaceChanged, after that glGenTextures only returns 0. I've tried without glGenTextures and keeping track of texture indices myself, but the textures generated just turn up white. Is it only possible to load these types of resources in onSurfaceChanged (and possible onSurfaceCreated)? Or am I missing something?
View 2 Replies
View Related
Jun 25, 2010
I have just began opengl programming in android and i am fairly new to opengl as well. I've been using nehe's opengl tutorials as well as insanitydesign's android ports.I successfully managed to create a cube with a single texture mapped to all its 6 faces. I even mapped multiple textures to different faces of the cube.But the way I did it was to create 6 faces seperately, have 6 seperate index and texture buffers and then using glBindTexture() with the selected texture for each face and then calling glDrawElements. Isn't there an efficient way around this. Should i use a cube map texture instead of a GL_TEXTURE_2D?
View 4 Replies
View Related
Sep 18, 2010
Question before I dive deeper into converting my current rendering system to openGL. I heard that textures needed to be in base2 sizes in order to be stored for rendering. Is this true?
My application is very tight on memory, but most of the bitmaps are not a perfect square. Does storing non-base 2 textures waste extra memory?
View 3 Replies
View Related
Jun 30, 2010
I have troubles with OpenGL textures on Motorola Milestone with 2.1 firmware. Each call to glGenTextures fails with error GL_INVALID_OPERATION and sets the id with random numbers. The exact same application works on G1 without any error.
View 1 Replies
View Related
Sep 10, 2010
I'm creating an opengl es application and I would like to be able to dynamically create the text of my buttons etc.
The 2 obvious reasons for that are:
-to be modular (changing the text quickly without using photoshop)
-to be able to add languages later down the line
give me the basic steps/functions to:
create textures form text load custom fonts to display text textures with the chosen custom font indicate if I can use this for loading Kanji ?
View 2 Replies
View Related
Apr 8, 2009
We came across a strange behavior. The clip rect of our custom view is getting reset to its entire visible region, if we change the value of another view.
View 4 Replies
View Related
Feb 19, 2009
I want to judge whether the touch point(x, y) is in a region or not, the region is from a stardard rect by rotating specified degrees, from example, rotate 30 degrees. There is a class named Region in Android, but as I researched, it just supports standard rect, is there any other way to judge whether a point is in an acclivitous rect? How to do it?
View 10 Replies
View Related
Sep 18, 2010
How can I draw margin for Image by using Rect object (I need also to change the margin color for every image), so in the end I will have a new Image that surrounded by margins.
View 2 Replies
View Related
Jul 25, 2009
I have got a problem. How can i create the following rectangle by using Rect class? I mean Diagonal Rectangle. Is it possible through Rect class?? if not then any other way?
View 4 Replies
View Related
Feb 25, 2009
Single Threaded OpenGL game ! (check bottom, you can download and use the helper class) Lighting disabled ! Depth Buffer disabled ! Culling enabled ! Textures disabled !
Just 176 integers (x,y values only) making 88 vertexes along with 132 index numbers making "44 triangles only"
Framerates I get is
with GL_BLENDING disabled - 145 fps approx only! enabled - 110 fps approx only!
I have the screenshot of exact code in the draw function here.. just 2 damn lines ! I have hidden only the comments.. click here to see it http://prasna991.googlepages.com/drawframe.png
variable details in the 2 lines of code =========================== ipts = 176 elements (only x and y for each vertex) totallinetriangles * 3 = 176 lineindexes = 132 elements - type "short"
Here is the screenshot of output drawing and how it will look like http://prasna991.googlepages.com/screen.png
OpenGL single threaded Initialization Helper ================================ Here is my OpenGL helper class.. makes the OpenGL initialization for newbies a cakewalk http://prasna991.googlepages.com/OpenGLHelperclass.txt
I tested by rendering on the touch event only.. frame rate drops only when u touch and drag and here I have just tested by tapping and releasing gently on the emulator and on the device
Is this the device limitations ? So graphics is actually a lot lot lot slower than on iPhone ?
View 8 Replies
View Related
Jul 24, 2010
I would like to be able to use the OpenGL API from both Java and C (via NDK).
In Java, there is a GL object passed, which has all GL methods on it.
In C, you just talk to the native library.
In a single onDrawFrame callback (for which Java is passed a GL), can I use methods on the GL object, and also call NDK methods which access the openGL library?
In other words, is the GL object just a wrapper for the same instance of the native library?
View 3 Replies
View Related
Nov 8, 2009
I am new to Android development, just reading docs and trying the APIs. I am quit confused how ImageView managed to draw just a part of its content after an invalidate(Rect) invocation.
I've checked ImageView.java, found no other drawing method except onDraw(Canvas), but onDraw(Canvas) only cut the drawable only if it is beyound the view's visible boundary. I also read the implementation of View.invalidate(Rect), I think the key of this function is calling to mParent.invalidateChild(this, r);
However, I think the parent view doesn't know how to draw the child in the given Rect, it finally has to call some method of it child to paint out. Has anybody investigated this part of codes? Would you please give me some guide?
View 2 Replies
View Related
Feb 15, 2009
I am using opengl for drawing 3d stuff, but so far I've been unable to use transparent textures...
This is what I do...
CODE:..............
View 2 Replies
View Related
Sep 27, 2010
I created a little texture drawing class from observing the LabelMaker example in the Android SDK. One thing I can't find however is how to rotate textures drawn with glDrawTexiOES. is it possible? I've just tried glRotatef but it has no effect.
View 1 Replies
View Related
Aug 18, 2010
I'm just learning OpenGL ES on Android, and I am trying to get some kind of anisotropic filtering on textures. I want to increase the size of a sprite, with some kind of interpolation, instead of this "nearest-pixel-interpolation".
Is there anything like this in the OpenGL ES standard or do I have to make one texture for each size?
View 2 Replies
View Related
May 19, 2010
I'm developing a game for android using OpenGL es and have hit a problem:
My game loads fine in the emulator (windows xp and vista from eclipse), it also loads fine on a T-Mobile G2 (HTC Hero) however when I load it on my new HTC Desire none of the textures appear to load correctly (or at all). I'm suspecting the BitmapFactory.decode method although I have no evidence that that is the problem.
All of my textures are power of 2 and JPG textures seem to load (although they don't look great quality) but anything that is GIF or PNG just doesn't load at all except for a 2x2 red square which loads fine and one texture that maps to a 3d object but seems to fill each triangle of the mesh with the nearest colour).
This is my code for loading images:
CODE:...........................
View 1 Replies
View Related
Apr 12, 2010
how to apply apply different textures on different faces of a cylinder?I am able to apply one texture which covers the whole cylinder.But I want one texture for each face.
View 7 Replies
View Related
Nov 19, 2010
Basically I have a fully functional ogl program (2D game) in opengl es 1.1, everything works fine except for one problem: glcolor
I'm trying to set some of my texture to half transparent and I would like to do it as follows;
gl.glColor4f(1f, 1f, 1f, .5f);
obj.draw(gl);
...
gl.glColor4f(1f, 1f, 1f, 1f);
I'm using VBO for my vertice, my textures and indices. (if that is relevant)
the problem is that nothing gets set to 50% transparency...
I'm don't think relevant to post all my code (mainly because it is spread out several classes with several GL options changing (blends, scissors etc etc).
What I would like is for people to tell me what state of OGL could prevent glcolor form working like I want, what functions should I check, what state should I call.
View 1 Replies
View Related
Feb 26, 2010
I'm using GLSurfaceView to render OpengGL 3D. It works great on my nexus one, the emulators, and at least the G1. However, on the droid, the textures are white. I've seen this problem before when textures aren't loaded, and also when they aren't powers of two dimensions (not the case here). What's weird is that this started when I converted my program to use GLSurfaceView (it used to be based on some older example where I was doing the EGL stuff myself).
Textures displayed on the screen are white, but shapes that are just colors are displayed just fine.
The person testing this for me on their droid does not have the sdk, so if anyone would like to run this with the debugger, let me know and I can get you the apk.
View 7 Replies
View Related
Jun 25, 2010
I have just began opengl programming in android and i am fairly new to opengl as well. I've been using nehe's opengl tutorials as well as insanitydesign's android ports. I successfully managed to create a cube with a single texture mapped to all its 6 faces. I even mapped multiple textures to different faces of the cube.But the way I did it was to create 6 faces seperately, have 6 seperate index and texture buffers and then using glBindTexture() with the selected texture for each face and then calling glDrawElements. Isn't there an efficient way around this. Should i use a cube map texture instead of a GL_TEXTURE_2D?
View 1 Replies
View Related