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

Author Topic: RenderTexture.Draw(Text) not Working  (Read 4402 times)

0 Members and 1 Guest are viewing this topic.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
RenderTexture.Draw(Text) not Working
« on: April 06, 2012, 04:02:18 pm »
So i downloaded the latest version and for once decided to take a look at the examples. Anyways I decided to try to render text onto a rendertexture. Anyways the code kept throwing the exception "Unable to read memory, this is often a sign other memory is corrupt...." on the line to draw text on the rendertexture.
RenderTexture targ = new RenderTexture(1000, 1000);
targ.Clear(Color.White);
targ.Draw(myText); //Here is the error
targ.Display();
So am I doing something wrong, or is this a bug?
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: RenderTexture.Draw(Text) not Working
« Reply #1 on: April 06, 2012, 04:59:59 pm »
Could you please provide a complete and minimal example that reproduces the problem?
Laurent Gomila - SFML developer

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: RenderTexture.Draw(Text) not Working
« Reply #2 on: April 06, 2012, 05:40:05 pm »
Could you please provide a complete and minimal example that reproduces the problem?
Using revision number is e7713ab
namespace RenderTextureTestProject
{
    class Program
    {

        static void Main(string[] args)
        {
            RenderTextureTest _testloop = new RenderTextureTest();
            _testloop.Load();
            _testloop.RenderLoop();
        }
    }
    class RenderTextureTest
    {
        SFML.Graphics.RenderWindow _renderwindow;
        SFML.Graphics.RenderTexture _rendertexture;
        SFML.Graphics.Text _mytext;
        public void Load()
        {
            _renderwindow = new SFML.Graphics.RenderWindow(new SFML.Window.VideoMode(500, 500), "RenderTexture Test");
            _rendertexture = new SFML.Graphics.RenderTexture(500, 500);
            _mytext = new SFML.Graphics.Text("A Simple Test...", SFML.Graphics.Font.DefaultFont, 42);
            _rendertexture.Clear(SFML.Graphics.Color.Black);
            _rendertexture.Draw(_mytext);
            _rendertexture.Display();
        }
        public void RenderLoop()
        {
            while (_renderwindow.IsOpen())
            {
                _renderwindow.Clear(SFML.Graphics.Color.Black);
                _renderwindow.Draw(new SFML.Graphics.Sprite(_rendertexture.Texture));
                _renderwindow.Display();
            }
        }
    }
}
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: RenderTexture.Draw(Text) not Working
« Reply #3 on: April 06, 2012, 05:55:16 pm »
It was a bug, it's fixed now.

Thanks for your feedback :)
Laurent Gomila - SFML developer

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: RenderTexture.Draw(Text) not Working
« Reply #4 on: April 06, 2012, 06:04:22 pm »
It was a bug, it's fixed now.

Thanks for your feedback :)
Awsome  ;D
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor