Android : Use OpenGL To Make Bitmap Without GLSurfaceView?

May 2, 2010

I would like to be able to use OpenGL in the Android to render into a bitmap (or any other sort of buffer I can turn into one), without actually displaying a GLSurfaceView.

The purpose is to dynamically create very complex images using OpenGL, and then drawing those images on the canvas of a MapView.

I have tried overlaying a translucent GLSurfaceView over a MapView, my preferred approach, but it has some problems:

1) I have complex menus I need to display from either the MapView or the GLSurfaceView. I have been doing this using a ListView with its own activity. Unfortunately, that activity pushes the MapView down the stack. The result is a bit of flickering when the ListView activity finishes, popping the MapView back to the top. Even worse, if I use the ListView to overlay the GLSurfaceView (giving it the same complex menu capabilities), when it finishes, the GLSurfaceView reappears but the MapView doesn't display.

2)As soon as the GLSurfaceView is created, the MapView stops fetching and rendering tiles. There seems to be no way to know when the MapView is complete, so I have to delay an arbitrary interval before creating the surfaceview.

3) When the GLSurfaceView is present, the MapView's built-in user interface functions are obscured.

Anyone know if there is a way around any of these problems?

Android : Use OpenGL to make Bitmap without GLSurfaceView?


Android :: Draw GLSurfaceView To A Bitmap

Nov 4, 2009

I have an application that uses GLSurfaceView to draw OpenGL ES graphics. This is all working (mostly) how I would expect.

Now, I would like to implement a screenshot feature. For normal views, it seems that the standard practice is to create a new Canvas with a Bitmap and then draw to that Canvas using View.onDraw(Canvas).

I've tried using SurfaceView.draw(Canvas) in a similar fashion, but it always results in a blank (black) image.

I've also tried using the drawing cache with the exact same result.

View 3 Replies View Related

Android : Want To Load Bitmap In GLSurfaceView

Jul 20, 2009

I want to load a bitmap on a GLSurfaceView.. I do it like this: Code...

But the bitmap repeats itself on the surface and is also inverted.. why is this.. How do i make it appear only once...kindly help!

View 6 Replies View Related

Android :: Render OpenGL To Regular View - Not GLSurfaceView

Aug 19, 2009

I've noticed that OpenGLContext is removed from 1.5. Everybody says that GLSurfaceView should be used instead. Does this mean that there is no way to render OpenGL graphics into a regular View?

View 4 Replies View Related

Android : OpenGL App - Created Rendering Class Which Implements GLSurfaceView.Renderer

Jul 16, 2009

I've created a simple OpenGL app and created a rendering class which implements GLSurfaceView.Renderer. All it does is draw 100 triangles (NUM_OBJECTS = 100) on the screen and move them about, bouncing off the edges. The projection is glOrtho2D and there is no z-buffer. I'm running this on a G1 with continuous redraw enabled.

Here is the onDrawFrame method:

CODE:....................

View 23 Replies View Related

Android :: Draw A Bitmap - Using OpenGL

Aug 30, 2010

I have a byte array of RGB values, just like the contents(without header) of a *.bmp file. What I want to do is, draw the corresponding bitmap on Android, using OpenGL.

It seems that OpenGL ES doesn't have a single API that will do, it true?

If true, how can I do this?

Actually, I can draw it in JAVA code, but it's too slow and costs too much CPU time. So I want to try drawing it with OpenGL. Is there any other advises? Or maybe OpenGL can't be the right answer?

View 2 Replies View Related

Android : Rotate Bitmap In Opengl?

Oct 10, 2010

I am trying to rotate a bitmap in OpenGL. I have searched around and come up with this. code...

Drawing the bitmaps indicated with the "ids" works fine but no rotation happens. I am no expert at openGL. Is is possible I need to set some sort of mode prior to the rotation?

View 8 Replies View Related

Android :: Opengl Es Texture Created From Bitmap All White?

Feb 18, 2009

All the textures I create from my resource files are fine, but when I create a texture in the following way... <code> mOverlay = Bitmap.createBitmap((int)mWidth, (int)mHeight, Bitmap.Config.ARGB_4444); mOverlay.eraseColor(0); mOverlayCanvas = new Canvas(mOverlay);

...

Canvas c = mOverlayCanvas; c.drawColor(Color.argb(0, 0, 0, 0)); Paint p = new Paint(); p.setColor(Color.RED); c.drawCircle(160, 240, 10, p);

....................

View 4 Replies View Related

Android : Need To Create Bitmap From Integer Array In C / OpenGL

Nov 29, 2009

