Dmitry Ryadnenko
Dmitry Ryadnenko

Reputation: 22512

OpenGl render direcly to bitmap (without any view)

I need to apply some pixel shaders to a bitmap (using OpenGL) and send result to server. Rendering is supposed to be made in background so I can't create GLSurfaceView for this purpose. So my question is: is it possible to make OpenGL rendering on Android without using GLSurfaceView? Like rendering directly to bitmap, or canvas or some sort of buffer/array? Or may by it is possible to use some kind of dummy GLSurfaceView?

Upvotes: 8

Views: 6854

Answers (2)

Stefan Hanke
Stefan Hanke

Reputation: 3518

This SO post contains a link to an anddev post. A bit downwards, somebody created a PixelBuffer class that reuses the GLSurfaceView.Renderer interface, but apart from that, only EGL.

Upvotes: 4

robertly
robertly

Reputation: 2132

It sounds like you want to render to a frame buffer object (i.e. directly to a texture). This is definitely possible. Just search around for the answer here or on the web. I found this one without trying too hard. I'm not sure if you're using GL ES 1.1 or 2.0 though.

http://blog.shayanjaved.com/2011/05/13/android-opengl-es-2-0-render-to-texture/

It also looks like APIDemos in the SDK has a sample for 1.1

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.html

Upvotes: 0

Related Questions