opengl-es

Video as texture in OpenGLES2.0

笑着哭i 提交于 2020-01-01 19:20:32
问题 I want to place video as texture to object in OpenGLES 2.0 iOS. I create AVPlayer with AVPlayerItemVideoOutput , setting NSDictionary *videoOutputOptions = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:kCVPixelFormatType_32BGRA], kCVPixelBufferPixelFormatTypeKey, [NSDictionary dictionary], kCVPixelBufferIOSurfacePropertiesKey, nil]; self.videoOutput = [[AVPlayerItemVideoOutput alloc] initWithPixelBufferAttributes:videoOutputOptions]; Than I get CVPixelBufferRef for each

GPUImage create a custom Filter that change selected colors

我怕爱的太早我们不能终老 提交于 2020-01-01 17:36:31
问题 Using the amazing GPU image framework, I'm trying to create a custom filter using a custom fragment shader that passed some color vectors as uniforms, elaborate each fragment substituting a choosen color with one in the uniform. I made that using Quartz and it works, but since I'm moving my first step in OpenGL world using this framework, I'd like to give a try to the GPU processing. The fragment shader I made seems to work fine, but there is a problem in the output. I post just a sample for

using WebGL index buffers for drawing meshes

血红的双手。 提交于 2020-01-01 12:16:34
问题 3 index buffers asks a more difficult question, but I feel like their main problem boils down to mine: is there a way to use index buffers to visit the same vertex multiple times in WebGL rather than duplicating the vertices? All I was able to find is using index buffers to associate textures, normals, etc. to vertices in a model. I wasn't able to find a way to use an index buffer to tell drawArrays the order in which to visit the vertices in a position array. 回答1: Yes, use gl.drawElements

using WebGL index buffers for drawing meshes

牧云@^-^@ 提交于 2020-01-01 12:16:24
问题 3 index buffers asks a more difficult question, but I feel like their main problem boils down to mine: is there a way to use index buffers to visit the same vertex multiple times in WebGL rather than duplicating the vertices? All I was able to find is using index buffers to associate textures, normals, etc. to vertices in a model. I wasn't able to find a way to use an index buffer to tell drawArrays the order in which to visit the vertices in a position array. 回答1: Yes, use gl.drawElements

GLSurfaceView.queueEvent does not execute in the GL thread

*爱你&永不变心* 提交于 2020-01-01 12:16:11
问题 I'm trying to execute some OpenGL commands for my GLSurfaceView from my main activity. As the OpenGL renderer works in its own thread, I have to use queueEvent , as far as I understand. I'm calling queueEvent with the following code in my GLSurfaceView: queueEvent(new Runnable(){ @Override public void run() { renderer.doSomething(data); //executes some OpenGL commands requestRender(); }}); The doSomething() method binds a texture and compiles shaders. This does not work. glCreateProgram

Stenciling using OpenGl ES 2.0

ε祈祈猫儿з 提交于 2020-01-01 12:08:09
问题 I am trying to figure out a way to cut out a certain region of a background texture such that a certain custom pattern is not rendered on the screen for that background. For example: This square can be any pattern. I am using Frame Buffer Object and Stencil Buffer to achieve this kind of effect. Here is the code: fbo.begin(); //Disables ColorMask and DepthMask so that all the rendering is done on the Stencil Buffer Gdx.gl20.glColorMask(false, false, false, false); Gdx.gl20.glDepthMask(false);

OpenGL Fixed function shader implementation

让人想犯罪 __ 提交于 2020-01-01 11:56:08
问题 Is there any wrapper which emulates the OpenGL ES 1.1 API on top of OpenGL ES 2.0? I was searching quite a bit but could not find any actual implementation. 回答1: I'm currently investigating same question, just stumbled upon this project: https://github.com/p3/regal#readme (OpenGL portability layer for OpenGL 2.x, 3.x, 4.x, Core contexts and ES 2.0). Only going to try it myself, but after reading the article http://www.gamasutra.com/view/news/177233/Indepth_Bringing_Regal_OpenGL_to_Native

CMSampleBuffer from OpenGL for video output with AVAssestWritter

▼魔方 西西 提交于 2020-01-01 11:46:28
问题 I need to get a CMSampleBuffer for the OpenGL frame. I'm using this: int s = 1; UIScreen * screen = [UIScreen mainScreen]; if ([screen respondsToSelector:@selector(scale)]){ s = (int)[screen scale]; } const int w = viewController.view.frame.size.width/2; const int h = viewController.view.frame.size.height/2; const NSInteger my_data_length = 4*w*h*s*s; // allocate array and read pixels into it. GLubyte * buffer = malloc(my_data_length); glReadPixels(0, 0, w*s, h*s, GL_RGBA, GL_UNSIGNED_BYTE,

OpenGL EXC_BAD_ACCESS when calling glDrawElements in Swift but not in Objective-C

浪尽此生 提交于 2020-01-01 11:35:11
问题 I'm working through the OpenGL for iOS tutorial by Ray Wenderlich in an attempt to convert his code from Objective-C to Swift. I am very new to OpenGL and to Swift and believe my problem has to do with how I have translated the Objective-C. Here's why: In my swift file for setting up my view that contains OpenGL content, on the final logical step (calling glDrawElements) the app will crash with a EXC_BAD_ACCESS alert. If, however, I move this portion of the code to an Objective-C file , the

Why does the matrix generated by Android's frustumM differ from the Redbook's?

送分小仙女□ 提交于 2020-01-01 10:14:08
问题 Something seems funny about the way that Android's frustumM works. If I check the OpenGL red book, the matrix generated looks like this: (source: glprogramming.com) Songho.ca seems to agree with this: (source: songho.ca) However, one component is multiplied by 2 with Android's frustumM, and not in the other example matrices. Here's what it seems to be doing: Everything seems to functionally match up, except the first row, third column. Why is that being multiplied by two? Here's the lines of