picture.Renderer.Texture = intermediate.Texture; each frame does put the Texture into the Picture, but unfortunately it's upside down (not effected by calling Display() before this or not)
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: texus on 08 November 2017, 08:26:06
I think you will just have to call "picture.Renderer.Texture = intermediate;" every time you update the RenderTexture.
QuoteI didn't fully understand what you meant by this. Could you elaborate a bit on this, perhaps with some pseudocode of how you want it to work?
RenderTexture intermediate = new RenderTexture(width, height);
Sprite intermediateContext = new Sprite(intermediate.Texture);
RenderWindow window = new RenderWindow(new VideoMode(width, height), "Title");
while (true) {
intermediate.draw(someDrawableInstance);
window.draw(intermediateContext);
}
RenderWindow window = new RenderWindow(new VideoMode(400, 300), "TGUI.Net test");
Gui gui = new Gui(window);
Picture picture = new Picture("background.jpg");
gui.Add(picture);
// ... gui.Add various test elements ...
Vertex[] test = {
new Vertex(new Vector2f(), Color.White),
new Vertex(new Vector2f(400, 0), Color.Magenta),
new Vertex(new Vector2f(400, 75), Color.Cyan),
new Vertex(new Vector2f(0, 75), Color.Yellow)
};
while (window.IsOpen) {
window.DispatchEvents();
window.Clear();
window.Draw(test, PrimitiveType.Quads);
gui.Draw(); // crash, Exception Unhandled
window.Display();
}
System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
gui.Add(picture)
it works fine and all other tgui elements and my sfml primitives draw correctly....window.Draw(test, PrimitiveType.Quads);
it works as well
gui.Draw();
window.Draw(test, PrimitiveType.Quads);
class MyTestDrawable : Transformable, Drawable {
private Vertex[] _Vertices;
public MyTestDrawable() {
_Vertices = new Vertex[] {
new Vertex(new Vector2f(), Color.White),
new Vertex(new Vector2f(400, 0), Color.Magenta),
new Vertex(new Vector2f(400, 75), Color.Cyan),
new Vertex(new Vector2f(0, 75), Color.Yellow)
};
}
public void Draw(RenderTarget target, RenderStates states) {
states.Transform *= Transform;
target.Draw(_Vertices, PrimitiveType.Quads, states);
}
}
to no avail
window.Draw(spriteInstance);
window.Draw(test, PrimitiveType.Quads);
gui.Draw();