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

Author Topic: RenderTexture problems  (Read 802 times)

0 Members and 1 Guest are viewing this topic.

luiscubal

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
RenderTexture problems
« on: September 08, 2011, 08:59:51 pm »
I'm in a system with an Intel GMA without FBO.
RenderTextures seem to mostly work on my .NET game but I'm having two issues:

1. When I close the application, it crashes. This ONLY happens if I create at least one RenderTexture.
2. Occasionally, the screen stops rendering(so either freezes or goes all black). Sometimes resizing the window makes it go back to normal(and if that happens I can see that the texture was rendered correctly), but not always.

Here's my C# code for texture creation:
Code: [Select]

        public void GenerateCardTexture(GameContext info, CardType card)
        {
            RenderTexture t = new RenderTexture(256, 384);

            t.Clear(new Color(0, 0, 0, 0));

            //Some code to Render Stuff to texture

            t.Display();

            cardRendering[card] = new Texture(t.Texture);
            t.Dispose();
        }


The "new Texture(t.Texture)" is there because I'm unsure about what Dispose() actually disposes, so I played it safe. In fact, if I make it just "= t.Texture;" and remove the Dispose, I get exceptions later on sfSprite_SetTexture.

Note that if I comment the code that calls Draw(), but still create the texture, call Clear() and Display(), then these problems do not happen. So I'm guessing the problem really is in Draw() functions.
I'm not using shaders, since my card doesn't support those anyway.

Am I doing something wrong? If not, is there any workaround for this issue(aside from not using RenderTexture)?

 

anything