Пример #1
0
        static RenderWireframeCubeCommand()
        {
            //setup the shader
            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "Graphics.shaders.draw-vs.glsl"));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "Graphics.shaders.draw-ps.glsl"));
            ShaderProgramDescriptor sd = new ShaderProgramDescriptor(desc);

            theShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            theVBO = new VertexBufferObject(BufferUsageHint.DynamicDraw);
            theIBO = new IndexBufferObject(BufferUsageHint.StaticDraw);

            ushort[] index =
            {
                4, 6, 2, 3, PRIM_RESTART,
                1, 3, 7, 6, PRIM_RESTART,
                7, 5, 1, 0, PRIM_RESTART,
                2, 0, 4, 5
            };

            theIBO.setData(index);

            //setup the vao
            theVAO = new VertexArrayObject();
            theVAO.bindVertexFormat(theShader, V3T2B4.bindings());
        }
Пример #2
0
        static RenderTextureCubeCommand()
        {
            //setup the shader
            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "Graphics.shaders.draw-vs.glsl"));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "Graphics.shaders.draw-ps.glsl"));
            ShaderProgramDescriptor sd = new ShaderProgramDescriptor(desc);

            theShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            theVBO = new VertexBufferObject(BufferUsageHint.DynamicDraw);
            theIBO = new IndexBufferObject(BufferUsageHint.StaticDraw);

            ushort[] index = { 0,   1,  2,
                               0,   2,  3,                              //front
                               4,   5,  6,
                               4,   6,  7,                              //left
                               8,   9, 10,
                               8,  10, 11,                              //right
                               12, 13, 14,
                               12, 14, 15,                              // top
                               16, 17, 18,
                               16, 18, 19,                              // bottom
                               20, 21, 22,
                               20, 22, 23                               // back
            };
            theIBO.setData(index);

            //setup the vao
            theVAO = new VertexArrayObject();
            theVAO.bindVertexFormat(theShader, V3T2B4.bindings());
        }
Пример #3
0
        public void init()
        {
            myVbo = new VertexBufferObject(BufferUsageHint.DynamicDraw);
            myIbo = new IndexBufferObject(BufferUsageHint.DynamicDraw);
            myVao = new VertexArrayObject();

            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "Graphics.shaders.debug-vs.glsl"));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "Graphics.shaders.debug-ps.glsl"));
            ShaderProgramDescriptor sd = new ShaderProgramDescriptor(desc);

            myShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            myVao.bindVertexFormat(myShader, V3T2B4.bindings());

            myTexture = Graphics.Util.getEmbeddedTexture("Graphics.data.debugFont.png");
            //myTexture = Util.getEmbeddedTexture("Graphics.data.proggy12.png");
            myTexture.setMinMagFilters(TextureMinFilter.NearestMipmapNearest, TextureMagFilter.Nearest);
            myTexture.setWrapping(TextureWrapMode.ClampToEdge, TextureWrapMode.ClampToEdge);
            myFont = new TextureFont("Debug", myTexture, 16, 16, 32);
        }
Пример #4
0
        static RenderSphereCommand()
        {
            //setup the shader
            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "Graphics.shaders.draw-vs.glsl"));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "Graphics.shaders.draw-ps.glsl"));
            ShaderProgramDescriptor sd = new ShaderProgramDescriptor(desc);

            theShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            theVBO = new VertexBufferObject(BufferUsageHint.DynamicDraw);
            theIBO = new IndexBufferObject(BufferUsageHint.StaticDraw);

            createTheSphere();

            theIBO.setData(theSphereIndexes);

            //setup the vao
            theVAO = new VertexArrayObject();
            theVAO.bindVertexFormat(theShader, V3T2B4.bindings());
        }
Пример #5
0
        static RenderFrustumCommand()
        {
            //setup the shader
            List <ShaderDescriptor> desc = new List <ShaderDescriptor>();

            desc.Add(new ShaderDescriptor(ShaderType.VertexShader, "Graphics.shaders.draw-vs.glsl"));
            desc.Add(new ShaderDescriptor(ShaderType.FragmentShader, "Graphics.shaders.draw-ps.glsl"));
            ShaderProgramDescriptor sd = new ShaderProgramDescriptor(desc);

            theShader = Renderer.resourceManager.getResource(sd) as ShaderProgram;

            theVBO = new VertexBufferObject(BufferUsageHint.DynamicDraw);
            theIBO = new IndexBufferObject(BufferUsageHint.StaticDraw);

            ushort[] index =
            {
                0, 1, 3, 2, PRIM_RESTART,
                5, 1, 3, 7, PRIM_RESTART,
                4, 5, 7, 6, PRIM_RESTART,
                0, 4, 6, 2
            };

            theVerts[0] = new Vector4(-1, -1, -1, 1);
            theVerts[1] = new Vector4(1, -1, -1, 1);
            theVerts[2] = new Vector4(-1, 1, -1, 1);
            theVerts[3] = new Vector4(1, 1, -1, 1);

            theVerts[4] = new Vector4(-1, -1, 1, 1);
            theVerts[5] = new Vector4(1, -1, 1, 1);
            theVerts[6] = new Vector4(-1, 1, 1, 1);
            theVerts[7] = new Vector4(1, 1, 1, 1);

            theIBO.setData(index);

            //setup the vao
            theVAO = new VertexArrayObject();
            theVAO.bindVertexFormat(theShader, V3T2B4.bindings());
        }