[Implemented] Double floats for 3.92

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

[Implemented] Double floats for 3.92

Post by Moonshine »

Firstly, I know this subject has been discussed many times before and everything, but my question is:

Is there ANY possibility that double floats will be included in the full release of v3.92?

Only I'm doing some work in OpenGL and am having to resort to wrappers (which only cover a handfull of the supported OGL functions, no extensions) and I'm coming to a standstill.

Ive already tried userlibs such as F64 but OpenGL doesnt accept it.

Cheers :)
Mark my words, when you least expect it, your uppance will come...
Codemonger
Enthusiast
Enthusiast
Posts: 384
Joined: Sat May 24, 2003 8:02 pm
Location: Canada
Contact:

Post by Codemonger »

Hi Moonshine,

Curious what parts of opengl do you need doubles for ? you can probably write the needed code in PB without doubles.
<br>"I deliver Justice, not Mercy"

    - Codemonger, 2004 A.D.
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post by Moonshine »

glClearDepth() for one, and also gluPerspective(). If the F64 userlib couldnt do it, then I doubt it could be emulated in code. It complained of invalid number of parameters or somesuch. Theres also a speed issue when not using native types.
Mark my words, when you least expect it, your uppance will come...
Progs
User
User
Posts: 21
Joined: Sun Sep 19, 2004 12:42 pm
Location: Russia/Moscow

Post by Progs »

Just download glWrapper and use
glClearDepth__()
a dunno why you need 64 bit for 1.0 :)
glClearDepth__( 1.0 )
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post by Moonshine »

Progs wrote:Just download glWrapper and use
glClearDepth__()
a dunno why you need 64 bit for 1.0 :)
glClearDepth__( 1.0 )
Thats the thing, I am already using glWrapper, but when it comes to using extensions that require doubles then Im screwed :?

I cant understand the need for doubles with glClearDepth, but it wont take a regular float so Im guessing thats why it was wrapped :lol:
Mark my words, when you least expect it, your uppance will come...
Progs
User
User
Posts: 21
Joined: Sun Sep 19, 2004 12:42 pm
Location: Russia/Moscow

Post by Progs »

Dunno...
Im making small 3d engine and have no problems...

here part of init function

Code: Select all

    glEnable_(#GL_DEPTH_TEST)
    glDepthFunc_(#GL_LESS) 
    glClearDepth__( 1.0 ) ;no problems here !    
    glBlendFunc_(#GL_SRC_ALPHA, #GL_ONE_MINUS_SRC_ALPHA)
And what extention whants double floats :?:
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

I think it has already been said that doubles will appear in 4.0 and not before..
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Regardless of why, double precision float native to PB is a very desirable thing.

Essential for some things.

I have several finance company's running (very old) apps and the precision is important, as is the total value. With PB handling doubles, the old dos code could be converted to PB.

(Sorry to hijack, just really keen for double precision)

PS: If PB has a 4-byte legacy bias that makes this difficult, I could live with doubles being handled same way as strings, eg, 4 byte pointer to the real value. As long as it looks and behaves like part of PB.
@}--`--,-- A rose by any other name ..
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Post by wilbert »

I don't know anything about OpenGL but taking a quick look at it, it seems that the glClearDepth_() and gluPerspective_() require a double float to be specified as two seperate values so you have to specify 2 values for glClearDepth and 8 for gluPerspective.

You could try if the code below will help you. Since I don't know how these functions should work, I don't know if they expect the parameters this way.

Code: Select all

Procedure.l dfHigh(value.f)
 ! fld dword [esp]
 ! push eax
 ! push eax
 ! fstp qword [esp]
 ! add esp,4
 ! pop eax
 ProcedureReturn
EndProcedure

Procedure.l dfLow(value.f)
 ! fld dword [esp]
 ! push eax
 ! push eax
 ! fstp qword [esp]
 ! pop eax
 ! add esp,4
 ProcedureReturn
EndProcedure

gluPerspective_(dfLow(fovy.f), dfHigh(fovy.f), dfLow(aspect.f), dfHigh(aspect.f), dfLow(zNear.f), dfHigh(zNear.f), dfLow(zFar.f), dfHigh(zFar.f))
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post by Moonshine »

Ive also just hit a point where a high resolution timer is required, yet there is no way to store the data with an equally high resolution of accuracy. Hmmm.
Mark my words, when you least expect it, your uppance will come...
User avatar
geoff
Enthusiast
Enthusiast
Posts: 128
Joined: Sun Apr 27, 2003 12:01 am
Location: Cornwall UK
Contact:

Post by geoff »

Karbon wrote:I think it has already been said that doubles will appear in 4.0 and not before..
Does anyone know when?
I've been holding my breath for a couple of years now.
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

All I've ever heard the developer(s) say is that it will happen when it happens.. I don't think they have set any kind of release date. I'd say you better be prepared to hold your breath for a while longer.
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Post Reply