Exemplo n.º 1
0
        public static void Draw(ShaderProgram shader, int textureID)
        {
            Init();

            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadIdentity();

            GL.ActiveTexture(TextureUnit.Texture1);
            GL.BindTexture(TextureTarget.Texture2D, textureID);
            shader.SetInt("screenTexture", 1);

            GL.Enable(EnableCap.CullFace);
            GL.Enable(EnableCap.DepthTest);
            GL.CullFace(CullFaceMode.Back);

            vao.Enable(shader);
            vao.Use();
            GL.DrawArrays(PrimitiveType.TriangleStrip, 0, Length);
        }
Exemplo n.º 2
0
        public void Draw(GLContext control, Pass pass, Vector4 sphereColor, Vector4 pickingColor, bool forceUpdate)
        {
            if (pass == Pass.TRANSPARENT)
            {
                return;
            }

            Init(forceUpdate);

            if (Length == 0)
            {
                return;
            }

            GL.LineWidth(5f);

            var shader = GlobalShaders.GetShader("BASIC");

            control.CurrentShader = shader;

            shader.SetMatrix4x4("mtxMdl", ref Transform);
            if (pass == Pass.OPAQUE)
            {
                shader.SetVector4("color", sphereColor);

                vao.Enable(control.CurrentShader);
                vao.Use();
                GL.DrawElements(BeginMode.Lines, Indices.Length, DrawElementsType.UnsignedInt, 0);
            }
            else
            {
                shader.SetVector4("color", pickingColor);

                vao.Enable(control.CurrentShader);
                vao.Use();
                GL.DrawElements(BeginMode.Lines, Indices.Length, DrawElementsType.UnsignedInt, 0);
            }

            GL.LineWidth(1f);
        }