mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Add FBO for depth buffer.
This commit is contained in:
parent
8e3e41356a
commit
00c12e2d1d
|
@ -67,6 +67,8 @@ void DepthBuffer_Remove( DepthBuffer *buffer )
|
|||
|
||||
if (buffer->renderbuf != 0)
|
||||
ogl_glDeleteRenderbuffers(1, &buffer->renderbuf);
|
||||
if (buffer->fbo != 0)
|
||||
ogl_glDeleteFramebuffers(1, &buffer->fbo);
|
||||
if (buffer->depth_texture != NULL)
|
||||
TextureCache_Remove( buffer->depth_texture );
|
||||
free( buffer );
|
||||
|
@ -96,6 +98,7 @@ DepthBuffer *DepthBuffer_AddTop()
|
|||
newtop->lower = depthBuffer.top;
|
||||
newtop->higher = NULL;
|
||||
newtop->renderbuf = 0;
|
||||
newtop->fbo = 0;
|
||||
|
||||
if (depthBuffer.top)
|
||||
depthBuffer.top->higher = newtop;
|
||||
|
|
|
@ -10,6 +10,7 @@ struct DepthBuffer
|
|||
u32 address, width;
|
||||
GLuint renderbuf;
|
||||
CachedTexture *depth_texture;
|
||||
GLuint fbo;
|
||||
};
|
||||
|
||||
struct DepthBufferInfo
|
||||
|
|
|
@ -345,6 +345,13 @@ void _initDepthTexture()
|
|||
glTexImage2D(GL_TEXTURE_2D, 0, depthTextureInternalFormat, depthBuffer.top->depth_texture->realWidth, depthBuffer.top->depth_texture->realHeight, 0, GL_RED, depthTextureType, NULL);
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glBindTexture( GL_TEXTURE_2D, 0);
|
||||
ogl_glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
ogl_glGenFramebuffers(1, &depthBuffer.top->fbo);
|
||||
ogl_glBindFramebuffer(GL_DRAW_FRAMEBUFFER, depthBuffer.top->fbo);
|
||||
ogl_glFramebufferTexture(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, depthBuffer.top->depth_texture->glName, 0);
|
||||
ogl_glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
ogl_glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBuffer.top->fbo);
|
||||
frameBuffer.top->pDepthBuffer = depthBuffer.top;
|
||||
void GLSL_ClearDepthBuffer();
|
||||
GLSL_ClearDepthBuffer();
|
||||
|
|
Loading…
Reference in New Issue
Block a user