1280/1024=1?

Blitz3D Forums/Blitz3D Programming/1280/1024=1?

Osoko(Posted 2006) [#1]
I there, just this few lines, i don't understand why the result is 1 ! I'm on 1.96 version

Graphics3D 640,480,16,0
SetBuffer BackBuffer()
camera=CreateCamera()
While Not KeyDown( 1 )
RenderWorld
ScreenRatio# = 1280/1024
Text 0,0,ScreenRatio#
Flip
Wend
End


Yan(Posted 2006) [#2]
ScreenRatio# = 1280/1024.0



taxlerendiosk(Posted 2006) [#3]
1280 and 1024 are being interpreted as integers and so integer division is used. You have to tell Blitz that one or both of the values are floating-point, before it will use floating-point division. To do this you need to put ".0" on the end of the number (as Fred shows).


Osoko(Posted 2006) [#4]
OK but the purpose was to determine the screenratio,
so screenratio# = GraphicsWidth() / GraphicsHeight()
which still give 1, instead of 1280/1024 = 1.25.
I just want to know if the screen is 4/3 ratio or 16/9, to accord the camera FOV.
Thank's


semar(Posted 2006) [#5]
screenratio# = float(GraphicsWidth()) / float(GraphicsHeight())



Yan(Posted 2006) [#6]
Also, please try to post stuff like this in the programming forums first. Post in the bug reports section *only* when it's confirmed as being a bug.

If BRL has less noise to sieve through we're more likely to get a response to genuine bug reports...Thanks :o)


big10p(Posted 2006) [#7]
What Fred said.


Osoko(Posted 2006) [#8]
Yes i will.