-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weird If statement #19
Comments
Does the current version of the repository work for you? To answer your other questions: -In a way that stays compatible with GLSL 120, no. However, if you don't care about that, GLSL offers a textureSize function ( https://www.opengl.org/sdk/docs/man/html/textureSize.xhtml ). You can use that to find what the texture's size is, and based on that, you can determine if a texture is bound or not. |
Hello, Benny.
This may be connected to another problem I posted: BennyQBD/3DEngineCpp#22 |
One quirk of GLSL is if the GLSL compiler doesn't think a uniform affects the code, then it silently removes it. It's possible that one of those two uniforms, according to the GLSL compiler "doesn't affect the code," and that the removal has given them the same value in the final output. I suspect that this could be a driver bug, and if the code works on other computers, then it probably is. That's one of the reasons why I want to know if the current repository works for you. If it doesn't, then it almost certainly is a driver issue (or I've somehow royally screwed something up somewhere). If it does work for you, then it's more likely that you've either made a mistake in your GLSL code, or you've written your GLSL code in a way that's confusing the compiler like that. |
Hello Benny.
As in video #31 of Java Game Engine Development Tutorial I add line in the fragment shader inside the for loop over the point lights:
if(pointLights[i].base.intensity > 0)
But instead of FPS growth I get no point light drawn in the scene. After the whole day of experiments I've noticed:
I can't believe that if statement is not working and not to have this kind of optimization is also not a case. The same is observed in c++ version (Initial Commit). Any ideas?
And some more questions: don't we need to specify in/out/inout parameters for input parameters of the functions as in http://www.opengl.org/wiki/GLSL_:_common_mistakes
And second one: is there any better than:
if (textureColor != vec4(0, 0, 0, 0))
way to check inside the shader if some texture was bound? Because current one can cause artefacts if texture contains black pixels with alpha value equal zero.
Thanks.
The text was updated successfully, but these errors were encountered: