fbo

Blitting multisampled FBO with multiple color attachments in OpenGL

◇◆丶佛笑我妖孽 提交于 2019-12-11 08:53:49
问题 I have a frame buffer object in an OpenGL program with multiple colour attachments, and am trying to upgrade it to a multisampled FBO. As I understand it, a multisampled FBO is only able to use render buffers, specifically ones created using glRenderbufferStorageMultisampleEXT . If I want something rendered to this FBO in a texture, I need to create a second FBO with textures for its attachments, then blit the multisampled FBO to the regular FBO using glBlitFramebufferEXT . The very, very

Error copying FBO to VBO

爷,独闯天下 提交于 2019-12-11 03:49:33
问题 After doing some computation on the GPU I want to copy the results stored in the FBO to VBOs for rendering. The problem : It looks like some of the data is corrupted when I do the copy. I've already checked both buffers' format and size, and also checked that the data stored in the FBO is correct. Consider the following code that initializes the FBO: unsigned int verticesTextureId = AllocateTexture(GL_TEXTURE_RECTANGLE, mVBOSize, 1, GL_RGBA32F, GL_RGBA); CHECK_FOR_OPENGL_ERRORS(); unsigned

Renderbuffers larger than window size - OpenGL

半城伤御伤魂 提交于 2019-12-11 03:27:20
问题 I'm trying to draw to a renderbuffer (512x512) that's larger than the screen size (i.e., 320x480). After doing a glReadPixels, the image looks correct, except once the dimensions of the image exceed that of the screen size- in this example, past 320 horizontal and 480 vertical. What causes this anomaly? Is there something I'm missing? When the window size is >= the size of the renderbuffer, this code works absolutely fine. Example image that was rendered to the buffer & glReadPixel'd: http:/

Android OpenGL ES 2.0 : Can a GL_FLOAT texture be assigned to a FBO as a COLOR attachment?

自闭症网瘾萝莉.ら 提交于 2019-12-10 10:24:32
问题 I want to get the value using GL_FLOAT texture by glReadPixels. My Android device support OES_texture_float . but, it became an error to attach GL_FLOAT texture. In OpenGL ES 2.0 in Android, to attach GL_FLOAT texture to FBO is impossible? Or depend on hardware? Part of my code is: Init: glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D,texture); glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,texWidth,texHeight,0,GL_RGB,GL_FLOAT,NULL); FBO Attach: glBindFramebuffer(GL_FRAMEBUFFER,framebuffer);

OpenGL: Rendering to texture by using FBO and viewport offset problems

三世轮回 提交于 2019-12-10 00:44:11
问题 I have noticed unexpected behavior of frame-buffer objects (FBO) when rendering to a texture. If we set viewport in following way: glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0, 1.0, 1.0, 0.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity() ; (w and h doesn't need to match window size) everything is rendered fine: So lets say we need to draw bounding rectangle of viewport: glBegin(GL_LINE_STRIP); glVertex2f(0.0, 0.0); glVertex2f(0.0, 1.0); glVertex2f(1.0,

Does iOS5 support both GL_STENCIL_INDEX and GL_STENCIL_INDEX8?

烈酒焚心 提交于 2019-12-08 20:10:44
With the following code: GLuint viewRenderbuffer, viewFramebuffer, viewDepthbuffer, stencilBuffer; // Create the framebuffer object glGenFramebuffers(1, &viewFramebuffer); glBindFramebuffer(GL_FRAMEBUFFER, viewFramebuffer); // Create a render buffer and bind it to the FBO. glGenRenderbuffers(1, &viewRenderbuffer); glBindRenderbuffer(GL_RENDERBUFFER, viewRenderbuffer); [context renderbufferStorage:GL_RENDERBUFFER fromDrawable:(CAEAGLLayer*)self.layer]; glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, viewRenderbuffer); glGetRenderbufferParameteriv(GL_RENDERBUFFER

Anti-Aliasing issue with MSAA, drawing CSG with depth and FBO

浪子不回头ぞ 提交于 2019-12-08 19:21:10
问题 I have reimplemented OpenCSG for modern OpenGL version. PixelFormatAttributes: NSOpenGLPFAColorSize , 24 , NSOpenGLPFAAlphaSize , 8 , NSOpenGLPFADepthSize , 32 , NSOpenGLPFAStencilSize , 8 , NSOpenGLPFAAccelerated , NSOpenGLPFADoubleBuffer , NSOpenGLPFASupersample , NSOpenGLPFASampleBuffers, 1 , NSOpenGLPFASamples , 4 , FBO specs: (tried render to FBO with multisample, but lines getting more strong and visible, look on screenshot at bottom) - created texture with power of 2, GL_RGBA (tried GL

Does iOS5 support both GL_STENCIL_INDEX and GL_STENCIL_INDEX8?

不想你离开。 提交于 2019-12-08 06:03:42
问题 With the following code: GLuint viewRenderbuffer, viewFramebuffer, viewDepthbuffer, stencilBuffer; // Create the framebuffer object glGenFramebuffers(1, &viewFramebuffer); glBindFramebuffer(GL_FRAMEBUFFER, viewFramebuffer); // Create a render buffer and bind it to the FBO. glGenRenderbuffers(1, &viewRenderbuffer); glBindRenderbuffer(GL_RENDERBUFFER, viewRenderbuffer); [context renderbufferStorage:GL_RENDERBUFFER fromDrawable:(CAEAGLLayer*)self.layer]; glFramebufferRenderbuffer(GL_FRAMEBUFFER,

With OpenGL ES 2.0 on Android, is there a way preserve multisampling when rendering on a framebuffer?

人走茶凉 提交于 2019-12-08 05:15:46
问题 I am developing a 2d game on Android ICS using OpenGL es 2.0 and java. I am trying to use a lighting system and to do that I render all the lights on a framebuffer and the scene on another, with the intent to blend them using the fragment shader to recreate photoshop overlay effect. I encountered a problem though, it seems that the fbo doesn't work with multisampling, so if I draw on the fbo I get jagged lines. I noticed that there is a solution for people using ios, but I didn't find

OpenGL ES FBO Scaling

旧城冷巷雨未停 提交于 2019-12-08 04:34:27
问题 This question is a follow up to the original question as recommended by Matic Oblak Once an FBO is setup and rendered to, how is the rendered image provided back to the default render buffer and displayed in a scaled version. -(void)setupFBO { glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);