Fixed warnings

This commit is contained in:
Robert Osfield
2007-01-04 16:48:23 +00:00
parent a0374d7c85
commit cce656a19b
2 changed files with 78 additions and 56 deletions

View File

@@ -224,8 +224,8 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo)
osg::Camera::BufferAttachmentMap& bufferAttachements = _camera->getBufferAttachmentMap();
// compute the required dimensions
int width = _viewport->x() + _viewport->width();
int height = _viewport->y() + _viewport->height();
int width = static_cast<int>(_viewport->x() + _viewport->width());
int height = static_cast<int>(_viewport->y() + _viewport->height());
int depth = 1;
osg::Camera::BufferAttachmentMap::iterator itr;
for(itr = bufferAttachements.begin();
@@ -635,60 +635,61 @@ void RenderStage::copyTexture(osg::RenderInfo& renderInfo)
osg::TextureRectangle* textureRec = 0;
osg::TextureCubeMap* textureCubeMap = 0;
#if 1
// use TexCopySubImage with the offset of the viewport into the texture
// note, this path mirrors the pbuffer and fbo means for updating the texture.
// Robert Osfield, 3rd August 2006.
if ((texture2D = dynamic_cast<osg::Texture2D*>(_texture.get())) != 0)
{
texture2D->copyTexSubImage2D(state,_viewport->x(),_viewport->y(), _viewport->x(),_viewport->y(),_viewport->width(),_viewport->height());
texture2D->copyTexSubImage2D(state,
static_cast<int>(_viewport->x()),
static_cast<int>(_viewport->y()),
static_cast<int>(_viewport->x()),
static_cast<int>(_viewport->y()),
static_cast<int>(_viewport->width()),
static_cast<int>(_viewport->height()));
}
else if ((textureRec = dynamic_cast<osg::TextureRectangle*>(_texture.get())) != 0)
{
textureRec->copyTexSubImage2D(state,_viewport->x(),_viewport->y(), _viewport->x(),_viewport->y(),_viewport->width(),_viewport->height());
textureRec->copyTexSubImage2D(state,
static_cast<int>(_viewport->x()),
static_cast<int>(_viewport->y()),
static_cast<int>(_viewport->x()),
static_cast<int>(_viewport->y()),
static_cast<int>(_viewport->width()),
static_cast<int>(_viewport->height()));
}
else if ((texture1D = dynamic_cast<osg::Texture1D*>(_texture.get())) != 0)
{
// need to implement
texture1D->copyTexSubImage1D(state,_viewport->x(), _viewport->x(),_viewport->y(),_viewport->width());
texture1D->copyTexSubImage1D(state,
static_cast<int>(_viewport->x()),
static_cast<int>(_viewport->x()),
static_cast<int>(_viewport->y()),
static_cast<int>(_viewport->width()));
}
else if ((texture3D = dynamic_cast<osg::Texture3D*>(_texture.get())) != 0)
{
// need to implement
texture3D->copyTexSubImage3D(state, _viewport->x(), _viewport->y(), _face, _viewport->x(), _viewport->y(), _viewport->width(), _viewport->height());
texture3D->copyTexSubImage3D(state,
static_cast<int>(_viewport->x()),
static_cast<int>(_viewport->y()),
_face,
static_cast<int>(_viewport->x()),
static_cast<int>(_viewport->y()),
static_cast<int>(_viewport->width()),
static_cast<int>(_viewport->height()));
}
else if ((textureCubeMap = dynamic_cast<osg::TextureCubeMap*>(_texture.get())) != 0)
{
// need to implement
textureCubeMap->copyTexSubImageCubeMap(state, _face, _viewport->x(), _viewport->y(), _viewport->x(),_viewport->y(),_viewport->width(),_viewport->height());
textureCubeMap->copyTexSubImageCubeMap(state, _face,
static_cast<int>(_viewport->x()),
static_cast<int>(_viewport->y()),
static_cast<int>(_viewport->x()),
static_cast<int>(_viewport->y()),
static_cast<int>(_viewport->width()),
static_cast<int>(_viewport->height()));
}
#else
// use CopySubImage with the offset set to 0,0
// original code path.
if ((texture2D = dynamic_cast<osg::Texture2D*>(_texture.get())) != 0)
{
texture2D->copyTexImage2D(state,_viewport->x(),_viewport->y(),_viewport->width(),_viewport->height());
}
else if ((textureRec = dynamic_cast<osg::TextureRectangle*>(_texture.get())) != 0)
{
textureRec->copyTexImage2D(state,_viewport->x(),_viewport->y(),_viewport->width(),_viewport->height());
}
else if ((texture1D = dynamic_cast<osg::Texture1D*>(_texture.get())) != 0)
{
// need to implement
texture1D->copyTexImage1D(state,_viewport->x(),_viewport->y(),_viewport->width());
}
else if ((texture3D = dynamic_cast<osg::Texture3D*>(_texture.get())) != 0)
{
// need to implement
texture3D->copyTexSubImage3D(state, 0, 0, _face, _viewport->x(), _viewport->y(), _viewport->width(), _viewport->height());
}
else if ((textureCubeMap = dynamic_cast<osg::TextureCubeMap*>(_texture.get())) != 0)
{
// need to implement
textureCubeMap->copyTexSubImageCubeMap(state, _face, 0, 0, _viewport->x(),_viewport->y(),_viewport->width(),_viewport->height());
}
#endif
}
void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, bool& doCopyTexture)
@@ -753,9 +754,11 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b
if (dataType==0) dataType = _imageReadPixelDataType;
if (dataType==0) dataType = GL_UNSIGNED_BYTE;
itr->second._image->readPixels(_viewport->x(), _viewport->y(),
_viewport->width(), _viewport->height(),
pixelFormat, dataType);
itr->second._image->readPixels(static_cast<int>(_viewport->x()),
static_cast<int>(_viewport->y()),
static_cast<int>(_viewport->width()),
static_cast<int>(_viewport->height()),
pixelFormat, dataType);
}
}
@@ -922,7 +925,10 @@ void RenderStage::drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& pr
#define USE_SISSOR_TEST
#ifdef USE_SISSOR_TEST
glScissor( _viewport->x(), _viewport->y(), _viewport->width(), _viewport->height() );
glScissor( static_cast<int>(_viewport->x()),
static_cast<int>(_viewport->y()),
static_cast<int>(_viewport->width()),
static_cast<int>(_viewport->height()) );
//cout << " clearing "<<this<< " "<<_viewport->x()<<","<< _viewport->y()<<","<< _viewport->width()<<","<< _viewport->height()<<std::endl;
glEnable( GL_SCISSOR_TEST );

