本文整理汇总了C++中PixelBox::getTopLeftFrontPixelPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ PixelBox::getTopLeftFrontPixelPtr方法的具体用法?C++ PixelBox::getTopLeftFrontPixelPtr怎么用?C++ PixelBox::getTopLeftFrontPixelPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PixelBox
的用法示例。
在下文中一共展示了PixelBox::getTopLeftFrontPixelPtr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyContentsToMemory
void EGLWindow::copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer)
{
if ((dst.left < 0) || (dst.right > mWidth) ||
(dst.top < 0) || (dst.bottom > mHeight) ||
(dst.front != 0) || (dst.back != 1))
{
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"Invalid box.",
"Win32Window::copyContentsToMemory" );
}
if (buffer == FB_AUTO)
{
buffer = mIsFullScreen? FB_FRONT : FB_BACK;
}
GLenum format = GLESPixelUtil::getGLOriginFormat(dst.format);
GLenum type = GLESPixelUtil::getGLOriginDataType(dst.format);
if ((format == 0) || (type == 0))
{
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"Unsupported format.",
"GtkEGLWindow::copyContentsToMemory" );
}
// Switch context if different from current one
RenderSystem* rsys = Root::getSingleton().getRenderSystem();
rsys->_setViewport(this->getViewport(0));
#if OGRE_NO_GLES3_SUPPORT == 0
if(dst.getWidth() != dst.rowPitch)
glPixelStorei(GL_PACK_ROW_LENGTH, dst.rowPitch);
#endif
// Must change the packing to ensure no overruns!
glPixelStorei(GL_PACK_ALIGNMENT, 1);
//glReadBuffer((buffer == FB_FRONT)? GL_FRONT : GL_BACK);
glReadPixels((GLint)0, (GLint)(mHeight - dst.getHeight()),
(GLsizei)dst.getWidth(), (GLsizei)dst.getHeight(),
format, type, dst.getTopLeftFrontPixelPtr());
// restore default alignment
glPixelStorei(GL_PACK_ALIGNMENT, 4);
#if OGRE_NO_GLES3_SUPPORT == 0
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
#endif
PixelUtil::bulkPixelVerticalFlip(dst);
}
示例2: copyContentsToMemory
void SDLWindow::copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer)
{
if (dst.getWidth() > mWidth ||
dst.getHeight() > mHeight ||
dst.front != 0 || dst.back != 1)
{
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"Invalid box.",
"SDLWindow::copyContentsToMemory" );
}
if (buffer == FB_AUTO)
{
buffer = mIsFullScreen? FB_FRONT : FB_BACK;
}
GLenum format = Ogre::GL3PlusPixelUtil::getGLOriginFormat(dst.format);
GLenum type = Ogre::GL3PlusPixelUtil::getGLOriginDataType(dst.format);
if ((format == GL_NONE) || (type == 0))
{
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"Unsupported format.",
"SDLWindow::copyContentsToMemory" );
}
if(dst.getWidth() != dst.rowPitch)
{
glPixelStorei(GL_PACK_ROW_LENGTH, dst.rowPitch);
}
if((dst.getWidth()*Ogre::PixelUtil::getNumElemBytes(dst.format)) & 3)
{
// Standard alignment of 4 is not right
glPixelStorei(GL_PACK_ALIGNMENT, 1);
}
glReadBuffer((buffer == FB_FRONT)? GL_FRONT : GL_BACK);
glReadPixels((GLint)0, (GLint)(mHeight - dst.getHeight()),
(GLsizei)dst.getWidth(), (GLsizei)dst.getHeight(),
format, type, dst.getTopLeftFrontPixelPtr());
glPixelStorei(GL_PACK_ALIGNMENT, 4);
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
PixelUtil::bulkPixelVerticalFlip(dst);
}