Fixed warnings

This commit is contained in:
Robert Osfield
2014-01-24 15:40:18 +00:00
parent 91b7104a92
commit eb56080277
5 changed files with 29 additions and 22 deletions

View File

@@ -248,16 +248,20 @@ void GLWidget::resizeEvent( QResizeEvent* event )
{
const QSize& size = event->size();
_gw->resized( x(), y(), size.width()*_devicePixelRatio, size.height()*_devicePixelRatio );
_gw->getEventQueue()->windowResize( x(), y(), size.width()*_devicePixelRatio, size.height()*_devicePixelRatio );
int scaled_width = static_cast<int>(size.width()*_devicePixelRatio);
int scaled_height = static_cast<int>(size.height()*_devicePixelRatio);
_gw->resized( x(), y(), scaled_width, scaled_height);
_gw->getEventQueue()->windowResize( x(), y(), scaled_width, scaled_height );
_gw->requestRedraw();
}
void GLWidget::moveEvent( QMoveEvent* event )
{
const QPoint& pos = event->pos();
_gw->resized( pos.x(), pos.y(), width()*_devicePixelRatio, height()*_devicePixelRatio );
_gw->getEventQueue()->windowResize( pos.x(), pos.y(), width()*_devicePixelRatio, height()*_devicePixelRatio );
int scaled_width = static_cast<int>(width()*_devicePixelRatio);
int scaled_height = static_cast<int>(height()*_devicePixelRatio);
_gw->resized( pos.x(), pos.y(), scaled_width, scaled_height );
_gw->getEventQueue()->windowResize( pos.x(), pos.y(), scaled_width, scaled_height );
}
void GLWidget::glDraw()

View File

@@ -91,8 +91,8 @@ QGraphicsViewAdapter::QGraphicsViewAdapter(osg::Image* image, QWidget* widget):
_graphicsScene->setStickyFocus(true);
#endif
_width = _graphicsScene->width();
_height = _graphicsScene->height();
_width = static_cast<int>(_graphicsScene->width());
_height = static_cast<int>(_graphicsScene->height());
_qimages[0] = QImage(QSize(_width, _height), s_imageFormat);
_qimages[1] = QImage(QSize(_width, _height), s_imageFormat);

View File

@@ -973,7 +973,7 @@ void ViewDependentShadowMap::cull(osgUtil::CullVisitor& cv)
if (settings->getDebugDraw())
{
camera->getViewport()->x() = pos_x;
pos_x += camera->getViewport()->width() + 40;
pos_x += static_cast<unsigned int>(camera->getViewport()->width()) + 40;
}
// transform polytope in model coords into light spaces eye coords.

View File

@@ -101,8 +101,8 @@ VolumeScene::TileData* VolumeScene::tileVisited(osgUtil::CullVisitor* cv, osgVol
osg::Viewport* viewport = cv->getCurrentRenderStage()->getViewport();
if (viewport)
{
textureWidth = viewport->width();
textureHeight = viewport->height();
textureWidth = static_cast<int>(viewport->width());
textureHeight = static_cast<int>(viewport->height());
}
osg::ref_ptr<TileData>& tileData = viewData->_tiles[tile];
@@ -209,14 +209,14 @@ void VolumeScene::traverse(osg::NodeVisitor& nv)
{
OSG_NOTICE<<"Creating ViewData"<<std::endl;
unsigned textureWidth = 512;
unsigned textureHeight = 512;
int textureWidth = 512;
int textureHeight = 512;
osg::Viewport* viewport = cv->getCurrentRenderStage()->getViewport();
if (viewport)
{
textureWidth = viewport->width();
textureHeight = viewport->height();
textureWidth = static_cast<int>(viewport->width());
textureHeight = static_cast<int>(viewport->height());
}
// set up depth texture
@@ -364,15 +364,18 @@ void VolumeScene::traverse(osg::NodeVisitor& nv)
{
viewData->_viewportDimensionsUniform->set(osg::Vec4(viewport->x(), viewport->y(), viewport->width(),viewport->height()));
if (viewport->width() != viewData->_colorTexture->getTextureWidth() ||
viewport->height() != viewData->_colorTexture->getTextureHeight())
int textureWidth = static_cast<int>(viewport->width());
int textureHeight = static_cast<int>(viewport->height());
if (textureWidth != viewData->_colorTexture->getTextureWidth() ||
textureHeight != viewData->_colorTexture->getTextureHeight())
{
OSG_NOTICE<<"Need to change texture size to "<<viewport->width()<<", "<< viewport->height()<<std::endl;
viewData->_colorTexture->setTextureSize(viewport->width(), viewport->height());
OSG_NOTICE<<"Need to change texture size to "<<textureWidth<<", "<< textureHeight<<std::endl;
viewData->_colorTexture->setTextureSize(textureWidth, textureHeight);
viewData->_colorTexture->dirtyTextureObject();
viewData->_depthTexture->setTextureSize(viewport->width(), viewport->height());
viewData->_depthTexture->setTextureSize(textureWidth, textureHeight);
viewData->_depthTexture->dirtyTextureObject();
viewData->_rttCamera->setViewport(0, 0, viewport->width(), viewport->height());
viewData->_rttCamera->setViewport(0, 0, textureWidth, textureHeight);
if (viewData->_rttCamera->getRenderingCache())
{
viewData->_rttCamera->getRenderingCache()->releaseGLObjects(0);

View File

@@ -93,7 +93,7 @@ struct ModesAndNames
{
return false;
}
}
inline bool getNameForGLMode(const osg::StateAttribute::GLMode& mode, std::string& str) const
@@ -444,7 +444,7 @@ bool StateSet_readLocalData(Object& obj, Input& fr)
{
if (StateSet_matchModeStr(fr[1].getStr(),value))
{
StateAttribute::GLMode mode;
StateAttribute::GLMode mode=0;
if (s_ModesAndNames.getGLModeForName(fr[0].getStr(), mode))
{
if (s_ModesAndNames.isTextureMode(mode))
@@ -523,7 +523,7 @@ bool StateSet_readLocalData(Object& obj, Input& fr)
{
if (StateSet_matchModeStr(fr[1].getStr(),value))
{
StateAttribute::GLMode mode;
StateAttribute::GLMode mode=0;
if (s_ModesAndNames.getGLModeForName(fr[0].getStr(), mode))
{
stateset.setTextureMode(unit,mode,value);