GetVertexAttributeLocations() 개인적인 메소드

private GetVertexAttributeLocations ( int program ) : void
program int
리턴 void
예제 #1
0
        private void Link(Shader vertexShader, Shader pixelShader)
        {
            int program = GL.CreateProgram();

            GL.AttachShader(program, vertexShader.GetShaderHandle());
            GL.AttachShader(program, pixelShader.GetShaderHandle());
            GL.LinkProgram(program);
            GL.UseProgram(program);
            vertexShader.GetVertexAttributeLocations(program);
            pixelShader.ApplySamplerTextureUnits(program);
            int @params = 0;

            GL.GetProgram(program, ProgramParameter.LinkStatus, out @params);
            if (@params == 0)
            {
                Console.WriteLine(GL.GetProgramInfoLog(program));
                throw new InvalidOperationException("Unable to link effect program");
            }
            else
            {
                ShaderProgramInfo shaderProgramInfo;
                shaderProgramInfo.program     = program;
                shaderProgramInfo.posFixupLoc = GL.GetUniformLocation(program, "posFixup");
                this._programCache.Add(vertexShader.HashKey | pixelShader.HashKey, shaderProgramInfo);
            }
        }
예제 #2
0
        private void Link(Shader vertexShader, Shader pixelShader)
        {
            // NOTE: No need to worry about background threads here
            // as this is only called at draw time when we're in the
            // main drawing thread.
            var program = GL.CreateProgram();

            GraphicsExtensions.CheckGLError();

            GL.AttachShader(program, vertexShader.GetShaderHandle());
            GraphicsExtensions.CheckGLError();

            GL.AttachShader(program, pixelShader.GetShaderHandle());
            GraphicsExtensions.CheckGLError();

            //vertexShader.BindVertexAttributes(program);

            GL.LinkProgram(program);
            GraphicsExtensions.CheckGLError();

            GL.UseProgram(program);
            GraphicsExtensions.CheckGLError();

            vertexShader.GetVertexAttributeLocations(program);

            pixelShader.ApplySamplerTextureUnits(program);

            var linked = 0;

#if GLES
            GL.GetProgram(program, ProgramParameter.LinkStatus, ref linked);
#else
            GL.GetProgram(program, ProgramParameter.LinkStatus, out linked);
#endif
            GraphicsExtensions.LogGLError("VertexShaderCache.Link(), GL.GetProgram");
            if (linked == 0)
            {
#if !GLES
                var log = GL.GetProgramInfoLog(program);
                Console.WriteLine(log);
#endif
                GL.DetachShader(program, vertexShader.GetShaderHandle());
                GL.DetachShader(program, pixelShader.GetShaderHandle());
#if MONOMAC
                GL.DeleteProgram(1, ref program);
#else
                GL.DeleteProgram(program);
#endif
                throw new InvalidOperationException("Unable to link effect program");
            }

            ShaderProgramInfo info;
            info.program     = program;
            info.posFixupLoc = GL.GetUniformLocation(program, "posFixup");

            _programCache.Add(vertexShader.HashKey | pixelShader.HashKey, info);
        }
예제 #3
0
        private ShaderProgram Link(Shader vertexShader, Shader pixelShader)
        {
            // NOTE: No need to worry about background threads here
            // as this is only called at draw time when we're in the
            // main drawing thread.
            var program = GL.CreateProgram();

            GraphicsExtensions.CheckGLError();

            GL.AttachShader(program, vertexShader.GetShaderHandle());
            GraphicsExtensions.CheckGLError();

            GL.AttachShader(program, pixelShader.GetShaderHandle());
            GraphicsExtensions.CheckGLError();

            //vertexShader.BindVertexAttributes(program);

            GL.LinkProgram(program);
            GraphicsExtensions.CheckGLError();

            GL.UseProgram(program);
            GraphicsExtensions.CheckGLError();

            vertexShader.GetVertexAttributeLocations(program);

            pixelShader.ApplySamplerTextureUnits(program);

            var linked = 0;

            GL.GetProgram(program, GetProgramParameterName.LinkStatus, out linked);
            GraphicsExtensions.LogGLError("VertexShaderCache.Link(), GL.GetProgram");
            if (linked == (int)Bool.False)
            {
                var log = GL.GetProgramInfoLog(program);
                Console.WriteLine(log);
                GL.DetachShader(program, vertexShader.GetShaderHandle());
                GL.DetachShader(program, pixelShader.GetShaderHandle());
#if MONOMAC
                GL.DeleteProgram(1, ref program);
#else
                GL.DeleteProgram(program);
#endif
                throw new InvalidOperationException("Unable to link effect program");
            }

            return(new ShaderProgram(program));
        }
