Exemplo n.º 1
0
        private void LoadData(OpenGL GL, GShaderProgram shader, vec3[] vertex, vec4[] color)
        {
            pVBO[0].Bind(GL);
            pVBO[0].SetData(GL, (uint)shader.GetAttributeID(GL, "vPosition"), Pos, false, 3);

            //  Color

            pVBO[1].Bind(GL);
            pVBO[1].SetData(GL, (uint)shader.GetAttributeID(GL, "vArgbColor"), Color, false, 4);
        }
Exemplo n.º 2
0
        public void Create(OpenGL GL, string texPath, GShaderProgram shader)
        {
            vec3[] points = new vec3[] { /*new vec3(-C_END, -C_END, 0), new vec3(-C_END, C_END, 0), new vec3(C_END, C_END, 0), new vec3(C_END, C_END, 0) */
                new vec3(C_BOX_END, C_BOX_END, 0), new vec3(C_BOX_END, -C_BOX_END, 0), new vec3(-C_BOX_END, C_BOX_END, 0), new vec3(-C_BOX_END, -C_BOX_END, 0)
            };
            vec3[] normals = new vec3[points.Length];
            for (int i = 0; i < normals.Length; i++)
            {
                normals[i] = new vec3(0.0f, 0.0f, -1.0f);
            }
            vec2[] texCord = new vec2[] {
                new vec2(0.0f, 1.0f), new vec2(0.0f, 0.0f), new vec2(1.0f, 1.0f), new vec2(1.0f, 0.0f)
            };

            if (texPath == null)
            {
                _textureName = C_DUMMY_TEXTURE;
                TextureManager.Instance.CreateTexture1x1(C_DUMMY_TEXTURE, GL, false, Color.Blue);
            }
            else
            {
                _textureName = texPath;
                TextureManager.Instance.CreateTexture(texPath, GL, false);
            }

            arrowVAO = new VertexBufferArray();
            arrowVAO.Create(GL);
            arrowVAO.Bind(GL);

            VertexBuffer[] cVBO = new VertexBuffer[3];

            cVBO[0] = new VertexBuffer();
            cVBO[0].Create(GL);
            cVBO[0].Bind(GL);
            cVBO[0].SetData(GL, (uint)shader.GetAttributeID(GL, "vPosition"), points, false, 3);

            //  Texture
            cVBO[1] = new VertexBuffer();
            cVBO[1].Create(GL);
            cVBO[1].Bind(GL);
            cVBO[1].SetData(GL, (uint)shader.GetAttributeID(GL, "vTextureCoord"), texCord, false, 2);

            //  Normals
            cVBO[2] = new VertexBuffer();
            cVBO[2].Create(GL);
            cVBO[2].Bind(GL);
            cVBO[2].SetData(GL, (uint)shader.GetAttributeID(GL, "vSurfaceNormal"), normals, false, 3);

            arrowVAO.Unbind(GL);
        }
Exemplo n.º 3
0
        public void Create(OpenGL GL, string texPath, GShaderProgram shader)
        {
            CircleData c = DrawCircle(0f, 0f, 1f, _numSegments);

            vec3[] points  = c.points;
            vec3[] normals = new vec3[points.Length];
            vec2[] texCord = c.texture;
            for (int i = 0; i < normals.Length; i++)
            {
                normals[i] = new vec3(0.0f, 0.0f, -1.0f);
            }


            if (texPath == null || texPath == "")
            {
                _textureName = C_DUMMY_TEXTURE;
                TextureManager.Instance.CreateTexture1x1(C_DUMMY_TEXTURE, GL, false, Color.Blue);
            }
            else
            {
                _textureName = texPath;
                TextureManager.Instance.CreateTexture(texPath, GL, false);
            }

            compassVAO = new VertexBufferArray();
            compassVAO.Create(GL);
            compassVAO.Bind(GL);

            VertexBuffer[] cVBO = new VertexBuffer[3];

            cVBO[0] = new VertexBuffer();
            cVBO[0].Create(GL);
            cVBO[0].Bind(GL);
            cVBO[0].SetData(GL, (uint)shader.GetAttributeID(GL, "vPosition"), points, false, 3);

            //  Texture
            cVBO[1] = new VertexBuffer();
            cVBO[1].Create(GL);
            cVBO[1].Bind(GL);
            cVBO[1].SetData(GL, (uint)shader.GetAttributeID(GL, "vTextureCoord"), texCord, false, 2);

            //  Normals
            cVBO[2] = new VertexBuffer();
            cVBO[2].Create(GL);
            cVBO[2].Bind(GL);
            cVBO[2].SetData(GL, (uint)shader.GetAttributeID(GL, "vSurfaceNormal"), normals, false, 3);

            compassVAO.Unbind(GL);
        }