framebuffer - Blurring the depth buffer in OpenGL - how to access mipmap levels in a fragment shader? -
I'm trying to blur deep texture & amp; Blending mipmap levels in one piece shader
I have two frambuffer objects:
1) Depth attached to renderobject. 2) Depth of a color frambuffer with a z framebuffer with attached texture ..
Once I render the footage to the color framebuffer object, I can blit up the depth buffer object, and successfully provide that (output is a GL_LUMINANCE depth texture).
I can make depth buffers before drawing to successfully access any given mipmap level, for example, I can present mipmap level 3 as the following:
// FBO setup - All buffer objects are successfully created and full and color // has been rendered to framebuffer (it has attached a depth renderbuffer), and no // open errors Issued: glBindFramebuffer (GL_READ_FRAMEBUFFER, _fbo_color); GlobeFramebuffer (GLDRFFFFAMFF, _FB_OJ); GlBlitFramebuffer (0,0, _w, _h, 0, 0, _w, _h, GL_DEPTH_BUFFER_BIT, GL_NEAREST); GlGenerateMipmap (GL_TEXTURE_2D); GlobeFramebuffer (GL_FramMeFFERE, 0); // This works: // select mipmap level 3 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 3); GlTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 3); Draw_depth_texture_on_screen_aligned_quad (); // reset mapmap glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); Glatech PamMaratti (GL_EnglishEddi, GL_charcher_mx_layvl, 1000); As an alternative, I want to add the bias parameter to the texture2D () GLSL function, or use texture2DLod () and want to work with a single texture template, but whenever I have a level greater than 0 It seems that the mipmap has not been generated. // piece shader (both texture2DLod and texture2D (sample, tcoord, bias) // are behaving the same uniform; sampler2d zbuffer; uniform integer mipmap_level; zero main () {gl_FragColor = texture2DLod (Zbuffer, gl_TexCoord [0] .st, boat (mipmap_level));}
I am not sure how mipmapping works with glblitFramebuffer () but my questions What is the program done in the proper manner to set up so that the expected results of the call to texture2D / texture2DLod?
Ada, Dennis
OK - I think I got ... in my depth buffer The level of the mapmap was not created. During multi-creative, and rendering, I am activating the text color depth for the buffer texture, the user unit 0 for the framebuffer texture, and the texture unit 1. When I activate the texture So, I say glGenerateMipmap (GL_TEXTURE_2D) as follows:
glActiveTextureARB (GL_TEXTURE0_ARB); Globbdenctation (GL_VegetableEdda, _color_texture); GlGenerateMipmap (GL_TEXTURE_2D); GlActiveTextureARB (GL_TEXTURE1_ARB); Globbdenactation (GL_EnglishEddi, _Zabfre_text); GlGenerateMipmap (GL_TEXTURE_2D);
When this is done, Increase bias in Texture 2D (Sampler, Coordination, Bias) Expectedly gives pieces from the Mapmap level.
Comments
Post a Comment