opengl-es-2.0

Creating a bitmap of a drawn square in android opengl es 2.0

别来无恙 提交于 2019-12-04 21:44:36
I have drawn a square using opengl es 2.0 and now i want to create a bitmap of that drawn square. Can anyone please guide me on how to do that? Please let me know if my question is not clear. Thanks It is done using glReadPixels(). This is slow, but is the only method available with OpenGL ES 2.0 on Android. In Java: Bitmap buttonBitmap = Bitmap.createBitmap(mWidth, mHeight, Bitmap.Config.ARGB_8888); ByteBuffer byteBuffer = ByteBuffer.allocateDirect(mWidth * mHeight * 4); GLES20.glReadPixels(0, 0, mWidth, mHeight, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, byteBuffer); buttonBitmap

Android OpenGL ES Support Everywhere?

血红的双手。 提交于 2019-12-04 21:43:00
问题 I need to get an idea of how many potential installs I'll be loosing if I choose to do my drawing in OpenGL instead of android's native 2D graphics APIs in android.graphics.* The android documentation seems to imply that the OpenGL ES API is supported basically on all phones: http://developer.android.com/guide/topics/graphics/opengl.html OpenGL ES 2.0 is supported by most Android devices Now, does that imply that even cheap commodity devices will have OpenGL ES 2.0 support? Will the cheaper

Recoding one H.264 video to another using opengl surfaces is very slow on my android

回眸只為那壹抹淺笑 提交于 2019-12-04 20:44:02
I'm developing function of translating one video into another with additional effects for each frame. I decided to use opengl-es for applying effects on each frame. My input and output videos are in MP4 using H.264 codec. I use MediaCodec API (android api 18+) for decoding H.264 into the opengl texture, then draw on the surface using this texture with my shader. I thought that using MediaCodec with H.264 will do hardware decoding on android and it will be fast. But appeared that it is not. Recoding small 432x240 15 seconds video consumed 28 seconds of total time! Please, take a look at my code

How to achieve glOrthof in OpenGL ES 2.0

泄露秘密 提交于 2019-12-04 20:07:56
问题 I am trying to convert my OpenGL ES 1 application to a OpenGL ES 2 application to be able to use Shaders. Now I use the glOrthof function to have a "real sized viewport" so I can place the vertices at the "actual" pixel in the OpenGL View. glOrthof(0, _frame.size.width, _frame.size.height, 0, -1, 1); I am having trouble finding out how to achieve this in OpenGL ES 2 , is there anyone who can show me how to do this? If not, does anyone have a link to a good OpenGL ES 1 to OpenGL ES 2 tutorial

Rendering Static and Dynamic Graphics OpenGL

坚强是说给别人听的谎言 提交于 2019-12-04 19:42:27
I am working on an IOS game using the OpenGL pipeline. I have been able to render the graphics I want to the screen, however, I am calling glDrawElements too many times and have some concerns about running into performance issues eventually. I have several static elements in my game that do not need to be render on every render cycle. Is there a way I can render static elements to one frame buffer and dynamic elements to another? Here's the code I have tried: static BOOL renderThisFrameBuffer = YES; if (renderThisFrameBuffer) { glBindFramebuffer(GL_FRAMEBUFFER, interFrameBuffer); glClearColor

BGRA on iPhone glTexImage2D and glReadPixels

半腔热情 提交于 2019-12-04 19:02:51
Looking at the docs, I should be able to use BGRA for the internal format of a texture. I am supplying the texture with BGRA data (using GL_RGBA8_OES for glRenderbufferStorage as it seems BGRA there is not allowed). However, the following does not work: glTexImage2D(GL_TEXTURE_2D, 0, **GL_BGRA**, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, buffer); ... glReadPixels(0, 0, w,h, GL_BGRA, GL_UNSIGNED_BYTE,buffer, 0); While this gives me a black frame: glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, buffer); ... glReadPixels(0, 0, w,h, **GL_BGRA**, GL_UNSIGNED_BYTE,buffer, 0);

GLSL reusable/shared functions, shared constants (OpenGL ES 2.0)?

笑着哭i 提交于 2019-12-04 18:49:27
问题 Short: Can I define a function that every shader can use? Or I have to define it per shader? The whole story: I want to create numerous shaders intended to colorize the input fragments with predefined gradient ramps (something like this - http://www.thinkboxsoftware.com/storage/krakatoa-support-images/krakatoa15_kcm_densitybyage_gradientrampmap.png). I want to define a gradient ramp constant for each shader (an array of vec4 color samples, where the alpha value holds the gradient position,

GLSL shader for texture 'smoke' effect

妖精的绣舞 提交于 2019-12-04 18:48:43
I've looked around and haven't found anything relevant. I'm tyring to create a shader to give a texture smoke effect animation like here: Not asking for a complete/full solution (although that would be awesome) but any pointers towards where I can get started to achieve this effect. Would i need to have the vertices for the drawing or is this possible if I have the texture only? In the example pictured it appears as if they have the vertices. Possibly the "drawing" of the flower shape was recorded and then played back continuously. Then the effect hits the vertices based on a time offset from

OpenGL ES 2.0 Object Picking on iOS (Using Color Coding)

六月ゝ 毕业季﹏ 提交于 2019-12-04 18:31:35
This might appear as a related question: OpenGL ES 2.0 Object Picking on iOS Which says Color picker is a good solution, and in deed after reading about it: http://www.lighthouse3d.com/opengl/picking/index.php?color1 It does seem like a very simple solution so this brings me to this question OpenGL ES color picking on the iPhone Which unfortunately uses opengl es 1.0, I am trying to do it in 2.0 so I have no access to the functions described in that question. But the theory seems simple and here is what I think I should do: On touches begin I render my objects with a unique color. On touches

Ray-picking in OpenGL ES 2.0

ⅰ亾dé卋堺 提交于 2019-12-04 17:58:34
I'm trying to implement ray-picking in OpenGL ES 2.0 to determine if an object has been clicked or not. So far I'm just trying to check if a specific triangle has been pressed. I`m using this site as a motivation http://android-raypick.blogspot.ca/2012/04/first-i-want-to-state-this-is-my-first.html This is what I have so far: public void onClick(float x, float y) { float[] temp = new float[4]; float[] temp2 = new float[4]; System.out.println("X coordinate: " + x); System.out.println("Y coordinate: " + y); float[] pos = new float[4]; y = (float) viewport[3] - y; int res = GLU.gluUnProject(x, y,