예제 #4
0
        private void Link(Shader vertexShader, Shader pixelShader)
        {
            // NOTE: No need to worry about background threads here
            // as this is only called at draw time when we're in the
            // main drawing thread.
            var program = vertexShader.GraphicsDevice.GLDevice.glCreateProgram();

            vertexShader.GraphicsDevice.GLDevice.glAttachShader(program, vertexShader.GetShaderHandle());

            vertexShader.GraphicsDevice.GLDevice.glAttachShader(program, pixelShader.GetShaderHandle());

            vertexShader.GraphicsDevice.GLDevice.glLinkProgram(program);

            vertexShader.GraphicsDevice.GLDevice.glUseProgram(program);

            vertexShader.GetVertexAttributeLocations(program);

            pixelShader.ApplySamplerTextureUnits(program);

            var linked = 0;

            vertexShader.GraphicsDevice.GLDevice.glGetProgramiv(
                program,
                OpenGLDevice.GLenum.GL_LINK_STATUS,
                out linked
                );
            if (linked == 0)
            {
                Console.WriteLine(
                    vertexShader.GraphicsDevice.GLDevice.glGetProgramInfoLog(program)
                    );

                vertexShader.GraphicsDevice.GLDevice.glDetachShader(program, vertexShader.GetShaderHandle());
                vertexShader.GraphicsDevice.GLDevice.glDetachShader(program, pixelShader.GetShaderHandle());

                vertexShader.GraphicsDevice.GLDevice.glDeleteProgram(program);
                throw new InvalidOperationException("Unable to link effect program");
            }

            ShaderProgram shaderProgram = new ShaderProgram(program);

            _programCache.Add(vertexShader.HashKey | pixelShader.HashKey, shaderProgram);
        }
        private ShaderProgram Link(Shader vertexShader, Shader pixelShader)
        {
            // NOTE: No need to worry about background threads here
            // as this is only called at draw time when we're in the
            // main drawing thread.
            var program = (WebGLProgram)gl.createProgram();

            GraphicsExtensions.CheckGLError();

            gl.attachShader(program, vertexShader.GetShaderHandle());
            GraphicsExtensions.CheckGLError();

            gl.attachShader(program, pixelShader.GetShaderHandle());
            GraphicsExtensions.CheckGLError();

            //vertexShader.BindVertexAttributes(program);

            gl.linkProgram(program);
            GraphicsExtensions.CheckGLError();

            gl.useProgram(program);
            GraphicsExtensions.CheckGLError();

            vertexShader.GetVertexAttributeLocations(program);

            pixelShader.ApplySamplerTextureUnits(program);

            var linked = (bool)gl.getProgramParameter(program, gl.LINK_STATUS);

            GraphicsExtensions.LogGLError("VertexShaderCache.Link(), GL.GetProgram");

            if (!linked)
            {
                var log = gl.getProgramInfoLog(program);
                gl.detachShader(program, vertexShader.GetShaderHandle());
                gl.detachShader(program, pixelShader.GetShaderHandle());
                _graphicsDevice.DisposeProgram(program);
                throw new InvalidOperationException("Unable to link effect program");
            }

            return(new ShaderProgram(program));
        }
예제 #6
0
 private void Link(Shader vertexShader, Shader pixelShader)
 {
   int program = GL.CreateProgram();
   GL.AttachShader(program, vertexShader.GetShaderHandle());
   GL.AttachShader(program, pixelShader.GetShaderHandle());
   GL.LinkProgram(program);
   GL.UseProgram(program);
   vertexShader.GetVertexAttributeLocations(program);
   pixelShader.ApplySamplerTextureUnits(program);
   int @params = 0;
   GL.GetProgram(program, ProgramParameter.LinkStatus, out @params);
   if (@params == 0)
   {
     Console.WriteLine(GL.GetProgramInfoLog(program));
     throw new InvalidOperationException("Unable to link effect program");
   }
   else
   {
     ShaderProgramInfo shaderProgramInfo;
     shaderProgramInfo.program = program;
     shaderProgramInfo.posFixupLoc = GL.GetUniformLocation(program, "posFixup");
     this._programCache.Add(vertexShader.HashKey | pixelShader.HashKey, shaderProgramInfo);
   }
 }
