opengl-es

OpenGL ES recommended way of displaying a background image

北城余情 提交于 2019-12-06 04:43:12
问题 Whats the recommended way of displaying a background image in an OpenGL ES app. UIImage added to view hierarchy underneath glview? image drawn in OpenGL draw routine from texture in memory? Are there any performance / memory considerations to take account of? 回答1: I like to load a texture using Apple's Texture2D class. Create a quad (two triangles, six vertices) that maps to the corners of the screen. Then you map the texture coordinates to the vertices, pass that to glDrawArrays and go. I

Android MediaCodec output format: GLES External Texture (YUV / NV12) to GLES Texture (RGB)

梦想的初衷 提交于 2019-12-06 04:42:41
I am currently trying to develop a video player on Android, but am struggling with color formats. Context: I extract and decode a video through the standard combinaison of MediaExtractor/MediaCodec . Because I need the extracted frames to be available as OpenGLES textures (RGB) , I setup my decoder ( MediaCodec ) so that it feeds an external GLES texture ( GL_TEXTURE_EXTERNAL_OES ) through a SurfaceTexture. I know the data output by my HW decoder is in the NV12 ( YUV420SemiPlanar ) format, and I need to convert it to RGB by rendering it (with a fragment shader doing the conversion). MediaCodec

How to manage multiple textures in OpenGL ES 2.0?

本小妞迷上赌 提交于 2019-12-06 04:42:34
问题 I have a OpenGL ES 2.0 app with 6 different textures. What I need is to draw and move them all at the same time. I was able to do it, but the movement was laggy because I was loading the bitmaps into the textures all the time. For each texture, I do the following on the Render method: setupImage(texture1); GLES20.glVertexAttribPointer(mPositionHandle, 3, GLES20.GL_FLOAT, false, 0, vertexBufferT1); GLES20.glVertexAttribPointer(mTexCoordLoc, 2, GLES20.GL_FLOAT, false, 0, uvBufferT1); GLES20

Android Low image quality / altered image when using glReadPixels

删除回忆录丶 提交于 2019-12-06 04:41:53
I've spend a lot of time trying to figure this out but can't see what I am doing wrong. This is my original image Image recaptured 5 times Recapturing the image multiple times clearly shows that there is something not right. Capturing it once is just ok but twice is enough to clearly see the difference. I found these similar issues on stackoverflow: Bitmap quality using glReadPixels with frame buffer objects Extract pixels from TextureSurface using glReadPixels resulting in bad image Bitmap (sorry limited to links I can add) Unfortunately none of the proposed suggestions/solutions fixed my

EAGLContext, EAGLSharegroups, RenderBuffers, FrameBuffers, oh my!

北战南征 提交于 2019-12-06 04:39:08
I'm trying to wrap my head around the OpenGL object model on iPhone OS. I'm currently rendering into a few different UIView s (build on CAEAGLayer s) on the screen. I currently have each of these as using separate EAGLContext , each of which has a color renderbuffer and a framebuffer. I'm rendering similar things in them, and I'd like to share textures between these instances to save memory overhead. My current understanding is that I could use the same setup (some number of contexts, each with a FBO/RBO) but if I spawn the later ones using the EAGLShareGroup of the first one, then I can

Render OpenGL ES 2.0 to image

懵懂的女人 提交于 2019-12-06 04:36:35
问题 I am trying to do some OpenGL ES 2.0 rendering to an image file, independent of the rendering being shown on the screen to the user. The image I'm rendering to is a different size than the user's screen. I just need a byte array of GL_RGB data. I'm familiar with glReadPixels, but I don't think it would do the trick in this case since I'm not pulling from an already-rendered user screen. Pseudocode: // Switch rendering to another buffer (framebuffer? renderbuffer?) // Draw code here // Save

Options to efficiently draw a stream of byte arrays to display in Android

旧时模样 提交于 2019-12-06 04:23:26
问题 In simple words, all I need to do is display a live stream of video frames in Android (each frame is YUV420 format). I have a callback function where I receieve individual frames as a byte array. Something that looks like this : public void onFrameReceived(byte[] frame, int height, int width, int format) { // display this frame to surfaceview/textureview. } A feasible but slow option is to convert the byte array to a Bitmap and draw to canvas on SurfaceView. In the future, I would ideally

How to use OpenGL to emulate OpenCV's warpPerspective functionality (perspective transform)

社会主义新天地 提交于 2019-12-06 04:22:41
问题 I've done image warping using OpenCV in Python and C++, see the Coca Cola logo warped in place in the corners I had selected: Using the following images: and this: Full album with transition pics and description here I need to do exactly this, but in OpenGL. I'll have: Corners inside which I've to map the warped image A homography matrix that maps the transformation of the logo image into the logo image you see inside the final image (using OpenCV's warpPerspective), something like this: [[ 2

Why there is .pvr file in OpenGL(IOS)

会有一股神秘感。 提交于 2019-12-06 04:19:54
问题 I am making application with OpenGL in IOS using PVR texture for making 3D effect.I couldn't understand about .pvr files.So please friends would you give idea about .pvr files and what's importance of it in OpenGL and how can i make it? 回答1: PVR file is a container for various texture format such as PVRTC, RGB565 and so forth. You can use directly these texture formats as is. If you use PNG, pixels might be pre-multiplied alpha. PVRTC is compressed texture format that is natively supported by

What's the “offset” parameter in GLES20.glVertexAttribPointer/glDrawElements, and where does ptr/indices come from?

江枫思渺然 提交于 2019-12-06 04:06:12
问题 I'm playing around with OpenGL ES 2.0 in Android, and looking through the docs for GLES20 I came across the following methods: public static void glDrawElements( int mode, int count, int type, Buffer indices) public static void glDrawElements( int mode, int count, int type, int offset) public static void glVertexAttribPointer( int indx, int size, int type, boolean normalized, int stride, Buffer ptr) public static void glVertexAttribPointer( int indx, int size, int type, boolean normalized,