GL3: Remove GL_EXT_framebuffer_object

--HG--
branch : opengl3
hg/feature/opengl3
kaetemi 11 years ago
parent 40a6972753
commit 3bba0fad6c

@ -373,10 +373,15 @@ bool CDriverGL3::setupDisplay()
#endif // NL_OS_WINDOWS
// Check required extensions!!
if (!_Extensions.GLCore)
{
nlwarning("Missing required GL 3.30 Core features. Update your driver");
throw EBadDisplay("Missing required GL 3.30 Core features. Update your driver");
}
if (!_Extensions.ARBSeparateShaderObjects)
{
nlwarning("Missing Required GL extension: GL_ARB_separate_shader_objects. Update your driver");
throw EBadDisplay("Missing Required GL extension: GL_ARB_separate_shader_objects. Update your driver");
nlwarning("Missing required GL extension: GL_ARB_separate_shader_objects. Update your driver");
throw EBadDisplay("Missing required GL extension: GL_ARB_separate_shader_objects. Update your driver");
}
// ARBMultiTexture is a OpenGL 1.2 required extension.
@ -550,7 +555,7 @@ bool CDriverGL3::activeFrameBufferObject(ITexture * tex)
}
else
{
nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
nglBindFramebuffer(GL_FRAMEBUFFER, 0);
return true;
}
}
@ -1680,7 +1685,7 @@ bool CDriverGL3::supportPackedDepthStencil() const
{
H_AUTO_OGL(CDriverGL3_supportPackedDepthStencil);
return _Extensions.PackedDepthStencil;
return true;
}
// ***************************************************************************
@ -1688,7 +1693,7 @@ bool CDriverGL3::supportFrameBufferObject() const
{
H_AUTO_OGL(CDriverGL3_supportFrameBufferObject);
return _Extensions.FrameBufferObject;
return true;
}
// ***************************************************************************

