|
|
16 bit floating points
Is there any easy way to use 16 bit floating points in C++ instead of
the standard 32 bit? I want to conserve memory on an OpenGL model.
|
|
0
|
|
|
|
Reply
|
bob
|
9/13/2004 6:29:11 PM |
|
bob wrote:
> Is there any easy way to use 16 bit floating points in C++
> instead of
> the standard 32 bit? I want to conserve memory on an OpenGL
> model.
No. The FPUis working with 32 Bit and not capable of calculating
with 16 Bit. Also you will get a lot of problems with geometric
operations and transformations.
Take a good advice:
32 Bit are the least you want to use when representing 3D data.
Each more bit gives you double precision. So with 32 bit your
data will be 2^16 times precise as with 16 bit data. It is
really not worth to save the half of the memory sacryfying
precision.
Also remember that CPUs expect data to be aligned, especially
when seniding it to HW. Alignment on 32 bit CPUs is 4 bytes i.e.
32 bit.
Wolfgang
|
|
0
|
|
|
|
Reply
|
Wolfgang
|
9/13/2004 9:36:28 PM
|
|
I don't need precision. I just have a ninja model with thousands of
frames of vertex animation data. I need a way of loading it into
memory without using too much. I was thinking of storing the coords
as 16 bit and converting them for the glVertex functions. Any other
ideas for saving memory?
Wolfgang Draxinger <wdraxinger@darkstargames.de> wrote in message news:<ci53st$ctg$2@svr7.m-online.net>...
> bob wrote:
>
> > Is there any easy way to use 16 bit floating points in C++
> > instead of
> > the standard 32 bit? I want to conserve memory on an OpenGL
> > model.
>
> No. The FPUis working with 32 Bit and not capable of calculating
> with 16 Bit. Also you will get a lot of problems with geometric
> operations and transformations.
>
> Take a good advice:
> 32 Bit are the least you want to use when representing 3D data.
> Each more bit gives you double precision. So with 32 bit your
> data will be 2^16 times precise as with 16 bit data. It is
> really not worth to save the half of the memory sacryfying
> precision.
>
> Also remember that CPUs expect data to be aligned, especially
> when seniding it to HW. Alignment on 32 bit CPUs is 4 bytes i.e.
> 32 bit.
>
> Wolfgang
|
|
0
|
|
|
|
Reply
|
bob
|
9/16/2004 7:59:32 PM
|
|
bob schrieb:
> I don't need precision. I just have a ninja model with thousands of
> frames of vertex animation data. I need a way of loading it into
> memory without using too much. I was thinking of storing the coords
> as 16 bit and converting them for the glVertex functions. Any other
> ideas for saving memory?
>
Use 16 bit integers. x86 has no problems dealing with those (unlike 16
bit floats) and glVertex3s will happily accept them so you don'T have to
use some 16 bit float extensions.
Keep in mind that GLfloat is the native format for most OpenGL
implementations though and using anything else will probably reduce
performance.
Philipp
|
|
0
|
|
|
|
Reply
|
Philipp
|
9/17/2004 8:03:36 AM
|
|
bob schrieb:
>
> I don't need precision. I just have a ninja model with thousands of
> frames of vertex animation data. I need a way of loading it into
> memory without using too much. I was thinking of storing the coords
> as 16 bit and converting them for the glVertex functions.
>
That would work. You can probably expand/interpolate
them very fast with SSE instructions.
> Any other ideas for saving memory?
Whatever happens, you'll be doing it on the main CPU
instead of the graphics card (but don't be too depressed,
a Pentium is "hardware" as well...and it's clocked much
faster then your graphics card is).
--
<\___/>
/ O O \
\_____/ FTB. For email, remove my socks.
Governments, like diapers, should be changed often,
and for the same reason.
|
|
0
|
|
|
|
Reply
|
fungus
|
9/17/2004 8:47:25 AM
|
|
|
4 Replies
274 Views
(page loaded in 0.087 seconds)
|
|
|
|
|
|
|
|
|