/// <summary>
 /// Installs a given program as part of the current rendering state, then draws this array object.
 /// </summary>
 /// <typeparam name="TAttr1">The type of the 1st attribute buffer object of the VAO.</typeparam>
 /// <typeparam name="TDefaultUniformBlock">The type of the container used for default block uniforms for the given program.</typeparam>
 /// <param name="vao">The VAO to use.</param>
 /// <param name="program">The program to use.</param>
 /// <param name="defaultUniformBlock">The values for the uniforms in the default block.</param>
 /// <param name="count">The number of vertices to draw, or -1 to draw all vertices.</param>
 public static void Draw <TAttr1, TDefaultUniformBlock>(
     this IVertexArrayObject <TAttr1> vao,
     GlProgramWithDUB <TDefaultUniformBlock> program,
     TDefaultUniformBlock defaultUniformBlock,
     int count = -1)
     where TAttr1 : struct
     where TDefaultUniformBlock : struct
 {
     program.UseWithDefaultUniformBlock(defaultUniformBlock);
     vao.Draw(count);
 }
예제 #2
0
        /// <inheritdoc />
        public void Load()
        {
            ThrowIfDisposed();

            if (program == null)
            {
                lock (ProgramStateLock)
                {
                    if (program == null)
                    {
                        program        = programBuilder.Build();
                        programBuilder = null;
                    }
                }
            }

            this.vertexArrayObject        = (GlVertexArrayObject <Vertex>) this.vertexArrayObjectBuilder.Build();
            this.vertexArrayObjectBuilder = null;
        }
예제 #3
0
        /// <inheritdoc /> from IComponent
        public void Load()
        {
            ThrowIfDisposed();

            if (program == null)
            {
                lock (ProgramStateLock)
                {
                    if (program == null)
                    {
                        program        = programBuilder.Build();
                        programBuilder = null;
                    }
                }
            }

            this.vertexBuffer        = this.vertexBufferBuilder.Build();
            this.vertexBufferBuilder = null;
        }
예제 #4
0
        /// <inheritdoc />
        public void Load()
        {
            ThrowIfDisposed();

            if (program == null)
            {
                lock (ProgramStateLock)
                {
                    if (program == null)
                    {
                        program        = programBuilder.Build();
                        programBuilder = null;
                    }
                }
            }

            this.coloredTriangleBuffer        = coloredTriangleBufferBuilder.Build();
            this.coloredTriangleBufferBuilder = null;

            this.coloredLineBuffer        = coloredLineBufferBuilder.Build();
            this.coloredLineBufferBuilder = null;
        }
예제 #5
0
        /// <inheritdoc />
        public void Load()
        {
            ThrowIfDisposed();

            this.textures    = new int[1];
            this.textures[0] = Path.GetExtension(textureFilePath) == ".DDS" ? TextureLoader.LoadDDS(textureFilePath) : TextureLoader.LoadBMP(textureFilePath);

            if (program == null)
            {
                lock (ProgramStateLock)
                {
                    if (program == null)
                    {
                        program        = programBuilder.Build();
                        programBuilder = null;
                    }
                }
            }

            this.vertexArrayObject        = (GlVertexArrayObject <Vertex>) this.vertexArrayObjectBuilder.Build();
            this.vertexArrayObjectBuilder = null;
        }