@ -318,6 +318,27 @@ PFNGLGETQUERYIVPROC nglGetQueryiv;
PFNGLGETQUERYOBJECTIVPROC nglGetQueryObjectiv;
PFNGLGETQUERYOBJECTUIVPROC nglGetQueryObjectuiv;
PFNGLISRENDERBUFFERPROC nglIsRenderbuffer;
PFNGLBINDRENDERBUFFERPROC nglBindRenderbuffer;
PFNGLDELETERENDERBUFFERSPROC nglDeleteRenderbuffers;
PFNGLGENRENDERBUFFERSPROC nglGenRenderbuffers;
PFNGLRENDERBUFFERSTORAGEPROC nglRenderbufferStorage;
PFNGLGETRENDERBUFFERPARAMETERIVPROC nglGetRenderbufferParameteriv;
PFNGLISFRAMEBUFFERPROC nglIsFramebuffer;
PFNGLBINDFRAMEBUFFERPROC nglBindFramebuffer;
PFNGLDELETEFRAMEBUFFERSPROC nglDeleteFramebuffers;
PFNGLGENFRAMEBUFFERSPROC nglGenFramebuffers;
PFNGLCHECKFRAMEBUFFERSTATUSPROC nglCheckFramebufferStatus;
PFNGLFRAMEBUFFERTEXTURE1DPROC nglFramebufferTexture1D;
PFNGLFRAMEBUFFERTEXTURE2DPROC nglFramebufferTexture2D;
PFNGLFRAMEBUFFERTEXTURE3DPROC nglFramebufferTexture3D;
PFNGLFRAMEBUFFERRENDERBUFFERPROC nglFramebufferRenderbuffer;
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC nglGetFramebufferAttachmentParameteriv;
PFNGLGENERATEMIPMAPPROC nglGenerateMipmap;
PFNGLBLITFRAMEBUFFERPROC nglBlitFramebuffer;
PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC nglRenderbufferStorageMultisample;
PFNGLFRAMEBUFFERTEXTURELAYERPROC nglFramebufferTextureLayer;
// GL_ARB_separate_shader_objects
PFNGLUSEPROGRAMSTAGESPROC nglUseProgramStages;
PFNGLACTIVESHADERPROGRAMPROC nglActiveShaderProgram;
@ -380,28 +401,6 @@ PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC nglProgramUniformMatrix4x3dv;
PFNGLVALIDATEPROGRAMPIPELINEPROC nglValidateProgramPipeline;
PFNGLGETPROGRAMPIPELINEINFOLOGPROC nglGetProgramPipelineInfoLog;
// GL_EXT_framebuffer_object
NEL_PFNGLISRENDERBUFFEREXTPROC nglIsRenderbufferEXT;
NEL_PFNGLISFRAMEBUFFEREXTPROC nglIsFramebufferEXT;
NEL_PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC nglCheckFramebufferStatusEXT;
NEL_PFNGLGENFRAMEBUFFERSEXTPROC nglGenFramebuffersEXT;
NEL_PFNGLBINDFRAMEBUFFEREXTPROC nglBindFramebufferEXT;
NEL_PFNGLFRAMEBUFFERTEXTURE2DEXTPROC nglFramebufferTexture2DEXT;
NEL_PFNGLGENRENDERBUFFERSEXTPROC nglGenRenderbuffersEXT;
NEL_PFNGLBINDRENDERBUFFEREXTPROC nglBindRenderbufferEXT;
NEL_PFNGLRENDERBUFFERSTORAGEEXTPROC nglRenderbufferStorageEXT;
NEL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC nglFramebufferRenderbufferEXT;
NEL_PFNGLDELETERENDERBUFFERSEXTPROC nglDeleteRenderbuffersEXT;
NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC nglDeleteFramebuffersEXT;
NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC nglGetRenderbufferParameterivEXT;
NEL_PFNGENERATEMIPMAPEXTPROC nglGenerateMipmapEXT;
// GL_EXT_framebuffer_blit
NEL_PFNGLBLITFRAMEBUFFEREXTPROC nglBlitFramebufferEXT;
// GL_EXT_framebuffer_multisample
NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC nglRenderbufferStorageMultisampleEXT;
// GL_ARB_multisample
NEL_PFNGLSAMPLECOVERAGEARBPROC nglSampleCoverageARB;
@ -701,64 +700,7 @@ static bool setupEXTTextureFilterAnisotropic(const char *glext)
return true;
}
// ***************************************************************************
static bool setupFrameBufferObject(const char *glext)
{
H_AUTO_OGL(setupFrameBufferObject);
CHECK_EXT("GL_EXT_framebuffer_object");
CHECK_ADDRESS(NEL_PFNGLISRENDERBUFFEREXTPROC, glIsRenderbufferEXT);
CHECK_ADDRESS(NEL_PFNGLISFRAMEBUFFEREXTPROC, glIsFramebufferEXT);
CHECK_ADDRESS(NEL_PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC, glCheckFramebufferStatusEXT);
CHECK_ADDRESS(NEL_PFNGLGENFRAMEBUFFERSEXTPROC, glGenFramebuffersEXT);
CHECK_ADDRESS(NEL_PFNGLBINDFRAMEBUFFEREXTPROC, glBindFramebufferEXT);
CHECK_ADDRESS(NEL_PFNGLFRAMEBUFFERTEXTURE2DEXTPROC, glFramebufferTexture2DEXT);
CHECK_ADDRESS(NEL_PFNGLGENRENDERBUFFERSEXTPROC, glGenRenderbuffersEXT);
CHECK_ADDRESS(NEL_PFNGLBINDRENDERBUFFEREXTPROC, glBindRenderbufferEXT);
CHECK_ADDRESS(NEL_PFNGLRENDERBUFFERSTORAGEEXTPROC, glRenderbufferStorageEXT);
CHECK_ADDRESS(NEL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC, glFramebufferRenderbufferEXT);
CHECK_ADDRESS(NEL_PFNGLDELETERENDERBUFFERSEXTPROC, glDeleteRenderbuffersEXT);
CHECK_ADDRESS(NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC, glDeleteFramebuffersEXT);
CHECK_ADDRESS(NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC, glGetRenderbufferParameterivEXT);
CHECK_ADDRESS(NEL_PFNGENERATEMIPMAPEXTPROC, glGenerateMipmapEXT);
return true;
}
// ***************************************************************************
static bool setupFrameBufferBlit(const char *glext)
{
H_AUTO_OGL(setupFrameBufferBlit);
CHECK_EXT("GL_EXT_framebuffer_blit");
CHECK_ADDRESS(NEL_PFNGLBLITFRAMEBUFFEREXTPROC, glBlitFramebufferEXT);
return true;
}
// ***************************************************************************
static bool setupFrameBufferMultisample(const char *glext)
{
H_AUTO_OGL(setupFrameBufferMultisample);
CHECK_EXT("GL_EXT_framebuffer_multisample");
CHECK_ADDRESS(NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC, glRenderbufferStorageMultisampleEXT);
return true;
}
// ***************************************************************************
static bool setupPackedDepthStencil(const char *glext)
{
H_AUTO_OGL(setupPackedDepthStencil);
CHECK_EXT("GL_EXT_packed_depth_stencil");
return true;
}
static bool setupCore(const char *glext)
static bool setupGLCore(const char *glext)
{
CHECK_ADDRESS(PFNGLATTACHSHADERPROC, glAttachShader);
CHECK_ADDRESS(PFNGLCOMPILESHADERPROC, glCompileShader);
@ -831,6 +773,27 @@ static bool setupCore(const char *glext)
CHECK_ADDRESS(PFNGLGETQUERYOBJECTIVPROC, glGetQueryObjectiv);
CHECK_ADDRESS(PFNGLGETQUERYOBJECTUIVPROC, glGetQueryObjectuiv);
CHECK_ADDRESS(PFNGLISRENDERBUFFERPROC, glIsRenderbuffer);
CHECK_ADDRESS(PFNGLBINDRENDERBUFFERPROC, glBindRenderbuffer);
CHECK_ADDRESS(PFNGLDELETERENDERBUFFERSPROC, glDeleteRenderbuffers);
CHECK_ADDRESS(PFNGLGENRENDERBUFFERSPROC, glGenRenderbuffers);
CHECK_ADDRESS(PFNGLRENDERBUFFERSTORAGEPROC, glRenderbufferStorage);
CHECK_ADDRESS(PFNGLGETRENDERBUFFERPARAMETERIVPROC, glGetRenderbufferParameteriv);
CHECK_ADDRESS(PFNGLISFRAMEBUFFERPROC, glIsFramebuffer);
CHECK_ADDRESS(PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer);
CHECK_ADDRESS(PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers);
CHECK_ADDRESS(PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers);
CHECK_ADDRESS(PFNGLCHECKFRAMEBUFFERSTATUSPROC, glCheckFramebufferStatus);
CHECK_ADDRESS(PFNGLFRAMEBUFFERTEXTURE1DPROC, glFramebufferTexture1D);
CHECK_ADDRESS(PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D);
CHECK_ADDRESS(PFNGLFRAMEBUFFERTEXTURE3DPROC, glFramebufferTexture3D);
CHECK_ADDRESS(PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer);
CHECK_ADDRESS(PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC, glGetFramebufferAttachmentParameteriv);
CHECK_ADDRESS(PFNGLGENERATEMIPMAPPROC, glGenerateMipmap);
CHECK_ADDRESS(PFNGLBLITFRAMEBUFFERPROC, glBlitFramebuffer);
CHECK_ADDRESS(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample);
CHECK_ADDRESS(PFNGLFRAMEBUFFERTEXTURELAYERPROC, glFramebufferTextureLayer);
return true;
}
@ -939,7 +902,7 @@ void registerGlExtensions(CGlExtensions &ext)
}
// Check 3.30 Core
setupCore(glext);
ext.GLCore = setupGLCore(glext);
// Check GL_ARB_separate_shader_objects
ext.ARBSeparateShaderObjects = setupARBSeparateShaderObjects(glext);
@ -998,18 +961,6 @@ void registerGlExtensions(CGlExtensions &ext)
// get the maximum value
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &ext.EXTTextureFilterAnisotropicMaximum);
}
// Check GL_EXT_framebuffer_object
ext.FrameBufferObject = setupFrameBufferObject(glext);
// Check GL_EXT_framebuffer_blit
ext.FrameBufferBlit = setupFrameBufferBlit(glext);
// Check GL_EXT_framebuffer_multisample
ext.FrameBufferMultisample = setupFrameBufferMultisample(glext);
// Check GL_EXT_packed_depth_stencil
ext.PackedDepthStencil = setupPackedDepthStencil(glext);
}

