SFML community forums

Help => General => Topic started by: alienGhost on November 20, 2011, 07:30:34 am

Title: Text Output in OpenGL ?
Post by: alienGhost on November 20, 2011, 07:30:34 am
Hi,

I'm using SFML as a GLUT replacement for OpenGL/GLSL.

I have an sf::Window for my output and would like to use SFML to output text. It doesn't seem possible, or am I missing something?

I notice in the sf::Text object has a virtual method called Render. I've not looked very deep, but would it be possible to derive a class from sf::Text and implement drawing to an sf::Window?

SFML really needs to support sf::Window output if possible. It's a killer-app for people wanting to ditch stuff like GLUT and freeGLUT.
Title: Text Output in OpenGL ?
Post by: Nexus on November 20, 2011, 11:24:38 am
You have to use sf::RenderWindow to draw SFML graphics. sf::Window is only for event handling and direct OpenGL rendering.
Title: Text Output in OpenGL ?
Post by: alienGhost on November 20, 2011, 11:29:33 pm
hey, that's the problem. i am using OpenGL directly for drawing and shaders (not SFML). but I would still like to use sfml's font facilities, somehow.

i thought maybe overloading sf::Text's Render method. not sure.

EDIT: oh, im using SFML 2 - just incase
Title: Text Output in OpenGL ?
Post by: Laurent on November 21, 2011, 07:54:32 am
What's the problem with sf::RenderWindow? You can still use OpenGL to draw, but as a bonus you'll be able to draw sf::Text as well.
Title: Text Output in OpenGL ?
Post by: alienGhost on November 21, 2011, 05:57:16 pm
thanks Laurent. for some reason I believed that you could only use a RenderWindow with SFML draw commands. I will try switching my display setup to use it.