DynamicGraphic scaling => flicker

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

DynamicGraphic scaling => flicker

#1 Post by vincele »

Hello, I'm trying to do something like suggested in Feature Request 126, i.e. scaling down uncolonized planet's panels.

Looks good for rotating planet, but I'm having problems with asteroid's DynamicGraphic scaling.

In UI/SidePanel.cpp:1026 :

Code: Select all

SidePanel::PlanetPanel::RefreshPlanetGraphic()
I change planet_image_pos.x and scale texture_width, which get me the right placement and size, but the resulting animation flickers a lot.

I tried changing m_planet_graphic->SetFPS(), it got slightly better by upping the FPS but cannot completely eliminate the flickering.

Any advice ?
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: DynamicGraphic scaling => flicker

#2 Post by Dilvish »

you can certainly have a bit of commiseration regarding our asteroid graphics, and a bit of advice that may or may not pan out as a helpful lead.

I recall that after one or two marginally related changes in the past the asteroid graphics on Linux had gotten thrown off, being either frozen or very jumpy (could easily be characterized as flickering). I'm a bit fuzzy now on the actual code change that triggered the problem, but I seem to recall the connection wasn't readily apparent. It turned out that that the change exposed an implementation difference between windows and linux (for some file handling software I think it was) that was causing the individual asteroid frames to get returned in a different order, which gave a bad result on Linux. That was fixed in r6163 by doing an additional sort on the filenames.

That's kind of a long-winded way of getting to the main point: could your dynamic resizing be throwing off the sorting of the frames?
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: DynamicGraphic scaling => flicker

#3 Post by vincele »

Dilvish wrote:you can certainly have a bit of commiseration regarding our asteroid graphics, and a bit of advice that may or may not pan out as a helpful lead.
In fact, yes, I'm pulling some of my hair...
Dilvish wrote:That's kind of a long-winded way of getting to the main point: could your dynamic resizing be throwing off the sorting of the frames?
I don't think so, but will try to look for that. First I have to get the scaling right, and that means pulling some GG-coordinate-system hairs...
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: DynamicGraphic scaling => flicker

#4 Post by Geoff the Medio »

In GetAsteroidTextures() the call to GetPrefixedTextures(...) specifies false for the mipmapping parameter. Might help to turn it on if you're planning to resize the textures when displaying.

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: DynamicGraphic scaling => flicker

#5 Post by vincele »

Geoff the Medio wrote:In GetAsteroidTextures() the call to GetPrefixedTextures(...) specifies false for the mipmapping parameter. Might help to turn it on if you're planning to resize the textures when displaying.
Thanks, I'll try that.

EDIT: tried, does not fix it...

That's what I'm doing (kind of) :

Code: Select all

        m_planet_graphic = new GG::DynamicGraphic(planet_image_pos.x, planet_image_pos.y,
                                                    texture_width / 2, texture_height, true,
                                                    texture_width / 2, texture_height, 0, textures,
                                                    GG::GRAPHIC_SHRINKFIT | GG::GRAPHIC_PROPSCALE);
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: DynamicGraphic scaling => flicker

#6 Post by vincele »

Ougl, removing GG::GRAPHIC_PROPSCALE does fix it, but now it looks ugly...

Maybe by scaling it proportionally myself with proper width & height...
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

Post Reply