@ -36,6 +36,7 @@ struct CGlExtensions
std::string GLVersion;
// Required Extensions.
bool GLCore;
bool ARBSeparateShaderObjects;
bool ARBMultiTexture;
@ -49,10 +50,6 @@ struct CGlExtensions
bool NVTextureRectangle;
bool EXTTextureRectangle;
bool ARBTextureRectangle;
bool FrameBufferObject;
bool FrameBufferBlit;
bool FrameBufferMultisample;
bool PackedDepthStencil;
bool EXTTextureFilterAnisotropic;
float EXTTextureFilterAnisotropicMaximum;
@ -102,10 +99,6 @@ public:
ARBTextureRectangle = false;
ARBTextureNonPowerOfTwo = false;
ARBMultisample = false;
FrameBufferObject = false;
FrameBufferBlit = false;
FrameBufferMultisample = false;
PackedDepthStencil = false;
NVStateVARWithoutFlush = 0;
}
@ -128,10 +121,6 @@ public:
result += "texture stages(*) = ";
result += NLMISC::toString(NbTextureStages);
result += "\n Programs: ";
result += "ARBFragmentProgram ";
result += "ARBVertexProgram";
result += "\n Misc: ";
result += EXTVertexWeighting ? "EXTVertexWeighting " : "";
result += EXTSeparateSpecularColor ? "EXTSeparateSpecularColor " : "";
@ -153,15 +142,6 @@ public:
result += GLXMESASwapControl ? "GLXMESASwapControl " : "";
#endif
result += "\n Array/VBO: ";
result += "VertexBufferObject";
result += "\n FBO: ";
result += FrameBufferObject ? "FramebufferObject " : "";
result += FrameBufferBlit ? "FrameBufferBlit " : "";
result += FrameBufferMultisample ? "FrameBufferMultisample " : "";
result += PackedDepthStencil ? "PackedDepthStencil " : "";
return result;
}
@ -394,7 +374,7 @@ extern PFNGLGETVERTEXATTRIBIVARBPROC nglGetVertexAttribivARB;
extern PFNGLGETVERTEXATTRIBPOINTERVARBPROC nglGetVertexAttribPointervARB;
extern PFNGLISPROGRAMARBPROC nglIsProgramARB;
// Core
// Core 3.30
extern PFNGLATTACHSHADERPROC nglAttachShader;
extern PFNGLCOMPILESHADERPROC nglCompileShader;
extern PFNGLCREATEPROGRAMPROC nglCreateProgram;
@ -466,6 +446,27 @@ extern PFNGLGETQUERYIVPROC nglGetQueryiv;
extern PFNGLGETQUERYOBJECTIVPROC nglGetQueryObjectiv;
extern PFNGLGETQUERYOBJECTUIVPROC nglGetQueryObjectuiv;
extern PFNGLISRENDERBUFFERPROC nglIsRenderbuffer;
extern PFNGLBINDRENDERBUFFERPROC nglBindRenderbuffer;
extern PFNGLDELETERENDERBUFFERSPROC nglDeleteRenderbuffers;
extern PFNGLGENRENDERBUFFERSPROC nglGenRenderbuffers;
extern PFNGLRENDERBUFFERSTORAGEPROC nglRenderbufferStorage;
extern PFNGLGETRENDERBUFFERPARAMETERIVPROC nglGetRenderbufferParameteriv;
extern PFNGLISFRAMEBUFFERPROC nglIsFramebuffer;
extern PFNGLBINDFRAMEBUFFERPROC nglBindFramebuffer;
extern PFNGLDELETEFRAMEBUFFERSPROC nglDeleteFramebuffers;
extern PFNGLGENFRAMEBUFFERSPROC nglGenFramebuffers;
extern PFNGLCHECKFRAMEBUFFERSTATUSPROC nglCheckFramebufferStatus;
extern PFNGLFRAMEBUFFERTEXTURE1DPROC nglFramebufferTexture1D;
extern PFNGLFRAMEBUFFERTEXTURE2DPROC nglFramebufferTexture2D;
extern PFNGLFRAMEBUFFERTEXTURE3DPROC nglFramebufferTexture3D;
extern PFNGLFRAMEBUFFERRENDERBUFFERPROC nglFramebufferRenderbuffer;
extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC nglGetFramebufferAttachmentParameteriv;
extern PFNGLGENERATEMIPMAPPROC nglGenerateMipmap;
extern PFNGLBLITFRAMEBUFFERPROC nglBlitFramebuffer;
extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC nglRenderbufferStorageMultisample;
extern PFNGLFRAMEBUFFERTEXTURELAYERPROC nglFramebufferTextureLayer;
// GL_ARB_separate_shader_objects
extern PFNGLUSEPROGRAMSTAGESPROC nglUseProgramStages;
extern PFNGLACTIVESHADERPROGRAMPROC nglActiveShaderProgram;
@ -569,28 +570,6 @@ extern NEL_PFNGLXGETSWAPINTERVALMESAPROC nglXGetSwapIntervalMESA;
#endif
// GL_EXT_framebuffer_object
extern NEL_PFNGLISRENDERBUFFEREXTPROC nglIsRenderbufferEXT;
extern NEL_PFNGLISFRAMEBUFFEREXTPROC nglIsFramebufferEXT;
extern NEL_PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC nglCheckFramebufferStatusEXT;
extern NEL_PFNGLGENFRAMEBUFFERSEXTPROC nglGenFramebuffersEXT;
extern NEL_PFNGLBINDFRAMEBUFFEREXTPROC nglBindFramebufferEXT;
extern NEL_PFNGLFRAMEBUFFERTEXTURE2DEXTPROC nglFramebufferTexture2DEXT;
extern NEL_PFNGLGENRENDERBUFFERSEXTPROC nglGenRenderbuffersEXT;
extern NEL_PFNGLBINDRENDERBUFFEREXTPROC nglBindRenderbufferEXT;
extern NEL_PFNGLRENDERBUFFERSTORAGEEXTPROC nglRenderbufferStorageEXT;
extern NEL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC nglFramebufferRenderbufferEXT;
extern NEL_PFNGLDELETERENDERBUFFERSEXTPROC nglDeleteRenderbuffersEXT;
extern NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC nglDeleteFramebuffersEXT;
extern NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC nglGetRenderbufferParameterivEXT;
extern NEL_PFNGENERATEMIPMAPEXTPROC nglGenerateMipmapEXT;
// GL_EXT_framebuffer_blit
extern NEL_PFNGLBLITFRAMEBUFFEREXTPROC nglBlitFramebufferEXT;
// GL_EXT_framebuffer_multisample
extern NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC nglRenderbufferStorageMultisampleEXT;
// GL_ARB_multisample
extern NEL_PFNGLSAMPLECOVERAGEARBPROC nglSampleCoverageARB;

