Pages: 1
Author Topic: Graphics Systems Precision  (30,580 Views)
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Posted on: July 25, 2013, 03:47:07 AM
Ok guys, now that I got all the common headers in all systems merged together removing bout 3100 duplicate lines of code. We need to switch all the draw functions in Graphics Systems to take float where previously they took double.

draw_text(double x, double y, string str);
becomes...
draw_text(float x, float y, string str);

As OpenGL does not work in precision higher than float. Wherever you see like x or yscale they should also be switched. Width and height for images should remain as integer.
Offline (Unknown gender) TheExDeus

Developer
Joined: Apr 2008
Posts: 1,860
View profile
Reply #1 Posted on: July 25, 2013, 07:57:02 AM
Well they are cast anyway, so I doubt it will improve much (unless casting from double to float is extremely slow for some reason). Scaling could slightly gain from having be in double as it is not actually used in GL directly, but is used to calculate vertex positions. Of course when the positions are then used and cast to float then I guess most of the gain is lost. Anyway, I don't think it's that hard and you should do it, as it will be chaos if everyone tried to changed that. Unless you don't want to and then I guess I can do that.
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #2 Posted on: July 25, 2013, 10:53:53 AM
The improvement is that the cast is done by the user as needed. If the user has a float already, no cast is required.
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #3 Posted on: July 25, 2013, 05:39:51 PM
Harriy, I can do it, I am very good at the monotonous kind of work :P
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #4 Posted on: July 26, 2013, 06:52:15 PM
Finished, tested, and ready to be merged.
https://github.com/enigma-dev/enigma-dev/pull/267
Pages: 1