public VertexBufferObjectWithVAO(bool isStatic, int numVerticies, VertexAttributes attributes)
        {
            this.isStatic   = isStatic;
            this.attributes = attributes;
            this.vertices   = new float[numVerticies];

            bufferHandle = GL.GenBuffer();
            usage        = isStatic ? BufferUsageHint.StaticDraw : BufferUsageHint.DynamicDraw;

            createVAO();
        }
Example #2
0
        public VertexAttribute getVertexAttribute(int usage)
        {
            VertexAttributes attributes = vertices.getAttributes();
            int len = attributes.size();

            for (int i = 0; i < len; i++)
            {
                if (attributes[i].usage == usage)
                {
                    return(attributes[i]);
                }
            }

            return(null);
        }
Example #3
0
 public Mesh(bool isStatic, int maxVertices, int maxIndices, VertexAttributes attributes)
 {
     vertices      = new VertexBufferObjectWithVAO(isStatic, maxVertices, attributes);
     indices       = new IndexBufferObject(isStatic, maxIndices);
     isVertexArray = false;
 }
Example #4
0
        public Mesh(VertexDataType type, bool isStatic, int maxVertices, int maxIndices, VertexAttributes attributes)
        {
            // todo: handle other type

            vertices      = new VertexBufferObjectWithVAO(isStatic, maxVertices, attributes);
            indices       = new IndexBufferObject(isStatic, maxIndices);
            isVertexArray = false;
        }