嘿,我目前在使用glBlendFunc
为bleding不同势着色器,但OpenGL的一个系统,我想这样做获取当前片段颜色
fragColor = currentColor * lightAmount;
我试图用gl_Color
但其depricated和我的引擎不让我使用它。
嘿,我目前在使用glBlendFunc
为bleding不同势着色器,但OpenGL的一个系统,我想这样做获取当前片段颜色
fragColor = currentColor * lightAmount;
我试图用gl_Color
但其depricated和我的引擎不让我使用它。
根据this document,片段着色器中没有片段颜色的内置访问。 你可以做的是渲染你的先前的通行证在另一个纹理,发送这些纹理到GPU(作为制服),并在你的最后一遍进行混合。
不,我需要分配给fragColor,因为我使用GLSL 330,如果我只是将fragColor分配给lightingamount,我场景中的所有东西都变成白色 – Swiftprog
你不能。 OpenGL ES的扩展允许在某些平台上使用。请参阅以前的类似问题:http://stackoverflow.com/questions/16531185/reading-current-framebuffer。或者,即使它处理深度值,基本上是相同的:http://stackoverflow.com/questions/23362076/opengl-how-to-access-depth-buffer-values-or-gl-fragcoord-z- VS-渲染-d。 –
究竟是什么'currentColor'和'lightAmount'? – peppe