[gameprogrammer] Re: weir cast problem in 64 bits system

  • From: Roger Durañona <luo_hei@xxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Tue, 22 Jul 2008 10:38:58 -0400

Madison McGaffin escribió:
On 7/22/08, *Roger Durañona* <luo_hei@xxxxxxxx <mailto:luo_hei@xxxxxxxx>> wrote:

    Im trying to use Cal3d in my project and I have found a weird
    problem. Cal3d API returns some values as void*, that should be
    casted to GLint like this:

    glBindTexture(GL_TEXTURE_2D, (GLint)pCalRenderer->getMapUserData(0));

    This works on some systems but in others the compiler produces an
    error: cast from void* to GLint loses precision. The only common
    thing I can find between the 2 setups where I get the error is
    that they are both 64 bits systems (Ubuntu and Gentoo).
    Can someboy suggest me a solution for this, or at least the cause
    of the problem?


What distinguishes a 64 bit system from a 32 bit system is that a 64 bit system can handle memory addresses identified by 64-bit data types instead of just 32-bit data types. So, on 32 bit systems, void* is a 32-bit-wide pointer to some place in memory but on 64 bit systems, a void* can be 64 bits wide. Most likely, GLint is fixed at 32 bits wide, and, most likely, you shouldn't need to worry about the loss of precision.

'course I don't know much about Cal3d specifically, and it seems really horrible that they expect you to cast from a void* to a GLint, but that's my 2c.
Thats what I read. But there must be some way to solve this problem, because Eternal Lands uses Cal3d and they have both a 32 and 64 bits version.


--
"La naturaleza y sus leyes yacían ocultas en la noche, Dios dijo , "Sea Newton" y todo fue luz", Alexander Pope "Pero esto no fue lo último. El diablo gritó "Sea Einstein", y se restableció la situación", John Collins Squire


                
______________________________________________ LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y móviles desde 1 céntimo por minuto. http://es.voice.yahoo.com


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: