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

Author Topic: SFML Text rendering in a deferred context  (Read 2528 times)

0 Members and 1 Guest are viewing this topic.

KraHen

  • Newbie
  • *
  • Posts: 10
    • View Profile
SFML Text rendering in a deferred context
« on: August 06, 2013, 05:43:54 pm »
I have managed to implement a very simple deferred renderer by going through the interwebs, but it seems to kill my text rendering, which worked well in a forward rendering context. I don`t know what could be causing it, if anyone could give me any insight on this, I would really appreciate it. :) I`m pretty sure it has to do with one or more GL state, but I can`t seem to figure out which one.

It goes something like this . . .

And here`s how I try to draw my string :

glBindBuffer(GL_ARRAY_BUFFER, 0);
                glUseProgram(0);
                (*window).pushGLStates();
                (*window).resetGLStates();
                (*FPSText).setString("FPS : " + int2Str((int)FPS));
                (*window).draw(*FPSText);
                (*window).popGLStates();

Any ideas?

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: SFML Text rendering in a deferred context
« Reply #1 on: August 06, 2013, 05:50:49 pm »
you need a alpha blending state enabled.. should do the trick

KraHen

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: SFML Text rendering in a deferred context
« Reply #2 on: August 06, 2013, 06:18:38 pm »
Thanks for the quick reply! Unfortunately that doesn`t solve my problem, or I`m doing something wrong. :( It`s funny though how I can render stuff like shapes without any problem.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML Text rendering in a deferred context
« Reply #3 on: August 06, 2013, 06:18:45 pm »
Alpha blending, as well as everything that SFML needs, is set by SFML.

It's hard to say which state you forgot to disable, without seeing them ;)

Maybe a texture problem? Do you have an active texture unit > 0?
Laurent Gomila - SFML developer

KraHen

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: SFML Text rendering in a deferred context
« Reply #4 on: August 06, 2013, 06:31:53 pm »
A few, for my FBOs, although I thought that pushing/popping states or reseting them would mean that they aren`t interfering with this, and I`d like to keep them active. :) Although every other rendering (sprites, shapes, etc.) works, so I guess I`ll just integrate libRocket now. Thanks for the help. :)
« Last Edit: August 06, 2013, 06:47:32 pm by KraHen »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML Text rendering in a deferred context
« Reply #5 on: August 06, 2013, 07:01:29 pm »
Quote
I thought that pushing/popping states or reseting them would mean that they aren`t interfering with this
It's the other way round: SFML states can't interfere with your own states. I can't handle both ways.
Laurent Gomila - SFML developer

KraHen

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: SFML Text rendering in a deferred context
« Reply #6 on: August 06, 2013, 08:25:01 pm »
I guess I`m the classic RTFM case. :) Thanks for the clarification!

 

anything