[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Advantages of Lua using 'floats' over Lua using 'doubles'
- From: "Robert Osfield" <robert.osfield@...>
- Date: Tue, 4 Jul 2006 16:22:32 +0100
On 7/4/06, Jose Marin <firstname.lastname@example.org> wrote:
I will use heavilly Lua interfacing with graphics
libraries (Direct3D/OpenGL), and the double/float
conversions could impact on performance, right:
By the way, are you guys using Lua as float or double?
I'm using Lua in its default form of Lua so it'll be doubles.
All the graphics is done in the scene graph which is a mixture of
doubles and floats, doubles are used for matrices internal to the C++
scene graph, and float used for all vertex data, the later has to be
floats to enable the data to be passed as vertex arrays.
The Lua integration is at a high level such as loading and configuring
the scene graph, handling events, dispatching the frame, for this work
doubles work just fine. All the floats are stored within the scene
graph so the few times that I expose settings of these values there
will conversion to and from floats. However, these types of setting
tend to get done all at start up or as a couple of ops per frame so is
of little concern performance wise.
The heavy duty compute work in the app is all done in C++, in
particular culling of the scene graph each frame, and then the draw
dispatch to OpenGL.
Personally I'd just go with Lua in its default form, and if it turns
out later you need to do things in float just need to rebuild lua.