Hey, I'm writing some kind of little engine in OpenGL. Currently I'm adding post processing.
When I started doing it, I was like "meh it's easy". And then I went into this big problem ;_;
Whenever I pass a screen texture into shader, it becomes black!
Here's my shader code:
uniform sampler2D sceneTexture;
varying vec2 uv;
uniform float time;
However, if I uncomment the first line and comment the second one, everything works. I see correct texture coordinates. Here are main files where could be an error:
https://www.dropbox.com/s/dx5e0q6b7lidvup/Some%20of%20source.rar
It's 2nd day of hell ;_;
Ok... I spammed my source with GL.GetError and found like two InvalidOperations.
Some of my functions was unbinding the fbo, so then whatever I tried to do with it I was getting InvalidOperation.
There are no InvalidOperations right now, but the code is still not working...
Have you tested if the texture bound to sceneTexture is valid and contains proper data*? What do you see when you use the uncommented line? Do you see a yellow-greed-red gradient?
*note - based on its name it would seem sceneTexture is a procedural texture/FBO target. Make sure it doesn't contain mipmap data! AFAIR mipmaps need to be generated manually every time you update an FBO target for sampling to work properly, which makes it far easier to make any dynamic targets non-mipmapped in the first place (instead of GL_LINEAR_MIPMAP_LINEAR user GL_LINEAR when setting its properties).
Have you tested if the texture bound to sceneTexture is valid and contains proper data*? What do you see when you use the uncommented line? Do you see a yellow-greed-red gradient?
*note - based on its name it would seem sceneTexture is a procedural texture/FBO target. Make sure it doesn't contain mipmap data! AFAIR mipmaps need to be generated manually every time you update an FBO target for sampling to work properly, which makes it far easier to make any dynamic targets non-mipmapped in the first place (instead of GL_LINEAR_MIPMAP_LINEAR user GL_LINEAR when setting its properties).
Yes, yellow green red gradient. Black in the bottom left.
I tried binding texture loaded from disk and displaying, it works.