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

Author Topic: Opengl + text  (Read 4846 times)

0 Members and 1 Guest are viewing this topic.

Srejv

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Opengl + text
« on: October 31, 2007, 12:20:47 am »
I was thinking of using SFML for help with text output when coding OpenGL programs,  but do I really have to initialize opengl at every frame if I want to use the sf::String and OpenGL? :S

I don't know how to explain my problem because it's just weird. Right now I'm initiating OpenGL and setting everything up outside the main loop inside "App.StartOpenGL()" and "App.EndOpenGL()" then I'm using the same for drawing geometry inside the main loop, but I don't get any output at all. :s

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Opengl + text
« Reply #1 on: October 31, 2007, 02:13:40 am »
Quote
I was thinking of using SFML for help with text output when coding OpenGL programs, but do I really have to initialize opengl at every frame if I want to use the sf::String and OpenGL?

Yes. I admit it's not an elegant way to integrate OpenGL stuff into a SFML rendering code ; I have to work more to improve it.

Quote
I don't know how to explain my problem because it's just weird. Right now I'm initiating OpenGL and setting everything up outside the main loop inside "App.StartOpenGL()" and "App.EndOpenGL()" then I'm using the same for drawing geometry inside the main loop, but I don't get any output at all. :s

It's often related to texture mapping. Try to reset your texture state before your OpenGL custom rendering.
Laurent Gomila - SFML developer

Srejv

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Opengl + text
« Reply #2 on: October 31, 2007, 02:29:09 am »
Quote from: "Laurent"
Quote
I don't know how to explain my problem because it's just weird. Right now I'm initiating OpenGL and setting everything up outside the main loop inside "App.StartOpenGL()" and "App.EndOpenGL()" then I'm using the same for drawing geometry inside the main loop, but I don't get any output at all. :s

It's often related to texture mapping. Try to reset your texture state before your OpenGL custom rendering.


But I'm not using any textures at all.  :(

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Opengl + text
« Reply #3 on: October 31, 2007, 03:58:22 am »
Quote
But I'm not using any textures at all

Yes but SFML uses it, so texture mapping is enabled ;)
You should disable it by calling gldisable(GL_TEXTURE_2D) before your OpenGL rendering.
Laurent Gomila - SFML developer

Srejv

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Opengl + text
« Reply #4 on: October 31, 2007, 11:32:03 am »
Quote from: "Laurent"
Quote
But I'm not using any textures at all

Yes but SFML uses it, so texture mapping is enabled ;)
You should disable it by calling gldisable(GL_TEXTURE_2D) before your OpenGL rendering.


Ahaa! Well that makes sense. Thanks! :)

TMKCodes

  • Newbie
  • *
  • Posts: 11
    • View Profile
Opengl + text
« Reply #5 on: June 11, 2010, 11:51:27 pm »
Sorry for bringing up such old topic, but has this had any improvements? I would so love having easy way of rendering text on OpenGL app with C.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Opengl + text
« Reply #6 on: June 12, 2010, 12:11:26 am »
Yes of course. Use RenderWindow::PreserveOpenGLStates(true) to be able to mix SFML and OpenGL in a window.

Have a look at the OpenGL sample from the SDK if you want a working example.
Laurent Gomila - SFML developer

TMKCodes

  • Newbie
  • *
  • Posts: 11
    • View Profile
Opengl + text
« Reply #7 on: June 13, 2010, 11:21:21 pm »
Nice. :)

 

anything