I am trying to move my code from Java to C, and I have encountered a problem while trying to find a function in C that can take an array of ints and create a bitmap from it for OpenGL. In Java, I used

bitmap = Bitmap.createBitmap( {int array name} , w, h, Config.RGB_565);

Is there a similar function that I can use in C, or a workaround that I could use?

Also, if it matters, I am programming for Android.

View 4 Replies View Related

Android :: Easiest Way To Make A WebView Display A Bitmap?

May 31, 2010

I have some images that I loaded from a remote source stored in Bitmap variables and I want to display them. In addition to switching between these images the user should also be able to zoom and pan them. My first idea was to somehow pass them via an intent to the built-in gallery application but this doesn't seem to be possible.
A solution that is suggested in several places is using a WebView since it already supports zooming and panning.
My question is how does my Bitmap data get into the WebView? Do I have to write it to a file first, which I would have to remove again later, or is there an easier way?

Or are there even better ways to accomplish my main goal, which is displaying Bitmap data as zoomable and panable images?

View 2 Replies View Related

Android :: Make Bitmap's Specific Color Transparent?

Oct 8, 2010

I have an android application to display an image on another. the second image's white color should be converted in to transparent. so i used two imageviews. the original image to be overlayed is bitmap1. image after making transparent is bitmap2. when i run this i got some exceptions atsetPixel method. the code ...

View 1 Replies View Related

Android :: Easy / Fast Way To Make A Mirrored - Reversal Bitmap?

May 26, 2009

I want to make a mirrored/reversal bitmap from the original bitmap source. But I know only a way of copying pixel by pixel.

Is there a easy/fast way to make a mirrored/reversal bitmap?

View 4 Replies View Related

Android :: Total Memory Doesn't Grow To Make Room For Bitmap?

Dec 23, 2009

I've been doing a lot of searching and I know a lot of other people are experiencing the same OOM memory problems with BitmapFactory. My app only shows a total memory available of 4MB using Runtime. getRuntime ().totalMemory(). If the limit is 16MB, then why doesn't the total memory grow to make room for the bitmap? Instead it throws an error.............

View 1 Replies View Related

Android :: How Do I Make My Image View Fixed Size Regardless Of Size Of Bitmap

Sep 23, 2010

So I'm loading images from a web service, but the size of the images are sometimes smaller or bigger than other images and the visualization looks silly when I put them in a ListView in android. I'd like to fix the size of my ImageView so that it only shows a portion of the image if it's larger than a preset amount. I've tried everything I can think of setting the setMaxWidth/setMaxHeight, setting the scale type to centerCrop, using ClipableDrawable wrapping my BitmapDrawable, setting using Drawable.setBounds(). I've tried setting in the XML and programmatically, but neither worked. I'm very surprised setting max width/height didn't do anything. Below is the XML I'm using ImageView definition in my layout file

View 1 Replies View Related

Android : Crop Bitmap Without Reading Entire Bitmap / Cannot Read Image Into Memory

Jul 21, 2010

I have a very large image and I only want to display a section the size of the display (no scaling), and the section should just be the center of the image. Because the image is very large I cannot read the entire image into memory and then crop it. This is what I have so far but it will give OutOfMemory for large images. Also I don't think inSampleSize applies because I want to crop the image, not lower the resolution.

Uri data = getIntent().getData();
Input Stream is = getContentResolver().openInputStream(data);
Bitmap bitmap = BitmapFactory.decodeStream(is, null, null);

Any help would be great?

View 3 Replies View Related

Android :: Create Mutable Bitmap From Camera - Draw Another Bitmap On Top - And Save It

Apr 2, 2009

I am 1) taking a picture and 2) then draw another Bitmap on top of it 3) then I store it

I am doing it as follows and it works on the emulator.

On the device I get a OutOfMemoryError: bitmap size exceeds VM budget android.graphics.Bitmap.nativeCopy(Native Method) android.graphics.Bitmap.copy(Bitmap.java:199) in the line copy the Bitmap to get a mutable Bitmap.

CODE:...........

What I am asking:

a) Is there a better way to do what I am doing? 1) take a picture 2) draw another Bitmap on top of it 3) then I store it

b) What is the best way to create a mutable Bitmap from the picture I just took with the camera?

In my app, resolution is not an issue. If it works better for small photos that would be fine.

View 3 Replies View Related

Android :: OpenGL Speed Issue - Code Contribution To Other OpenGL

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

Android :: NDK OpenGL - Mixing Java And Native - C - Calls To OpenGL API

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

Android :: Overlay Bitmap - Draw Over A Bitmap

Oct 8, 2009

I have two questions actually:

