本文整理汇总了C++中Extensions3D::renderbufferStorageMultisampleIMG方法的典型用法代码示例。如果您正苦于以下问题:C++ Extensions3D::renderbufferStorageMultisampleIMG方法的具体用法?C++ Extensions3D::renderbufferStorageMultisampleIMG怎么用?C++ Extensions3D::renderbufferStorageMultisampleIMG使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Extensions3D
的用法示例。
在下文中一共展示了Extensions3D::renderbufferStorageMultisampleIMG方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getExtensions
bool GraphicsContext3D::reshapeFBOs(const IntSize& size)
{
// A BlackBerry-specific implementation of reshapeFBOs is necessary because it contains:
// - an Imagination-specific implementation of anti-aliasing
// - an Imagination-specific fix for FBOs of size less than (16,16)
int fboWidth = size.width();
int fboHeight = size.height();
// Imagination-specific fix
if (m_isImaginationHardware) {
fboWidth = std::max(fboWidth, 16);
fboHeight = std::max(fboHeight, 16);
}
GLuint internalColorFormat, colorFormat, internalDepthStencilFormat = 0;
if (m_attrs.alpha) {
internalColorFormat = GL_RGBA;
colorFormat = GL_RGBA;
} else {
internalColorFormat = GL_RGB;
colorFormat = GL_RGB;
}
if (m_attrs.stencil || m_attrs.depth) {
// We don't allow the logic where stencil is required and depth is not.
// See GraphicsContext3D constructor.
if (m_attrs.stencil && m_attrs.depth)
internalDepthStencilFormat = GL_DEPTH24_STENCIL8_EXT;
else
internalDepthStencilFormat = GL_DEPTH_COMPONENT16;
}
GLint sampleCount = 8;
if (m_attrs.antialias) {
GLint maxSampleCount;
// Hardcode the maximum number of samples due to header issue (PR132183)
// ::glGetIntegerv(GL_MAX_SAMPLES_IMG, &maxSampleCount);
maxSampleCount = 4;
sampleCount = std::min(8, maxSampleCount);
}
bool mustRestoreFBO = false;
if (m_state.boundFBO != m_fbo) {
mustRestoreFBO = true;
::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_fbo);
}
::glBindTexture(GL_TEXTURE_2D, m_texture);
::glTexImage2D(GL_TEXTURE_2D, 0, internalColorFormat, fboWidth, fboHeight, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
Extensions3D* extensions = getExtensions();
if (m_attrs.antialias) {
extensions->framebufferTexture2DMultisampleIMG(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_texture, 0, sampleCount);
if (m_attrs.stencil || m_attrs.depth) {
::glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_depthStencilBuffer);
extensions->renderbufferStorageMultisampleIMG(GL_RENDERBUFFER_EXT, sampleCount, internalDepthStencilFormat, fboWidth, fboHeight);
if (m_attrs.stencil)
::glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthStencilBuffer);
if (m_attrs.depth)
::glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthStencilBuffer);
::glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
}
} else {
::glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_texture, 0);
if (m_attrs.stencil || m_attrs.depth) {
::glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_depthStencilBuffer);
::glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, internalDepthStencilFormat, fboWidth, fboHeight);
if (m_attrs.stencil)
::glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthStencilBuffer);
if (m_attrs.depth)
::glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthStencilBuffer);
::glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
}
}
::glBindTexture(GL_TEXTURE_2D, 0);
logFrameBufferStatus(__LINE__);
return mustRestoreFBO;
}