Results 1 to 5 of 5

Thread: float vs. double forms of OpenGL functions

  1. #1
    Member Contributor
    Join Date
    Feb 2000
    Posts
    89

    float vs. double forms of OpenGL functions

    Is there any speed hit associated with using the double version of the OpenGL functions, as compared to the float version? i.e. is glVertex3f better/faster to use than glVertex3d?

  2. #2
    Senior Member OpenGL Guru Humus's Avatar
    Join Date
    Mar 2000
    Location
    Stockholm, Sweden
    Posts
    2,342

    Re: float vs. double forms of OpenGL functions

    Well, double consumes twice the memory bandwidth and can't be used with SIMD extensions like 3dnow or sse since they only operate on singleprecision data.
    Double also take longer time to do calculations with, especially divisions and squareroots.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    282

    Re: float vs. double forms of OpenGL functions

    i have made some tests on G200 and TNT, and i found that the float versions are faster.

    on the NV10 i don't know.

    Dolo/\/\ightY
    Dolo/\/\ightY

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    France
    Posts
    880

    Re: float vs. double forms of OpenGL functions

    I have recently changed the way I used my compiled vertex arrays (i.e. changed from double to float) on my ELSA Erazor X2 (GeForce DDR).

    So the answer is : yes, it's much faster !

    Eric

  5. #5
    Senior Member Regular Contributor
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    183

    Re: float vs. double forms of OpenGL functions

    Hi there!

    I'm back again

    You should use floats there are ton's faster.

    Here are the reason:

    1. With floats the cpu can cache twice the amount of data in the 1st and 2sec level cache.
    2. the cpu only has to transmit only halfe of the data via the PCI/AGP port to the gfx card
    3. there is a MAJOR BUG in Win95/98 (at least I call it a BUG)! Win95/98 allocates memory only 4 byte aligned witch gives you a 3 clock penalty for each access (on intel machines, 1 clock on AMD) Check it out!!!

    By the way. Internally the Cpu works with double values by default. that means it internaly converts a float into a double, performs the operation and stores the result
    as a float (this behaviour can be changed via some cpu intructions, like DirectX does it to gain some extra speed).

    Oh, while we are at it (this is off topic I know) Intel cpu's are using the floatingpoint pipeline to perform INTEGER multiplications and divisions (AMD does not)

Similar Threads

  1. float or double?
    By Zohar in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-10-2005, 01:39 AM
  2. double -> float vs. gl*d
    By Boris008 in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 07-29-2005, 01:04 AM
  3. OpenGL game: float or double?
    By Rockfort in forum OpenGL: Advanced Coding
    Replies: 24
    Last Post: 11-11-2001, 10:20 PM
  4. float vs. double
    By jabe in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 04-20-2001, 01:29 AM
  5. Float vs. Double
    By SUMECTAVAE in forum OpenGL: Advanced Coding
    Replies: 13
    Last Post: 03-15-2001, 11:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean