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

Author Topic: SFML.Net 2.0 RC RenderWindow crash  (Read 1766 times)

0 Members and 1 Guest are viewing this topic.

obi-wan shinobi

  • Newbie
  • *
  • Posts: 4
    • View Profile
SFML.Net 2.0 RC RenderWindow crash
« on: July 30, 2012, 02:39:38 am »
Setting up and using a RenderWindow works okay, but when the app closes, I get a error message.  In VS2010, while debugging, "Failed to share OpenGL context" flashes on the output window before it goes away.  Otherwise, I'll see that "Fault Module Name:   atioglxx.dll" shows up in the crash information window.  This problem doesn't occur when using a regular Window, just with a RenderWindow, and so far only in the SFML.Net 2.0 Release Candidate.  My video card is a Radeon HD5770 with the latest (version 12.6) drivers.

Here's the code I'm using so far:
using System;
using SFML;
using SFML.Graphics;
using SFML.Window;

public class Cmain
{
    static RenderWindow wnd;
    static bool running;
    static RectangleShape shp;
    static Text s2d;

    static void Main()
    {
        wnd = new RenderWindow(new VideoMode(800, 600),
            "Testing Window", Styles.Default);
       

        wnd.Closed += new EventHandler(wnd_Closed);
        //wnd.KeyPressed += new EventHandler<KeyEventArgs>(wnd_KeyPressed);
        wnd.SetVerticalSyncEnabled(true);
        int frames = 0;
        int time = Environment.TickCount;
        s2d = new Text();
        running = true;
        while (wnd.IsOpen())
        {
            wnd.DispatchEvents();
            wnd.Clear(Color.Black);
           
            shp = new RectangleShape(new Vector2f(320, 240));
            shp.Position = new Vector2f(100, 100);
            shp.FillColor = Color.Magenta;
            for(int a = 0; a < 300; a++)
                wnd.Draw(shp);
            s2d.DisplayedString = "Testing";
            s2d.Position = new Vector2f(200, 200);
            s2d.Color = Color.Cyan;
            wnd.Draw(s2d);
            wnd.Display();
            frames++;
        }
        Console.WriteLine("Frames rendered: {0}, time: {1}", frames, Environment.TickCount - time);
    }

    /*static void wnd_KeyPressed(object sender, KeyEventArgs e)
    {
        Window tmp = (Window)sender;
        if (e.Code == Keyboard.Key.Escape)
            tmp.Close();
    }*/


    static void wnd_Closed(object sender, EventArgs e)
    {
        //Window tmp = (Window)sender;
        //tmp.Close();
        wnd.Close();
        //wnd.Dispose();
    }
}

By the way, will SFML.Net be supported on Mac or Linux in a future release?
« Last Edit: July 30, 2012, 08:18:43 am by Laurent »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML.Net 2.0 RC RenderWindow crash
« Reply #1 on: July 30, 2012, 08:20:07 am »
Does it go away if you don't use the Text class?

Quote
By the way, will SFML.Net be supported on Mac or Linux in a future release?
It's already supported. You just have to build it yourself.
Laurent Gomila - SFML developer

obi-wan shinobi

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: SFML.Net 2.0 RC RenderWindow crash
« Reply #2 on: July 31, 2012, 04:27:13 am »
It does go away when I comment out all the text class stuff.  The problem seems to be with doing anything more than declaring the variable and using the default Text() constructor, as leaving those lines in are okay.  Setting any properties or attempting to draw the Text object causes the crash somehow.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML.Net 2.0 RC RenderWindow crash
« Reply #3 on: July 31, 2012, 08:06:43 am »
Laurent Gomila - SFML developer