3D OpenGL Engine

BlitzPlus Forums/BlitzPlus Programming/3D OpenGL Engine

I can convert any Blitz image to a GLTexture. FreeImage can load and save something like 30 image file formats. Or we could just stick to the BlitzPlus bitmap and JPEG loaders, and a TGA loader I wrote in BLitz code. Are there any other texture formats we should think about?

If you can think of a reason to use DLL's in place of Blitz code, let's hear it. What routines are better as DLL's? Is there any reason we should be looking at that instead?

How do DrawArrays work? I use GLLists, and they are pretty fast.

If you can replace all the Blitz bank commands with a DLL, I am interested in using those instead. The "*" in userlibs tells Blitz to pass the lib the bank pointer I was talking about. If you use a "%" instead, the 12-byte bank handle gets passed.

gluPerspective uses 64-bit floats. I use this all the time in CShop:

Function BLITZ_gluPerspective(fovy#,aspect#,zNear#,zFar#)
dblBank=CreateBank(8)
SngToDbl fovy,dblBank
fovy_l=PeekInt(dblBank,0)
fovy_r=PeekInt(dblBank,4)
SngToDbl aspect,dblBank
aspect_l=PeekInt(dblBank,0)
aspect_r=PeekInt(dblBank,4)
SngToDbl zNear,dblBank
zNear_l=PeekInt(dblBank,0)
zNear_r=PeekInt(dblBank,4)
SngToDbl zFar,dblBank
zFar_l=PeekInt(dblBank,0)
zFar_r=PeekInt(dblBank,4)
FreeBank dblBank
gluPerspective fovy_l,fovy_r,aspect_l,aspect_r,zNear_l,zNear_r,zFar_l,zFar_r
End Function

Function SngToDbl( x#, bank )
Local s, e, m, Lo, Hi, n
PokeFloat bank, 0, x
n=PeekInt( bank, 0 )  ; raw bits of x
s=n And %10000000000000000000000000000000  ; sign bit
e=n And %01111111100000000000000000000000  ; 8-bit exponent
e=(e Shr 3) + %00111000000000000000000000000000  ; 11-bit exponent
m=n And %00000000011111111111111111111111  ; 23-bit mantissa
Lo=m Shl 29  ; final three bits of mantissa
Hi=s Or e Or (m Shr 3 ) ; sign, exponent, first twenty bits of m
PokeInt bank,0,Lo
PokeInt bank,4,Hi
End Function