Exemplo n.º 1
0
        public ImmediateModeQuads(GraphicsContextAlpha gl, uint max_quads, params VertexFormat[] formats)
        {
            int num = Math.Log2((int)(max_quads * 4u));

            if (1L << (num & 31) < (long)((ulong)(max_quads * 4u)))
            {
                num++;
            }
            max_quads        = (1u << num) / 4u;
            this.m_max_quads = max_quads;
            ushort[] array  = new ushort[this.m_max_quads * 6u];
            ushort[] array2 = new ushort[]
            {
                0,
                1,
                3,
                0,
                3,
                2
            };
            int i    = 0;
            int num2 = 0;

            while (i < (int)max_quads)
            {
                Common.Assert(num2 + 6 <= array.Length);
                for (int j = 0; j < 6; j++)
                {
                    //array[num2++] = (ushort)(i * 4 + (int)array2[j]); //FIXME: overflow
                    array[num2++] = (ushort)((i * 4 + (int)array2[j]) & 0xffff);
                }
                i++;
            }
            this.m_imm = new ImmediateMode <T>(gl, max_quads * 4u, array, 4, 6, formats);
        }
Exemplo n.º 2
0
 public DrawHelpers(GraphicsContextAlpha gl, uint max_vertices)
 {
     this.GL = gl;
     this.m_shader_program = Common.CreateShaderProgram("cg/default.cgx");
     this.m_shader_program.SetUniformBinding(0, "MVP");
     this.m_shader_program.SetAttributeBinding(0, "p");
     this.m_shader_program.SetAttributeBinding(1, "vin_color");
     this.m_current_color         = Colors.Magenta;
     this.m_shader_depth          = 0u;
     this.m_view_matrix_tag       = 4294967295u;
     this.m_model_matrix_tag      = 4294967295u;
     this.m_projection_matrix_tag = 4294967295u;
     this.m_imm = new ImmediateMode <DrawHelpers.Vertex>(gl, max_vertices, null, 0, 0, new VertexFormat[]
     {
         (VertexFormat)259,
         (VertexFormat)259
     });
 }