View File

@@ -969,11 +969,11 @@ void SceneView::draw()
_renderStageLeft->drawPreRenderStages(_renderInfo,previous);
_renderStageRight->drawPreRenderStages(_renderInfo,previous);
int separation = _displaySettings->getSplitStereoHorizontalSeparation();
double separation = _displaySettings->getSplitStereoHorizontalSeparation();
int left_half_width = (getViewport()->width()-separation)/2;
int right_half_begin = (getViewport()->width()+separation)/2;
int right_half_width = getViewport()->width()-right_half_begin;
double left_half_width = (getViewport()->width()-separation)/2.0;
double right_half_begin = (getViewport()->width()+separation)/2.0;
double right_half_width = getViewport()->width()-right_half_begin;
osg::ref_ptr<osg::Viewport> viewportLeft = new osg::Viewport;
viewportLeft->setViewport(getViewport()->x(),getViewport()->y(),left_half_width,getViewport()->height());
@@ -981,8 +981,10 @@ void SceneView::draw()
osg::ref_ptr<osg::Viewport> viewportRight = new osg::Viewport;
viewportRight->setViewport(getViewport()->x()+right_half_begin,getViewport()->y(),right_half_width,getViewport()->height());
clearArea(getViewport()->x()+left_half_width,getViewport()->y(),separation,getViewport()->height(),_renderStageLeft->getClearColor());
clearArea(static_cast<int>(getViewport()->x()+left_half_width),
static_cast<int>(getViewport()->y()),
static_cast<int>(separation),
static_cast<int>(getViewport()->height()),_renderStageLeft->getClearColor());
if (_displaySettings->getSplitStereoHorizontalEyeMapping()==osg::DisplaySettings::LEFT_EYE_LEFT_VIEWPORT)
{
@@ -1035,11 +1037,11 @@ void SceneView::draw()
_renderStageLeft->drawPreRenderStages(_renderInfo,previous);
_renderStageRight->drawPreRenderStages(_renderInfo,previous);
int separation = _displaySettings->getSplitStereoVerticalSeparation();
double separation = _displaySettings->getSplitStereoVerticalSeparation();
int bottom_half_height = (getViewport()->height()-separation)/2;
int top_half_begin = (getViewport()->height()+separation)/2;
int top_half_height = getViewport()->height()-top_half_begin;
double bottom_half_height = (getViewport()->height()-separation)/2.0;
double top_half_begin = (getViewport()->height()+separation)/2.0;
double top_half_height = getViewport()->height()-top_half_begin;
osg::ref_ptr<osg::Viewport> viewportTop = new osg::Viewport;
viewportTop->setViewport(getViewport()->x(),getViewport()->y()+top_half_begin,getViewport()->width(),top_half_height);
@@ -1047,7 +1049,11 @@ void SceneView::draw()
osg::ref_ptr<osg::Viewport> viewportBottom = new osg::Viewport;
viewportBottom->setViewport(getViewport()->x(),getViewport()->y(),getViewport()->width(),bottom_half_height);
clearArea(getViewport()->x(),getViewport()->y()+bottom_half_height,getViewport()->width(),separation,_renderStageLeft->getClearColor());
clearArea(static_cast<int>(getViewport()->x()),
static_cast<int>(getViewport()->y()+bottom_half_height),
static_cast<int>(getViewport()->width()),
static_cast<int>(separation),
_renderStageLeft->getClearColor());
if (_displaySettings->getSplitStereoVerticalEyeMapping()==osg::DisplaySettings::LEFT_EYE_TOP_VIEWPORT)
{
@@ -1141,15 +1147,20 @@ void SceneView::draw()
glPolygonStipple(patternVertEven);
glEnable(GL_POLYGON_STIPPLE);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glRecti(getViewport()->x(), getViewport()->y(), getViewport()->width(), getViewport()->height());
glRecti(static_cast<GLint>(getViewport()->x()),
static_cast<GLint>(getViewport()->y()),
static_cast<GLint>(getViewport()->width()),
static_cast<GLint>(getViewport()->height()) );
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDisable(GL_POLYGON_STIPPLE);
glEnable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST);
_redrawInterlacedStereoStencilMask = false;
_interlacedStereoStencilWidth = getViewport()->width();
_interlacedStereoStencilHeight = getViewport()->height();
_interlacedStereoStencilWidth = static_cast<int>(getViewport()->width());
_interlacedStereoStencilHeight = static_cast<int>(getViewport()->height());
}
_renderStageLeft->setClearMask(_renderStageLeft->getClearMask() & ~(GL_STENCIL_BUFFER_BIT));
@@ -1206,15 +1217,20 @@ void SceneView::draw()
glPolygonStipple(patternHorzEven);
glEnable(GL_POLYGON_STIPPLE);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glRecti(getViewport()->x(), getViewport()->y(), getViewport()->width(), getViewport()->height());
glRecti(static_cast<GLint>(getViewport()->x()),
static_cast<GLint>(getViewport()->y()),
static_cast<GLint>(getViewport()->width()),
static_cast<GLint>(getViewport()->height()) );
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDisable(GL_POLYGON_STIPPLE);
glEnable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST);
_redrawInterlacedStereoStencilMask = false;
_interlacedStereoStencilWidth = getViewport()->width();
_interlacedStereoStencilHeight = getViewport()->height();
_interlacedStereoStencilWidth = static_cast<int>(getViewport()->width());
_interlacedStereoStencilHeight = static_cast<int>(getViewport()->height());
}
_renderStageLeft->setClearMask(_renderStageLeft->getClearMask() & ~(GL_STENCIL_BUFFER_BIT));