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

Author Topic: Impossible to create rendertexture?...  (Read 3314 times)

0 Members and 1 Guest are viewing this topic.

zombiekiller222

  • Guest
Impossible to create rendertexture?...
« on: October 06, 2011, 01:30:33 pm »
Code: [Select]
using System;
using SFML.Window;
using SFML.Graphics;

namespace Utilities
{
public class Utilities
{
public static Sprite TextToSprite (Text text)
{
FloatRect textb=text.GetRect();
RenderTexture rtex = new RenderTexture((uint)textb.Width, (uint)textb.Height);
rtex.Draw (text);
return new Sprite(rtex.Texture);
}
}
}




Returns an error:

Failed to share the OpenGL context
Impossible to create render texture (failed to link the target texture to the fr
ame buffer)


The failed to create an Opengl texture is a seperate error, I would assume, which causes the second.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Impossible to create rendertexture?...
« Reply #1 on: October 06, 2011, 02:12:38 pm »
Can you show a complete and minimal source code that reproduces the problem?
Laurent Gomila - SFML developer

zombiekiller222

  • Guest
Impossible to create rendertexture?...
« Reply #2 on: October 06, 2011, 02:17:41 pm »
With the other peice of the code:

Code: [Select]
using System;
using SFML.Window;
using SFML.Graphics;
using SFML.Audio;
using Utilities;

namespace IsoGame
{
static class Program
{
private static uint width = 800;
private static uint height = 600;
static void Main ()
{
RenderWindow window = new RenderWindow(new VideoMode(width, height), "Retrogons");

while (true)
{
Render(window);
}

}

private static void Render (RenderWindow window)
{
window.Clear();
Text error = new Text("Play");
                        error.Position = new Vector2f(width/2, height/2);
Utilities.Utilities.TextToSprite(error);
window.Display();
}
}
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Impossible to create rendertexture?...
« Reply #3 on: October 06, 2011, 06:26:27 pm »
Works for me, except that the text position is out of the render-texture area ;)

But no error message, and with position at (0, 0) it works as expected.
Laurent Gomila - SFML developer

zombiekiller222

  • Guest
Impossible to create rendertexture?...
« Reply #4 on: October 07, 2011, 12:02:38 am »
Strange... What could the problem possibly be? Also, is my method of converting a text into a sprite bad? Btw, off topic, but why is image.Pixels 1 dimensional?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Impossible to create rendertexture?...
« Reply #5 on: October 07, 2011, 07:55:46 am »
Quote
What could the problem possibly be?

Your graphics drivers ;)

Quote
Also, is my method of converting a text into a sprite bad?

No. But I hope that you have a good reason for doing so :P

Quote
Btw, off topic, but why is image.Pixels 1 dimensional?

Because internally, the pixels are stored in a contiguous array in memory. Much easier to work with (at least from a C++ point of view).
Laurent Gomila - SFML developer

zombiekiller222

  • Guest
Impossible to create rendertexture?...
« Reply #6 on: October 07, 2011, 08:39:05 am »
I'm using an intel integrated graphics card, and I'm not sure which driver I should update? The chipset driver, or some other driver?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Impossible to create rendertexture?...
« Reply #7 on: October 07, 2011, 08:58:48 am »
Quote
I'm using an intel integrated graphics card

Oh... so a driver update may not be enough :lol:

Quote
I'm not sure which driver I should update? The chipset driver, or some other driver?

I don't know, I never worked with integrated graphics.
Laurent Gomila - SFML developer

 

anything