Hi JS,

I'm surprised that you are seeing this warning as for a 32bit build
the void* should be 32bits and GLsizeiptr should be 32bit.  When under
a 64bit build the GLsizeiptr should be 64bit.

Even if GLsizeiptr was 32bit and void* was 64bit one should still be
able to cast it safely, the compiler should promote it OK.  Only if we
were going from 64bit to 32bit would problems likely occur, but even
then in this context it's pretty unlikely that you'd be using VBO's
bigger than 4GB.

As for fixing the warning, your could try static_cast<> rather than a C cast.

Robert.

On Thu, Jan 7, 2010 at 8:07 PM, Jean-Sébastien Guay
<jean-sebastien.g...@cm-labs.com> wrote:
> Hi Robert,
>
> I've been getting this warning 7 times per compiled file for a little while:
>
> warning C4312: 'type cast' : conversion from 'GLsizeiptrARB' to 'const
> GLvoid *' of greater size
>
> It happens on lines like this:
>
> setVertexPointer(array->getDataSize(),array->getDataType(),0,(const GLvoid
> *)(vbo->getOffset(array->getBufferIndex())));
>
> The actual lines are in include/osg/state lines 578, 669, 759, 854, 921, 998
> and 1163.
>
> Now, from what I can see, GLvoid is gotten from gl.h (in the Platform SDK)
> and evaluates to void. GLsizeiptrARB is gotten from the
> include/osg/BufferObject header, and evaluates to int.
>
> First of all, it's trying to convert int to const void*, am I reading that
> correctly? vbo->getOffset() returns GLsizeiptrARB and it's trying to cast it
> to const GLvoid*. Is that OK?
>
> Is there a quick way to remove this warning? I imagine in other cases, it
> could be a sign of 64-bit porting problems, but I'm on a 32 bit platform, so
> I don't see why the compiler is warning me of this. For that matter, aren't
> both int and void* 32 bits on 32 bit platforms? (my knowledge in this is
> limited, and I guess they can't be or this warning wouldn't occur...)
>
> It would be nice to be able to remove this warning. Thanks,
>
> J-S
> --
> ______________________________________________________
> Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
>                               http://www.cm-labs.com/
>                        http://whitestar02.webhop.org/
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to