Warning fixes

This commit is contained in:
Robert Osfield 2013-11-22 10:27:15 +00:00
parent 91033a3a1f
commit f02ed3c629
4 changed files with 19 additions and 21 deletions

View File

@ -908,10 +908,11 @@ static void halveImage_uint(GLint components, GLuint width, GLuint height,
for (j = 0; j < newwidth; j++) { for (j = 0; j < newwidth; j++) {
for (k = 0; k < components; k++) { for (k = 0; k < components; k++) {
/* need to cast to double to hold large unsigned ints */ /* need to cast to double to hold large unsigned ints */
s[0] = ((double)*(const GLuint*)t + GLdouble buf = (double)*(const GLuint*)t +
(double)*(const GLuint*)(t+group_size) + (double)*(const GLuint*)(t+group_size) +
(double)*(const GLuint*)(t+ysize) + (double)*(const GLuint*)(t+ysize) +
(double)*(const GLuint*)(t+ysize+group_size))/4 + 0.5; (double)*(const GLuint*)(t+ysize+group_size);
s[0] = (GLuint)(buf/4.0 + 0.5);
s++; t += element_size; s++; t += element_size;
} }
@ -925,12 +926,11 @@ static void halveImage_uint(GLint components, GLuint width, GLuint height,
for (j = 0; j < newwidth; j++) { for (j = 0; j < newwidth; j++) {
for (k = 0; k < components; k++) { for (k = 0; k < components; k++) {
/* need to cast to double to hold large unsigned ints */ /* need to cast to double to hold large unsigned ints */
GLdouble buf; GLdouble buf = (GLdouble)__GLU_SWAP_4_BYTES(t) +
buf = (GLdouble)__GLU_SWAP_4_BYTES(t) + (GLdouble)__GLU_SWAP_4_BYTES(t+group_size) +
(GLdouble)__GLU_SWAP_4_BYTES(t+group_size) + (GLdouble)__GLU_SWAP_4_BYTES(t+ysize) +
(GLdouble)__GLU_SWAP_4_BYTES(t+ysize) + (GLdouble)__GLU_SWAP_4_BYTES(t+ysize+group_size);
(GLdouble)__GLU_SWAP_4_BYTES(t+ysize+group_size); s[0] = (GLuint)(buf/4.0 + 0.5);
s[0] = (GLuint)(buf/4 + 0.5);
s++; t += element_size; s++; t += element_size;
} }

View File

@ -37,8 +37,6 @@ MultiTouchTrackballManipulator::MultiTouchTrackballManipulator( const MultiTouch
void MultiTouchTrackballManipulator::handleMultiTouchDrag(const GUIEventAdapter* now, const GUIEventAdapter* last, const double eventTimeDelta) void MultiTouchTrackballManipulator::handleMultiTouchDrag(const GUIEventAdapter* now, const GUIEventAdapter* last, const double eventTimeDelta)
{ {
const float zoom_threshold = 0.0001f;
osg::Vec2 pt_1_now(now->getTouchPointNormalizedX(0),now->getTouchPointNormalizedY(0)); osg::Vec2 pt_1_now(now->getTouchPointNormalizedX(0),now->getTouchPointNormalizedY(0));
osg::Vec2 pt_2_now(now->getTouchPointNormalizedX(1),now->getTouchPointNormalizedY(1)); osg::Vec2 pt_2_now(now->getTouchPointNormalizedX(1),now->getTouchPointNormalizedY(1));
osg::Vec2 pt_1_last(last->getTouchPointNormalizedX(0),last->getTouchPointNormalizedY(0)); osg::Vec2 pt_1_last(last->getTouchPointNormalizedX(0),last->getTouchPointNormalizedY(0));
@ -51,7 +49,7 @@ void MultiTouchTrackballManipulator::handleMultiTouchDrag(const GUIEventAdapter*
// osg::notify(osg::ALWAYS) << gap_now << " " << gap_last << std::endl; // osg::notify(osg::ALWAYS) << gap_now << " " << gap_last << std::endl;
// zoom gesture // zoom gesture
if (fabs(gap_last - gap_now) > 0.02) if (fabs(gap_last - gap_now) > 0.02)
zoomModel( (gap_last - gap_now) , true ); zoomModel( (gap_last - gap_now) , true );

View File

@ -401,14 +401,14 @@ void DebugShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv )
{ {
// view can be a slave that covers only a fraction of the screen // view can be a slave that covers only a fraction of the screen
// so adjust debug hud location to proper viewport location // so adjust debug hud location to proper viewport location
_viewportOrigin[0] += vp->x(); _viewportOrigin[0] += static_cast<unsigned short>(vp->x());
_viewportOrigin[1] += vp->y(); _viewportOrigin[1] += static_cast<unsigned short>(vp->y());
if( _viewportSize[0] > vp->width() - _viewportOrigin[0] ) if( _viewportSize[0] > (static_cast<unsigned short>(vp->width()) - _viewportOrigin[0]) )
_viewportSize[0] = vp->width() - _viewportOrigin[0]; _viewportSize[0] = static_cast<unsigned short>(vp->width()) - _viewportOrigin[0];
if( _viewportSize[1] > vp->height() - _viewportOrigin[1] ) if( _viewportSize[1] > (static_cast<unsigned short>(vp->height()) - _viewportOrigin[1]) )
_viewportSize[1] = vp->height() - _viewportOrigin[1]; _viewportSize[1] = static_cast<unsigned short>(vp->height()) - _viewportOrigin[1];
} }
_orthoSize = st->_orthoSize; _orthoSize = st->_orthoSize;

View File

@ -712,14 +712,14 @@ InteractiveImageHandler::InteractiveImageHandler(osg::Image* image, osg::Texture
double width = _camera->getViewport()->width(); double width = _camera->getViewport()->width();
double height = _camera->getViewport()->height(); double height = _camera->getViewport()->height();
resize(width, height); resize(static_cast<int>(width), static_cast<int>(height));
} }
} }
bool InteractiveImageHandler::mousePosition(osgViewer::View* view, osg::NodeVisitor* nv, const osgGA::GUIEventAdapter& ea, int& x, int &y) const bool InteractiveImageHandler::mousePosition(osgViewer::View* view, osg::NodeVisitor* nv, const osgGA::GUIEventAdapter& ea, int& x, int &y) const
{ {
if (!view) return false; if (!view) return false;
osgUtil::LineSegmentIntersector::Intersections intersections; osgUtil::LineSegmentIntersector::Intersections intersections;
bool foundIntersection = (nv==0) ? view->computeIntersections(ea, intersections) : bool foundIntersection = (nv==0) ? view->computeIntersections(ea, intersections) :
view->computeIntersections(ea, nv->getNodePath(), intersections); view->computeIntersections(ea, nv->getNodePath(), intersections);