From 150ee87471486436e3bd954ecf58f8fbc8e5ecf8 Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Sat, 5 Apr 2014 20:53:38 +0200 Subject: [PATCH] Use glFrameBufferTexture on shadows buffer We're sure there is at least gl 3.2 support. --- src/graphics/glwrap.cpp | 2 ++ src/graphics/glwrap.hpp | 1 + src/graphics/rtts.cpp | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/graphics/glwrap.cpp b/src/graphics/glwrap.cpp index 80e45bb2d..51581bed8 100644 --- a/src/graphics/glwrap.cpp +++ b/src/graphics/glwrap.cpp @@ -58,6 +58,7 @@ PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB; PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers; PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer; PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D; +PFNGLFRAMEBUFFERTEXTUREPROC glFramebufferTexture; PFNGLTEXIMAGE3DPROC glTexImage3D; PFNGLGENERATEMIPMAPPROC glGenerateMipmap; PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus; @@ -200,6 +201,7 @@ void initGL() glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)IRR_OGL_LOAD_EXTENSION("glGenFramebuffers"); glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)IRR_OGL_LOAD_EXTENSION("glBindFramebuffer"); glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)IRR_OGL_LOAD_EXTENSION("glFramebufferTexture2D"); + glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)IRR_OGL_LOAD_EXTENSION("glFramebufferTexture"); glTexImage3D = (PFNGLTEXIMAGE3DPROC)IRR_OGL_LOAD_EXTENSION("glTexImage3D"); glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)IRR_OGL_LOAD_EXTENSION("glGenerateMipmap"); glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)IRR_OGL_LOAD_EXTENSION("glCheckFramebufferStatus"); diff --git a/src/graphics/glwrap.hpp b/src/graphics/glwrap.hpp index a7ecbc57d..da1552b04 100644 --- a/src/graphics/glwrap.hpp +++ b/src/graphics/glwrap.hpp @@ -75,6 +75,7 @@ extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer; extern PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers; extern PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer; extern PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D; +extern PFNGLFRAMEBUFFERTEXTUREPROC glFramebufferTexture; extern PFNGLTEXIMAGE3DPROC glTexImage3D; extern PFNGLGENERATEMIPMAPPROC glGenerateMipmap; extern PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus; diff --git a/src/graphics/rtts.cpp b/src/graphics/rtts.cpp index 74e191182..033631b58 100644 --- a/src/graphics/rtts.cpp +++ b/src/graphics/rtts.cpp @@ -128,8 +128,8 @@ RTT::RTT() glGenTextures(1, &shadowDepthTex); glBindTexture(GL_TEXTURE_2D_ARRAY, shadowDepthTex); glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_DEPTH_COMPONENT24, 1024, 1024, 4, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_ARRAY, shadowColorTex, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D_ARRAY, shadowDepthTex, 0); + glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, shadowColorTex, 0); + glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, shadowDepthTex, 0); GLenum result = glCheckFramebufferStatus(GL_FRAMEBUFFER); assert(result == GL_FRAMEBUFFER_COMPLETE_EXT); }