Esempio n. 1
0
        private static void DrawPolygonUv(NUD.Polygon p, int windowWidth, int windowHeight)
        {
            Shader shader = OpenTKSharedResources.shaders["UV"];

            shader.UseProgram();
            shader.EnableVertexAttributes();
            uvPositionVbo.Bind();

            // Draw over everything
            GL.Disable(EnableCap.DepthTest);
            GL.Disable(EnableCap.CullFace);
            GL.Clear(ClearBufferMask.DepthBufferBit);

            // Scale to 0 to 1 UV space and flip vertically.
            Matrix4 matrix = Matrix4.CreateOrthographicOffCenter(0, 1, 1, 0, -1, 1);

            shader.SetMatrix4x4("mvpMatrix", ref matrix);

            SetVertexAttributes(shader);

            // Draw the uvs.
            GL.LineWidth(1.5f);
            GL.Enable(EnableCap.LineSmooth);

            uvElementsIbo.Bind();
            GL.DrawElements(PrimitiveType.Triangles, p.displayFaceSize, DrawElementsType.UnsignedInt, p.Offset);

            shader.DisableVertexAttributes();
        }
Esempio n. 2
0
 public UvViewer(NUD sourceNud, NUD.Polygon polygonToRender)
 {
     // We need the nud to generate buffers due to the way nud rendering works.
     InitializeComponent();
     this.sourceNud       = sourceNud;
     this.polygonToRender = polygonToRender;
 }
Esempio n. 3
0
        public static void DrawUv(NUD.Polygon polygon, int windowWidth, int windowHeight)
        {
            if (uvPositionVbo == null)
            {
                return;
            }

            DrawPolygonUv(polygon, windowWidth, windowHeight);
        }