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

Author Topic: [solved] OpenGL calls in RenderTarget not working  (Read 1224 times)

0 Members and 1 Guest are viewing this topic.


  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
[solved] OpenGL calls in RenderTarget not working
« on: October 14, 2016, 08:19:28 pm »
Hey all.. again.

This is somewhat related to my last post (http://en.sfml-dev.org/forums/index.php?topic=20979.0) where I am trying to render lighting in OpenGL and have it work with SFML.

My LightEngine class has it's own RenderTexture which I'm using to contain all the state required for rendering the lights. Each frame the RenderTexture is activated, VAO is bound and for each light, uniforms are set and elements are drawn. At the end of that, the state is cleaned up and the render window (passed to the LightEngine render function) is set to draw a sprite containing the RenderTexture's Texture. Unfortunately this doesnt work. Instead, I'm presented with a black screen (since the sprite is rendered with multiply blending). If I dont use the RenderTexture it works fine.

(click to show/hide)

Desired effect: http://i.imgur.com/APbsUNE.png
Images can be downloaded here: https://www.dropbox.com/s/lvd8ztlecwvh4w2/lighting.zip?dl=1

Well I fixed it by setting:
glViewport(0, 0, 1024, 768)
In the constructor of LightEngine just after making m_oTex active.
Result: http://i.imgur.com/f3lY8KV.gifv
« Last Edit: October 14, 2016, 08:32:12 pm by Gambit »