GLSL Shader will not render color from uniform variable

前端 未结 2 1252
猫巷女王i
猫巷女王i 2021-01-14 07:52

I am currently building an app for Android, but have run into some problems with a shader that refuses to render.

Consider the following fragment shader:



        
相关标签:
2条回答
  • 2021-01-14 08:07

    color is uninitialized, and most likely the shader aborts.

    0 讨论(0)
  • 2021-01-14 08:21

    Ok, so I finally figured it out after a load of testing.
    In my code, I was using multiple shaders, but I had accidentally only got the mvpMatrix-uniform for one shader and was using that one for every shader, which funnily enough worked for all shaders I had before creating this one (it got id 0 for all the earlier shaders).
    However with this shader it seems that my new vec4 got id 0, which caused the code to wrongly assign my vector data to the mvp-matrix. getting new ids for each shader made the program work.

    0 讨论(0)
提交回复
热议问题