opengl-es

Android camera preview on SurfaceTexture

拥有回忆 提交于 2019-12-06 14:57:32
This is my scenario: I am trying to take a picture from the front camera when someone puts in the incorrect password in the lock screen. Basically, I need to be able to take a picture out of the front cam without a preview. After much googling, I figured out that the way to do it is opengl and SurfaceTexture. You direct the camera preview to a SurfaceTexture, and later extract the picture from this texture somehow. I found this out from the following resources: https://stackoverflow.com/a/10776349/902572 (suggestion 1) http://www.freelancer.com/projects/Android-opengl/Android-OpenGL-App-Access

OpenGL ES Pixel Art - Scaling

和自甴很熟 提交于 2019-12-06 14:56:04
Im having trouble displaying pixel based art (think retro tiles and art) on OpenGL Es 1.1 on the iPhones. Tiles are represented using 8bytes (1 byte for each row) with each bit representing a pixel being set or not. For example a tile with the number 8: 0 0 0 0 0 0 0 0 -> 0 0 1 1 1 0 0 0 -> xxx 0 1 0 0 0 1 0 0 -> x x 0 1 0 0 0 1 0 0 -> x x 0 0 1 1 1 0 0 0 -> xxx 0 1 0 0 0 1 0 0 -> x x 0 1 0 0 0 1 0 0 -> x x 0 0 1 1 1 0 0 0 -> xxx Converting this to OpenGL on iPhone using glDrawArrays(GL_POINTS, 0, 64); The logic is correct, but the problem is it doesn't give the retro effect. I was looking for

How to set background image using OpenGL ES 1.1 for iPhone

孤街浪徒 提交于 2019-12-06 14:54:36
问题 Please help me to set a background image in EaglView. Here my source code with the image: glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer); brushImage = [UIImage imageNamed:@"Particle.png"].CGImage; width = CGImageGetWidth(brushImage); height = CGImageGetHeight(brushImage); if(brushImage) { brushData = (GLubyte *) calloc(width * height * 4, sizeof(GLubyte)); brushContext = CGBitmapContextCreate(brushData, width, height, 8, width * 4, CGImageGetColorSpace(brushImage),

Is there any alternative for GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)?

喜你入骨 提交于 2019-12-06 14:37:43
I get a fill rate of about 30fps in my application. I know that GLES20.glClear() is used to clear the screen for every draw. If i comment it i get a fps of about 60fps. But the output is not as expected. I have a content to be redrawn for the whole screen in every frame. Is there any alternative where i can redraw the whole screen with out using the GLES20.glClear(). Please let me know if there is any way to play around with GLES20.glClear() to improve the performance? If you overwrite the entire color buffer with your geometry each frame you can get away with just clearing the depth buffer.

Rendering to depth texture - unclarities about usage of GL_OES_depth_texture

好久不见. 提交于 2019-12-06 14:21:35
I'm trying to replace OpenGL's gl_FragDepth feature which is missing in OpenGL ES 2.0. I need a way to set the depth in the fragment shader, because setting it in the vertex shader is not accurate enough for my purpose. AFAIK the only way to do that is by having a render-to-texture framebuffer on which a first rendering pass is done. This depth texture stores the depth values for each pixel on the screen. Then, the depth texture is attached in the final rendering pass, so the final renderer knows the depth at each pixel. Since iOS >= 4.1 supports GL_OES_depth_texture , I'm trying to use GL

WebGL: How to bind values to a mat4 attribute?

大憨熊 提交于 2019-12-06 13:58:21
问题 In some WebGL application, let's assume that we have a GLSL vertex shader which starts like this: attribute vec4 foo1; attribute vec4 foo2; attribute vec4 foo3; attribute vec4 foo4; and some corresponding Javascript code for binding a data structure for those attributes: var buf = gl.createBuffer(), loc; gl.bindBuffer(gl.ARRAY_BUFFER, buf); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([…])); loc = gl.getAttribLocation(program, 'foo1'); gl.enableVertexArray(loc); gl.vertexAttribPointer(loc,

CALayer OpenGL(-ES) texture memory usage

青春壹個敷衍的年華 提交于 2019-12-06 13:49:32
I have an iPhone app that uses too much texture memory. I am trying to figure out which of the app's CALayers uses too much texture memory. Unfortunately, I cannot figure out how much texture memory a specific CALayer is using. Are there any good tricks I can use ? 来源: https://stackoverflow.com/questions/8214884/calayer-opengl-es-texture-memory-usage

how to convert AVFrame to texture used by glTexImage2D?

久未见 提交于 2019-12-06 13:49:17
as you know that AVFrame has 2 property:pFrame->data, pFrame->linesize. After i read frame from video /sdcard/test.mp4 (android platform), and convert to RGB AVFrame vice: img_convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt, target_width, target_height, PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL); if(img_convert_ctx == NULL) { LOGE("could not initialize conversion context\n"); return; } sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize); I get pFrameRGB after

Disordered texture displayed on iOS device powered by Unity3D

僤鯓⒐⒋嵵緔 提交于 2019-12-06 13:47:09
问题 Screenshot on iPhone6s : Unity3D version: 5.3.5f1 Texture Format: TrueColor (Not Compressed) iOS device: iPhone6s iOS 9.3.4 And this issue only occured on our trunk branch recently, and other branches do not have this issue. So we are sure about is: Shaders are correct. Meshes and texture coordinates(uv) of each vertex are correct. By using Unity Profiler, what can also be sure: Memory in use is not too large ( compared with other branches ) By using GPU Frame Capture , I found that the

FBO offscreen rendering slow

百般思念 提交于 2019-12-06 13:47:08
问题 I want to use offscreen rendering using openGL es 2.0 and GLSL shader I setup FBO and it seems working except there are two problems 1) The program goes about 30 fps but all the sudden, it drops to 20fps and then come back to 30 fps again, then few secs later, drops to 20fps again then come back to 30fps and so on...(keeps going on like that) and I don't know what cause this random pause/delay 2) When I close the application, it does not respond for awhile. In other words, it seems like there