Example #1
0
        public void BindCombiner(uint m0, uint m1, bool tex)
        {
            if (!supported)
            {
                return;
            }

            if (m0 == 0 && m1 == 0)
            {
                return;
            }

            GLSLShaders shader = shaderCache.FirstOrDefault(x => x.Mux0 == m0 && x.Mux1 == m1 &&
                                                            x.HasLightingEnabled == Convert.ToBoolean(F3DEX2.GeometryMode & (uint)General.GeometryMode.LIGHTING) &&
                                                            x.Textured == tex);

            if (shader != null)
            {
                GL.UseProgram(shader.ProgramID);
            }
            else
            {
                shader = new GLSLShaders(m0, m1, F3DEX2, tex);
                shaderCache.Add(shader);
            }

            GL.Uniform1(GL.GetUniformLocation(shader.ProgramID, "tex0"), 0);
            GL.Uniform1(GL.GetUniformLocation(shader.ProgramID, "tex1"), 1);
            GL.Uniform4(GL.GetUniformLocation(shader.ProgramID, "primColor"), F3DEX2.PrimColor);
            GL.Uniform4(GL.GetUniformLocation(shader.ProgramID, "envColor"), F3DEX2.EnvColor);
        }
Example #2
0
        public void BindCombiner(uint m0, uint m1, bool tex)
        {
            if (!supported) return;

            if (m0 == 0 && m1 == 0) return;

            GLSLShaders shader = shaderCache.FirstOrDefault(x => x.Mux0 == m0 && x.Mux1 == m1 &&
                x.HasLightingEnabled == Convert.ToBoolean(F3DEX2.GeometryMode & (uint)General.GeometryMode.LIGHTING) &&
                x.Textured == tex);

            if (shader != null)
                GL.UseProgram(shader.ProgramID);
            else
            {
                shader = new GLSLShaders(m0, m1, F3DEX2, tex);
                shaderCache.Add(shader);
            }

            GL.Uniform1(GL.GetUniformLocation(shader.ProgramID, "tex0"), 0);
            GL.Uniform1(GL.GetUniformLocation(shader.ProgramID, "tex1"), 1);
            GL.Uniform4(GL.GetUniformLocation(shader.ProgramID, "primColor"), F3DEX2.PrimColor);
            GL.Uniform4(GL.GetUniformLocation(shader.ProgramID, "envColor"), F3DEX2.EnvColor);
        }