@ -173,24 +173,6 @@ typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMIVARBPROC)(GLenum target, GLenum pn
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMSTRINGARBPROC)(GLenum target, GLenum pname, GLvoid *string);
typedef GLboolean (APIENTRY *NEL_PFNGLISPROGRAMARBPROC)(GLuint program);
typedef GLboolean (APIENTRY * NEL_PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);
typedef GLboolean (APIENTRY * NEL_PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer);
typedef GLenum (APIENTRY * NEL_PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum pname);
typedef GLvoid (APIENTRY * NEL_PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers);
typedef GLvoid (APIENTRY * NEL_PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer);
typedef GLvoid (APIENTRY * NEL_PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef GLvoid (APIENTRY * NEL_PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers);
typedef GLvoid (APIENTRY * NEL_PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);
typedef GLvoid (APIENTRY * NEL_PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
typedef GLvoid (APIENTRY * NEL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
typedef GLvoid (APIENTRY * NEL_PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers);
typedef GLvoid (APIENTRY * NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers);
typedef GLvoid (APIENTRY * NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
typedef GLvoid (APIENTRY * NEL_PFNGENERATEMIPMAPEXTPROC) (GLenum target);
typedef GLvoid (APIENTRY * NEL_PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
typedef GLvoid (APIENTRY * NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
#ifndef NL_GL_ARB_multisample

@ -87,12 +87,12 @@ CTextureDrvInfosGL3::~CTextureDrvInfosGL3()
if (InitFBO)
{
nglDeleteFramebuffersEXT(1, &FBOId);
nglDeleteFramebuffers(1, &FBOId);
if (AttachDepthStencil)
{
nglDeleteRenderbuffersEXT(1, &DepthFBOId);
nglDeleteRenderbuffers(1, &DepthFBOId);
if (!UsePackedDepthStencil)
nglDeleteRenderbuffersEXT(1, &StencilFBOId);
nglDeleteRenderbuffers(1, &StencilFBOId);
}
}
}
@ -108,21 +108,21 @@ bool CTextureDrvInfosGL3::initFrameBufferObject(ITexture * tex)
}
// generate IDs
nglGenFramebuffersEXT(1, &FBOId);
nglGenFramebuffers(1, &FBOId);
if (AttachDepthStencil)
{
nglGenRenderbuffersEXT(1, &DepthFBOId);
nglGenRenderbuffers(1, &DepthFBOId);
if (UsePackedDepthStencil)
StencilFBOId = DepthFBOId;
else
nglGenRenderbuffersEXT(1, &StencilFBOId);
nglGenRenderbuffers(1, &StencilFBOId);
}
//nldebug("3D: using depth %d and stencil %d", DepthFBOId, StencilFBOId);
// initialize FBO
nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBOId);
nglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, TextureMode, ID, 0);
nglBindFramebuffer(GL_FRAMEBUFFER, FBOId);
nglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, TextureMode, ID, 0);
// attach depth/stencil render to FBO
// note: for some still unkown reason it's impossible to add
@ -130,113 +130,79 @@ bool CTextureDrvInfosGL3::initFrameBufferObject(ITexture * tex)
// opengl.org extension registry). Until a safe approach to add
// them is found, there will be no attached stencil for the time
// being, aside of using packed depth+stencil buffers.
// FIXME GL3
if (AttachDepthStencil)
{
if (UsePackedDepthStencil)
{
//nldebug("3D: using packed depth stencil");
nglBindRenderbufferEXT(GL_RENDERBUFFER_EXT, StencilFBOId);
nglRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, tex->getWidth(), tex->getHeight());
nglBindRenderbuffer(GL_RENDERBUFFER, StencilFBOId);
nglRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, tex->getWidth(), tex->getHeight());
}
else
{
nglBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthFBOId);
nglRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, tex->getWidth(), tex->getHeight());
nglBindRenderbuffer(GL_RENDERBUFFER, DepthFBOId);
nglRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, tex->getWidth(), tex->getHeight());
/*
nglBindRenderbufferEXT(GL_RENDERBUFFER_EXT, StencilFBOId);
nglRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX8_EXT, tex->getWidth(), tex->getHeight());
nglBindRenderbuffer(GL_RENDERBUFFER, StencilFBOId);
nglRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, tex->getWidth(), tex->getHeight());
*/
}
nglFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, DepthFBOId);
nldebug("3D: glFramebufferRenderbufferExt(depth:24) = %X", nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT));
nglFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, StencilFBOId);
nldebug("3D: glFramebufferRenderbufferExt(stencil:8) = %X", nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT));
nglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
GL_RENDERBUFFER, DepthFBOId);
nldebug("3D: glFramebufferRenderbufferExt(depth:24) = %X", nglCheckFramebufferStatus(GL_FRAMEBUFFER));
nglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
GL_RENDERBUFFER, StencilFBOId);
nldebug("3D: glFramebufferRenderbufferExt(stencil:8) = %X", nglCheckFramebufferStatus(GL_FRAMEBUFFER));
}
// check status
GLenum status;
status = (GLenum) nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
status = (GLenum) nglCheckFramebufferStatus(GL_FRAMEBUFFER);
switch(status) {
#ifdef GL_FRAMEBUFFER_COMPLETE_EXT
case GL_FRAMEBUFFER_COMPLETE_EXT:
#ifdef GL_FRAMEBUFFER_COMPLETE
case GL_FRAMEBUFFER_COMPLETE:
InitFBO = true;
break;
#endif
#ifdef GL_FRAMEBUFFER_COMPLETE_OES
case GL_FRAMEBUFFER_COMPLETE_OES:
InitFBO = true;
break;
#endif
#ifdef GL_FRAMEBUFFER_UNSUPPORTED_EXT
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
nlwarning("Unsupported framebuffer format");
break;
#endif
#ifdef GL_FRAMEBUFFER_UNSUPPORTED_OES
case GL_FRAMEBUFFER_UNSUPPORTED_OES:
#ifdef GL_FRAMEBUFFER_UNSUPPORTED
case GL_FRAMEBUFFER_UNSUPPORTED:
nlwarning("Unsupported framebuffer format");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
#ifdef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
nlwarning("Framebuffer incomplete attachment");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES:
nlwarning("Framebuffer incomplete attachment");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
nlwarning("Framebuffer incomplete, missing attachment");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES:
#ifdef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
nlwarning("Framebuffer incomplete, missing attachment");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT
case GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT:
#ifdef GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT
case GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT:
nlwarning("Framebuffer incomplete, duplicate attachment");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
#ifdef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
nlwarning("Framebuffer incomplete, attached images must have same dimensions");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES:
nlwarning("Framebuffer incomplete, attached images must have same dimensions");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
nlwarning("Framebuffer incomplete, attached images must have same format");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES:
#ifdef GL_FRAMEBUFFER_INCOMPLETE_FORMATS
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS:
nlwarning("Framebuffer incomplete, attached images must have same format");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
#ifdef GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:
nlwarning("Framebuffer incomplete, missing draw buffer");
break;
#endif
#ifdef GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
nlwarning("Framebuffer incomplete, missing read buffer");
break;
#endif
#ifdef GL_FRAMEBUFFER_BINDING_EXT
case GL_FRAMEBUFFER_BINDING_EXT:
#ifdef GL_FRAMEBUFFER_BINDING
case GL_FRAMEBUFFER_BINDING:
nlwarning("Framebuffer BINDING_EXT");
break;
#endif
@ -244,11 +210,6 @@ bool CTextureDrvInfosGL3::initFrameBufferObject(ITexture * tex)
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
nlwarning("Framebuffer incomplete multisample");
break;
#endif
#ifdef GL_FRAMEBUFFER_BINDING_OES
case GL_FRAMEBUFFER_BINDING_OES:
nlwarning("Framebuffer BINDING_EXT");
break;
#endif
default:
nlwarning("Framebuffer incomplete status %d", (sint)status);
@ -258,14 +219,14 @@ bool CTextureDrvInfosGL3::initFrameBufferObject(ITexture * tex)
// clean up resources if allocation failed
if (!InitFBO)
{
nglDeleteFramebuffersEXT(1, &FBOId);
nglDeleteFramebuffers(1, &FBOId);
if (AttachDepthStencil)
{
nglDeleteRenderbuffersEXT(1, &DepthFBOId);
nglDeleteRenderbuffers(1, &DepthFBOId);
if (!UsePackedDepthStencil)
nglDeleteRenderbuffersEXT(1, &StencilFBOId);
nglDeleteRenderbuffers(1, &StencilFBOId);
}
}
@ -282,14 +243,14 @@ bool CTextureDrvInfosGL3::activeFrameBufferObject(ITexture * tex)
if (initFrameBufferObject(tex))
{
glBindTexture(TextureMode, 0);
nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBOId);
nglBindFramebuffer(GL_FRAMEBUFFER, FBOId);
}
else
return false;
}
else
{
nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
nglBindFramebuffer(GL_FRAMEBUFFER, 0);
}
return true;

Loading…
Cancel
Save