SFML community forums

General => General discussions => Topic started by: editali on January 12, 2014, 01:55:13 pm

Title: (OpenGL or SFML) doesn't render anythig
Post by: editali on January 12, 2014, 01:55:13 pm
Hi guys, I have 2 classes, first one is my ScreenHost and second one is ViewController.
ScreenHost creates a ViewController and adds some Graph objects to it, then it waits until DataArived event raised and it calls Render() method on ViewController.
The problem is ViewController doesn't show anything, it just shows a white screen while the Render() method runs properly! But when I call Render() right after constructor it draws my shapes.
Here's my code (summerized):

////////////////////////////////////////////
/////// ScreenHost.SetScreen()
////////////////////////////////////////////
        public void SetScreen()
        {
            vc = new ViewController(800,  600, Rows, Cols);
            ...
            // If i call  vc.Render() it works
        }


////////////////////////////////////////////
/////// ScreenHost.DataArived  event
////////////////////////////////////////////

        void DataArived ()
        {
            // it runs Render() but doesn't show anything except a white screen (Render clears screen with black color)
            vc.Render();
        }


////////////////////////////////////////////
/////// ScreenHost.DataArived  event
////////////////////////////////////////////

        public void Render()
        {
            // it clears screen with black color
            renderWindow.Clear(Color.Black);
        }
Title: Re: (OpenGL or SFML) doesn't render anythig
Post by: Nexus on January 12, 2014, 02:14:27 pm
Please read the forum rules (http://en.sfml-dev.org/forums/index.php?topic=5559.0), you're doing several things wrong: Wrong forum, unclear description, no minimal/complete example, lot of custom code unknown to us, no code tags.