Pages: 1
  Print  
Author Topic: Graphics Systems Precision  (Read 17819 times)
Offline (Male) Goombert
Posted on: July 24, 2013, 10:47:07 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2991

View Profile
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.

Code: [Select]
draw_text(double x, double y, string str);becomes...
Code: [Select]
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.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #1 Posted on: July 25, 2013, 02:57:02 am

Developer
Joined: Apr 2008
Posts: 1860

View Profile
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.
Logged
Offline (Male) Josh @ Dreamland
Reply #2 Posted on: July 25, 2013, 05:53:53 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
The improvement is that the cast is done by the user as needed. If the user has a float already, no cast is required.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) Goombert
Reply #3 Posted on: July 25, 2013, 12:39:51 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2991

View Profile
Harriy, I can do it, I am very good at the monotonous kind of work :P
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Male) Goombert
Reply #4 Posted on: July 26, 2013, 01:52:15 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2991

View Profile
Finished, tested, and ready to be merged.
https://github.com/enigma-dev/enigma-dev/pull/267
« Last Edit: July 26, 2013, 01:59:25 pm by Robert B Colton » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Pages: 1
  Print