Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - sgraves66

Pages: [1]
1
Window / Re: wxWidgets/SFML fullscreen issue
« on: July 29, 2014, 11:55:24 pm »
It looks like this is normal opengl behavior and not configurable. Since I'm technically mixing Direct3D and OpenGL, full screen prevents the child VLC window from rendering. Interesting that it's limited to the primary display. Driver setting maybe? Not really a graphics guy.

Easy enough to work around by using a dedicated full screen video window or by offsetting 1pt.

Toggle full screen example for wxFrame:

void MainFrame::AppToggleFullScreen()
{
#ifdef _WIN32
    if (this->GetAppFullScreen())
    {
        SetWindowLong(this->GetHandle(), GWL_STYLE, this->GetNormalStyle());
        if (!(this->GetNormalStyle() & WS_MAXIMIZE))
        {
            this->SetSize(this->GetNormalRect());
        }
        this->SetAppFullScreen(false);
    }
    else
    {
        this->SetNormalRect(this->GetRect());
        this->SetNormalStyle(GetWindowLong(this->GetHandle(), GWL_STYLE));

        SetWindowLong(this->GetHandle(), GWL_STYLE, WS_POPUP | WS_VISIBLE);

        wxDisplay d(wxDisplay::GetFromWindow(this));
        wxRect monitorRect = d.GetGeometry();
        int x = monitorRect.x;
        int y = monitorRect.y - 1;
        int width = monitorRect.width;
        int height = monitorRect.height + 2;
        MoveWindow(this->GetHandle(), x, y, width, height, FALSE);

        this->SetAppFullScreen(true);
    }
#endif
}
 

2
Window / wxWidgets/SFML fullscreen issue
« on: July 29, 2014, 05:27:25 am »
I use wxWidgets as the main windowing toolkit and create a child frame to host SFML for portability.

I'm currently experimenting with using a child wxFrame over the SFML frame for hosting an embedded VLC video window. Everything works fine until I enter full screen mode on my primary monitor.

wxWidgets has a ShowFullScreen() method that can be used and I'm not setting SFML full screen while doing so. The application feels like it is entering an exclusive full screen mode and for some reason no video playback is displayed. Setting the main window to bordless and maximized causes the same behavior. This only occurs on the primary monitor in a triple monitor setup essentially when the child SFML frame and the owner frame equal the resolution/position of the primary monitor. I haven't tried this on a single monitor setup, so it may or may not occur.

I'm currently using SFML 2.1 and wxWidgets 3.0.0 compiled using gcc (x32-4.8.1-posix-sjlj-rev5) on Win32. I'm rather unfamiliar with SFML and am hoping that I'm overlooking something obvious. Any suggestions for overcoming this behavior? I've yet to try Linux but I do suspect this is Win32-specific.

Windows 7 x64
NVIDIA GeForce GTX 560 Ti - Driver v337.88

4
Graphics / Font rendering issue with rendering in separate thread
« on: June 24, 2013, 04:54:54 am »
The code is too lengthy to post as it encompasses an entire GUI framework, so, for brevity, I'll try to summarize. I essentially separate the event thread from the rendering thread. The application requires video playback, so this setup obviously prevents the rendering side from hanging in response to lengthy events.

Texture loading, sprite creation and positioning are handled within the event thread. A collection of sprites is created to be displayed by the rendering thread. To emulate browser-style behavior, sprites are added and removed based upon desired content. The event thread creates a new collection, unknown to the rendering thread, and upon completion is assigned to an active sprite collection known to the rendering thread. Only one synchronization context is needed, so I don't believe there is anything related to thread synchronization that I've overlooked.

Image rendering is always fine; however, font rendering using the Text class results in missing characters. This behavior is not permanent and seems to manifest itself, consistently, when the application is first displayed. I've attached a screenshot of the affect. The item displayed should be '10 Years'; however, the '0' is missing.

When executing everything from a single thread, the issue is no longer present. It's definitely a threading issue, but I'm unable to fix the problem.

This is a sample for creation of display text (event thread):
        protected Text CreateDisplay( )
        {
            Text displayText = null;

            string text = this.Item.Text;
            if (!string.IsNullOrEmpty(text))
            {
                displayText = new Text(text, font);
                displayText.CharacterSize = (uint)((this.Location.Height / 3.0f) * 2.0f);
                while ((displayText.CharacterSize > 1) && (displayText.GetLocalBounds( ).Width > (this.Location.Width - 40)))
                {
                    displayText.CharacterSize--;
                }
                displayText.Color = new global::SFML.Graphics.Color(255, 255, 255, 150);

                float xMid = this.Location.X + (this.Location.Width / 2.0f);
                float xMid2 = displayText.GetLocalBounds( ).Width / 2.0f;
                float yMid = this.Location.Y + (this.Location.Height / 2.0f);
                float yMid2 = displayText.CharacterSize / 1.5f;
                displayText.Position = new Vector2f(xMid - xMid2, yMid - yMid2);
            }

            return displayText;
        }
 

And this is an example of rendering (rendering thread):
        internal virtual void Paint( )
        {
            lock (this.PaintSynch)
            {
                if (this.IsLoaded)
                {
                    if (this.BackgroundSprite != null)
                    {
                        this.ParentWindow.InternalWindow.Draw(this.BackgroundSprite);
                    }

                    if ((this.CanActivate) && (this.ActiveSprite != null) && (this.ParentWindow.ActiveControl == this))
                    {
                        this.ParentWindow.InternalWindow.Draw(this.ActiveSprite);
                    }

                    if (this.IsMouseOver && (this.OverSprite != null))
                    {
                        this.ParentWindow.InternalWindow.Draw(this.OverSprite);
                    }

                    if (this.DisplayText != null)
                    {
                        this.ParentWindow.InternalWindow.Draw(this.DisplayText);
                    }
                }
            }
        }
 

5
Graphics / Re: Scaling to fit
« on: June 24, 2013, 04:24:51 am »
sprite.setScale(800. / 252., 600. / 128.);

Of course, replace these constants with the variables that hold the corresponding values in tour code ;)

Thanks. Yep, old age is getting the best of me  :'(

6
Graphics / Scaling to fit
« on: June 15, 2013, 07:48:48 am »
Given a viewport of 1920x1080, I need to scale a 252x128 png into an 800x600 sprite, ignoring the aspect ratio. I'm new to SFML and was unable to find a resize() method. My eyes may be getting tired, but this should be a simple task to figure out. Am I overlooking something?

Pages: [1]