本文整理汇总了C++中ViewportPtr::getPixelWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewportPtr::getPixelWidth方法的具体用法?C++ ViewportPtr::getPixelWidth怎么用?C++ ViewportPtr::getPixelWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewportPtr
的用法示例。
在下文中一共展示了ViewportPtr::getPixelWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: composeViewport
void ParallelComposer::composeViewport(ViewportPtr port)
{
#ifdef OSG_WITH_PARALLEL
// setup viewport
GLint
pl=port->getPixelLeft(),
pr=port->getPixelRight(),
pb=port->getPixelBottom(),
pt=port->getPixelTop();
if(_wWidth != pr-pl+1 || _wHeight != pt-pb+1)
{
_wWidth = pr-pl+1;
_wHeight= pt-pb+1;
_createContext = true;
}
bool full = port->isFullWindow();
glViewport(pl, pb, _wWidth, _wHeight);
glScissor(pl, pb, _wWidth, _wHeight);
if(! full)
glEnable(GL_SCISSOR_TEST);
GLboolean depth = glIsEnabled(GL_DEPTH_TEST);
GLboolean blend = glIsEnabled(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, port->getPixelWidth(),
0, port->getPixelHeight(),-1,1);
if(_createContext)
{
createCtx(port);
_createContext = false;
}
if(getAlpha())
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
if(isClient())
{
UInt32 id = beginFrame();
renderRead();
endFrame(id);
drawFrame();
}
else
{
if(clusterId() < _usableServers)
{
UInt32 id = beginFrame();
renderRead();
endFrame(id);
//drawFrame();
}
}
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glEnable(GL_DEPTH_TEST);
// reset state
if(depth && !glIsEnabled(GL_DEPTH_TEST))
glEnable(GL_DEPTH_TEST);
if(!blend && glIsEnabled(GL_BLEND))
glDisable(GL_BLEND);
#endif
}
示例2: composeViewport
void BinarySwapComposer::composeViewport(ViewportPtr port)
{
// setup viewport
GLint
pl=port->getPixelLeft(),
pr=port->getPixelRight(),
pb=port->getPixelBottom(),
pt=port->getPixelTop();
GLint pw=pr-pl+1,ph=pt-pb+1;
bool full = port->isFullWindow();
glViewport(pl, pb, pw, ph);
glScissor(pl, pb, pw, ph);
if(! full)
glEnable(GL_SCISSOR_TEST);
GLboolean depth = glIsEnabled(GL_DEPTH_TEST);
GLboolean blend = glIsEnabled(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, port->getPixelWidth(),
0, port->getPixelHeight(),-1,1);
// printf("max %x,%x\n",_intDepthMax,_shortDepthMax);
if(getAlpha())
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
_tilesX = port->getPixelWidth() / getTileSize() + 1;
_tilesY = port->getPixelHeight() / getTileSize() + 1;
_tileBufferSize = getTileSize()*getTileSize()*8+sizeof(TileBuffer);
_readTile.resize(_tileBufferSize);
_statistics.bytesIn = 0;
_statistics.bytesOut = 0;
if(isClient())
{
if(getShort())
{
UInt16 colorDummy;
UInt32 depthDummy;
recvFromServers(depthDummy,colorDummy,
GL_RGB,
GL_UNSIGNED_SHORT_5_6_5,
port);
}
else
{
if(getAlpha())
{
UInt32 colorDummy;
UInt32 depthDummy;
recvFromServers(depthDummy,colorDummy,
GL_RGBA,
GL_UNSIGNED_BYTE,
port);
}
else
{
RGBValue colorDummy;
UInt32 depthDummy;
recvFromServers(depthDummy,colorDummy,
GL_RGB,
GL_UNSIGNED_BYTE,
port);
}
}
if(getStatistics())
{
UInt32 maxIn = _statistics.bytesIn;
UInt32 maxOut = _statistics.bytesOut;
UInt32 maxIO = maxIn + maxOut;
UInt32 sumOut = _statistics.bytesOut;
UInt32 missing = _usableServers;
double composeTime = 1e32;
Connection *server;
Statistics statistics;
for(UInt32 i=0 ; i<_usableServers ;++i)
{
server = clusterWindow()->getNetwork()->getConnection(i);
server->selectChannel();
server->get(&statistics,sizeof(Statistics));
sumOut += statistics.bytesOut;
if(statistics.composeTime < composeTime)
composeTime = statistics.composeTime;
if(statistics.bytesOut > maxOut)
maxOut = statistics.bytesOut;
if(statistics.bytesIn > maxIn)
maxIn = statistics.bytesIn;
if(statistics.bytesIn + statistics.bytesOut > maxIO)
maxIO = statistics.bytesIn + statistics.bytesOut;
//.........这里部分代码省略.........