glSelectBuffer float value for depth

BlitzMax Forums/OpenGL Module/glSelectBuffer float value for depth

Chris C(Posted 2005) [#1]
in glSelectBuffer the buffer is an int ptr, where really, it should be a bank ptr so you can peekint the name and peekfloat the depth (is this a bug?)

I can't seem to cast a bank ptr to an int ptr
giving it an array of ints works but the depth comes back as a very large -tive value for near getting nearer zero as the distance increases

any ideas?


Chris C(Posted 2005) [#2]
turns out its suposed to be an int...

0-1 * 2^32-1

try as I might I cant convert this to a float 0-1...
help!


AntonyWells(Posted 2005) [#3]
to pass multiple values you can do this,

  local val:int[2]
  val[0]=32
  val[1]=16
  local cast:int ptr
  cast = int ptr(var ptr val[0])




Chris C(Posted 2005) [#4]
??
how would this help?


AntonyWells(Posted 2005) [#5]
Oh well, it was what you asked so I assumed it was what you wanted to know..:)

Your second post seems to be asking how to convert an int into a floating range of 0.1?

If so, this'll do it,

   Function IntToFloat:Float( IntVal:Int,MaxVal:Int )
        return float(maxVal)/float(intVal)
   end function


Max range being the highest value an int will reach.(This'll result in 1)

Sorry if I'm mis-understood again, i'm not all that good at maths...


Chris C(Posted 2005) [#6]
its not quite that simple have a look @ my bsp loader, you'll see what I mean...