예제 #7
0
        private void Link(Shader vertexShader, Shader pixelShader)
        {
            // NOTE: No need to worry about background threads here
            // as this is only called at draw time when we're in the
            // main drawing thread.
            var program = GL.CreateProgram();
            GraphicsExtensions.CheckGLError();

            GL.AttachShader(program, vertexShader.GetShaderHandle());
            GraphicsExtensions.CheckGLError();

            GL.AttachShader(program, pixelShader.GetShaderHandle());
            GraphicsExtensions.CheckGLError();

            //vertexShader.BindVertexAttributes(program);

            GL.LinkProgram(program);
            GraphicsExtensions.CheckGLError();

            GL.UseProgram(program);
            GraphicsExtensions.CheckGLError();

            vertexShader.GetVertexAttributeLocations(program);

            pixelShader.ApplySamplerTextureUnits(program);

            var linked = 0;

            GL.GetProgram(program, GetProgramParameterName.LinkStatus, out linked);
            GraphicsExtensions.LogGLError("VertexShaderCache.Link(), GL.GetProgram");
            if (linked == 0)
            {
                var log = GL.GetProgramInfoLog(program);
                Console.WriteLine(log);
                GL.DetachShader(program, vertexShader.GetShaderHandle());
                GL.DetachShader(program, pixelShader.GetShaderHandle());
#if MONOMAC
                GL.DeleteProgram(1, ref program);
#else
                GL.DeleteProgram(program);
#endif
                throw new InvalidOperationException("Unable to link effect program");
            }

            ShaderProgram shaderProgram = new ShaderProgram(program);

            _programCache.Add(vertexShader.HashKey | pixelShader.HashKey, shaderProgram);
        }
예제 #8
0
        private void Link(Shader vertexShader, Shader pixelShader)
        {
            // TODO: Shouldn't we be calling GL.DeleteProgram() somewhere?

            // NOTE: No need to worry about background threads here
            // as this is only called at draw time when we're in the
            // main drawing thread.
            var program = GL.CreateProgram();
            GraphicsExtensions.CheckGLError();

            GL.AttachShader(program, vertexShader.GetShaderHandle());
            GraphicsExtensions.CheckGLError();

            GL.AttachShader(program, pixelShader.GetShaderHandle());
            GraphicsExtensions.CheckGLError();

            //vertexShader.BindVertexAttributes(program);

            GL.LinkProgram(program);
            GraphicsExtensions.CheckGLError();

            GL.UseProgram(program);
            GraphicsExtensions.CheckGLError();

            vertexShader.GetVertexAttributeLocations(program);

            pixelShader.ApplySamplerTextureUnits(program);

            var linked = 0;

#if GLES
			GL.GetProgram(program, ProgramParameter.LinkStatus, ref linked);
#else
            GL.GetProgram(program, ProgramParameter.LinkStatus, out linked);
#endif
            GraphicsExtensions.LogGLError("VertexShaderCache.Link(), GL.GetProgram");
            if (linked == 0)
            {
#if !GLES
                var log = GL.GetProgramInfoLog(program);
                Console.WriteLine(log);
#endif
                throw new InvalidOperationException("Unable to link effect program");
            }

            ShaderProgramInfo info;
            info.program = program;
            info.posFixupLoc = GL.GetUniformLocation(program, "posFixup");

            _programCache.Add(vertexShader.HashKey | pixelShader.HashKey, info);             
        }
예제 #9
0
        private void Link(Shader vertexShader, Shader pixelShader)
        {
            // NOTE: No need to worry about background threads here
            // as this is only called at draw time when we're in the
            // main drawing thread.
            var program = vertexShader.GraphicsDevice.GLDevice.glCreateProgram();

            vertexShader.GraphicsDevice.GLDevice.glAttachShader(program, vertexShader.GetShaderHandle());

            vertexShader.GraphicsDevice.GLDevice.glAttachShader(program, pixelShader.GetShaderHandle());

            vertexShader.GraphicsDevice.GLDevice.glLinkProgram(program);

            vertexShader.GraphicsDevice.GLDevice.glUseProgram(program);

            vertexShader.GetVertexAttributeLocations(program);

            pixelShader.ApplySamplerTextureUnits(program);

            var linked = 0;
            vertexShader.GraphicsDevice.GLDevice.glGetProgramiv(
                program,
                OpenGLDevice.GLenum.GL_LINK_STATUS,
                out linked
            );
            if (linked == 0)
            {
                Console.WriteLine(
                    vertexShader.GraphicsDevice.GLDevice.glGetProgramInfoLog(program)
                );

                vertexShader.GraphicsDevice.GLDevice.glDetachShader(program, vertexShader.GetShaderHandle());
                vertexShader.GraphicsDevice.GLDevice.glDetachShader(program, pixelShader.GetShaderHandle());

                vertexShader.GraphicsDevice.GLDevice.glDeleteProgram(program);
                throw new InvalidOperationException("Unable to link effect program");
            }

            ShaderProgram shaderProgram = new ShaderProgram(program);

            _programCache.Add(vertexShader.HashKey | pixelShader.HashKey, shaderProgram);
        }