예제 #1
0
 public IModel Start()
 {
     GlHelper.VaoBinder(vao);
     GL.EnableVertexAttribArray(0);
     GL.EnableVertexAttribArray(2);
     return(this);
 }
예제 #2
0
 public TestModel()
 {
     vao = GlHelper.VaoCreator();
     GlHelper.VaoBinder(vao);
     indicesVbo  = GlHelper.LoadIndices(indices);
     verticesVbo = GlHelper.LoadVbo(0, 3, vertices);
     GlHelper.VaoBinder(0);
 }
예제 #3
0
        private void LoadAtlas(string atlasProperties)
        {
            var data       = atlasProperties.Split();
            var id         = int.Parse(data[0]);
            var width      = int.Parse(data[2]);
            var height     = int.Parse(data[3]);
            var elemWidth  = int.Parse(data[4]);
            var elemHeight = int.Parse(data[5]);
            var glId       = GlHelper.LoadTexture(Path.Combine(directory, data[1]));

            atlases.Add(id, new Atlas(glId, width, height, elemWidth, elemHeight));
        }
예제 #4
0
        private void LoadToVideoCard()
        {
            if (vao == -1)
            {
                vao = GlHelper.VaoCreator();
            }

            GlHelper.VaoBinder(vao);
            GlHelper.DeleteVbos(verticesVbo, indicesVbo, textureVbo);
            indicesVbo  = GlHelper.LoadIndices(indices.ToArray());
            verticesVbo = GlHelper.LoadVbo(0, 3, vertices.ToArray());
            textureVbo  = GlHelper.LoadVbo(2, 2, textureCoords.ToArray());
        }
예제 #5
0
        public IModel Start()
        {
            if (shouldLoadToGl)
            {
                LoadToVideoCard();
                shouldLoadToGl = false;
            }

            GlHelper.VaoBinder(vao);
            GL.EnableVertexAttribArray(0);
            GL.EnableVertexAttribArray(2);
            GL.BindTexture(TextureTarget.Texture2D, storage[1].AtlasGlId);
            return(this);
        }
예제 #6
0
 private void ReleaseUnmanagedResources()
 {
     GlHelper.VaoRemover(atlases.Values.Select(a => a.GlAtlasId).ToArray());
 }