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

Author Topic: Text with OpenGL help?  (Read 1881 times)

0 Members and 2 Guests are viewing this topic.

Ahlywog

  • Newbie
  • *
  • Posts: 3
    • View Profile
Text with OpenGL help?
« on: December 22, 2012, 01:11:58 am »
Every example I can find of using text uses App.draw().  The tutorials say, for OpenGL, you open a window with sf::VideoMode() but sf::VideoMode() doesn't have a draw() option.  So how do you use text with OpenGL?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Text with OpenGL help?
« Reply #1 on: December 22, 2012, 01:31:46 am »
You either use SFML for text rendering or you use your own custom code for text rendering.

If you go the SFML way then you have to use window.draw(), that's just how SFML works. If you want to use your custom OpenGL code you're on your own. ;)

Note: You can also use a sf::RenderWindow with OpenGL.
Note2: SFML makes use of OpenGL.
« Last Edit: December 22, 2012, 01:37:38 am by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Ahlywog

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Text with OpenGL help?
« Reply #2 on: December 22, 2012, 03:34:26 am »
For anyone who comes after me with this question.  The following opens our appropriate window type.

sf::WindowSettings Settings;
        Settings.DepthBits                      = 24; // Request a 24 bits depth buffer
        Settings.StencilBits            = 8;  // Request a 8 bits stencil buffer
        Settings.AntialiasingLevel      = 2;  // Request 2 levels of antialiasing
        sf::RenderWindow Window(sf::VideoMode(ScreenWidth, ScreenHeight, 32), "SFML OpenGL Window!  BYAH!", sf::Style::Close | sf::Style::Fullscreen, Settings);
 

And when you use text you need to remember to use the following before your .Draw() commands.

Window.PreserveOpenGLStates(true);