Is it better to draw an image on a bitmap or create a bitmap as resource and then draw it over a bitmap? Performance wise... which one is better?

If I want to draw something transparent over a bitmap, how would I go about doing it?

If I want to overlay one transparent bitmap over another, how would I do it?

View 1 Replies View Related

Android :: Draw A Bitmap Rotated Onto Another Bitmap

Mar 22, 2009

My goal is the draw a bitmap onto another bitmap but rotated 90 degress. whats the most efficient way to do that. My current method is as follows which is horribly bad because it creates a new bitmap every time.

CODE:.....................

View 4 Replies View Related

Android :: Draw Shape Or Bitmap Into Another Bitmap - Java - Android

Jun 22, 2010

I want to draw a shape(many circles particularly) into a Specific Bitmap. I have never used canvas / 2D graphs etc. As i see it i create a Drawable put the bitmap in it then "canvas-it" to the shapes i want etc.

View 1 Replies View Related

Android :: Can't Find The GLSurfaceView?

Jun 12, 2009

i want to start programming in OpenGL on Android, but Eclipse can't find the GLSurfaceView. I'm using the 1.5 SDK. Do I have to set specific entries in the build path?

View 2 Replies View Related

Android :: GLSurfaceView And Key Presses

Nov 30, 2009

Following the samples and examples, I've successfully been able to load a model on screen and rotate it with the DPAD keys and overriding the onKeyDown method of the GLSurfaceView. Trying to use a letter though, causes a small box to appear at the bottom accepting the text that is being typed. What I'm not entirely clear on, is since I don't have a listener defined in the main Activity, why those key letter key presses are being intercepted by some other inherent listener(?). I setup an OnKeyListener for the view to call my own method and that does work... but I'm wondering if there is perhaps a better way to handle it.

View 3 Replies View Related

Android :: Set EglSwapInterval When Using GLSurfaceView?

Sep 3, 2010

I am a lazybones using GLSurfaceView and loving it. But now that my code is running too darn fast (heh), I would like to slow it down via setting eglSwapInterval to 2 or something. Just to be nice to the battery. But, being a lazybones, I can find no way of doing this when using GLSurfaceView. (and hacking an early return from onDrawFrame() was very unsatisfying).

View 2 Replies View Related

Android :: GLSurfaceView On App Widget?

Mar 31, 2010

currently GLSurfaceView is not supported in app widget .can we make changes to framework to make it support? is there any limitation? if possible what framework change is required?

View 12 Replies View Related

Android :: Deadlock In GLSurfaceView

Jul 27, 2009

We are developing an application that uses a GLSurfaceView to display 3D objects. We regularly get the "Application Not Responding" dialog. Inspection of the dumped threads reveals something that looks suspiciously like a deadlock. I have added the three thread dumps involved below. The first thread is the main application event thread, and it is waiting on a join with a GLThread.

The second thread is a brand new GLThread that is waiting for a semaphore lock presumably so it knows it has exclusive access to the graphics hardware. The third thread is probably a previous GLThread (the one the main thread is waiting for to finish), that is waiting to be notified. The strange thing is that the main application thread has just done a "mDone=true; notify();" prior to calling "wait()", so the third thread should have been awaken? .........................

View 3 Replies View Related

Android : Put GLSurfaceview On Top On A SurfaceView

Dec 16, 2009

Look at this: http://nhenze.net/?p=172

They show that it is possible to put an GLSurfaceview on top on a SurfaceView. I hope it would be useful.

View 2 Replies View Related

Android :: Screen Flickering In GLSurfaceView

Mar 18, 2010

I'm using GLSurfaceView to create a simple OpenGL drawing application. Since the elements drawn in each frame must remain on screen in order to be composed into the whole drawing, I don't use gl.glClear(GL10.GL_COLOR_BUFFER_BIT) at the beginning of each frame. But not clearing the color buffer leads to substantial flickering. Is there any way to eliminate flickering while still not clearing the screen at the beginning of each frame?

View 7 Replies View Related

Android :: GLSurfaceView Transparent Bg Within ViewGroup

May 12, 2010

I am able to get a GLSurfaceView to have a transparent background with:

CODE:............

when I set the Activity's window background to transparent and the GLSurfaceView is the contentView of the Activity.

But, let's say my GLSurfaceview is parented by a ViewGroup and I want GLSurfaceView bg to be transparent to see the Viewgroup's background - I am not able to do so with the code above. Is this a limitation or am I missing something?

View 2 Replies View Related

Android :: Draw Text On GLSurfaceView

Apr 12, 2010

how to draw text on GLSurfaceView in Android?

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved