Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flickering GUI elements in DirectScrolledFrame #681

Closed
fireclawthefox opened this issue Jul 2, 2019 · 5 comments

Comments

@fireclawthefox
Copy link
Contributor

commented Jul 2, 2019

DirectGui elements are sometimes not correctly or not at all rendered. This occurs especially often if there are many scrolled frames used.
Resizing the window or somehow else redrawing the UI will make the GUI elements flicker and sometimes reappear and render correctly.

@Moguri

This comment has been minimized.

Copy link
Collaborator

commented Jul 2, 2019

Do you have a sample demonstrating this problem? I imagine this could be difficult to reproduce without a demo/sample.

@fireclawthefox

This comment has been minimized.

Copy link
Contributor Author

commented Jul 2, 2019

A simple sample where this will happen at least after the window is resized would be this:

from direct.showbase.ShowBase import ShowBase
from direct.gui.DirectScrolledFrame import DirectScrolledFrame
from direct.gui.DirectLabel import DirectLabel
from random import random

app = ShowBase()

pos = [-0.85, -0.25, 0.25, 0.85]

for y in range(4):
    for x in range(4):
        r = random();g = random();b = random()
        frm=DirectScrolledFrame(
            frameColor=(r,g,b,1),
            frameSize=(-0.2,0.2,-0.2,0.2),
            canvasSize=(-1,1,-1,1),
            pos=(pos[x], 0, pos[y]))
        DirectLabel(
            pos=(-1,0,0.8),
            text='test',
            text_align=0,
            scale=0.1,
            parent=frm.getCanvas())

app.run()
@rdb

This comment has been minimized.

Copy link
Member

commented Jul 2, 2019

I've observed this issue as well. Thank you for providing sample code.

@ArsThaumaturgis

This comment has been minimized.

Copy link
Contributor

commented Jul 3, 2019

I've seen similar with, and suspect that it may be related to, the use of ScissorEffects in DirectGUI. (From what I've seen, it appears that DirectScrolledFrame uses a ScissorEffect to clip its contents.) See the following forum-post, with example-code:
https://discourse.panda3d.org/t/scissoreffect-flickering/24836/4

@Moguri Moguri added the bug label Jul 9, 2019

@rdb rdb changed the title Faulty DirectGui Rendering Flickering GUI elements in DirectScrolledFrame Jul 10, 2019

@rdb rdb self-assigned this Jul 10, 2019

@rdb rdb added this to the 1.10.4 milestone Jul 10, 2019

@rdb

This comment has been minimized.

Copy link
Member

commented Jul 10, 2019

@ArsThaumaturgis Thanks for pointing me in the right direction; it did indeed have something to do with scissoring. Turns out to be an easy bugfix, though it was not easy to find. I will check in a fix momentarily.

@rdb rdb closed this in 4bb3102 Jul 10, 2019

PointSource-xx added a commit to PointSource-xx/panda3d that referenced this issue Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.