如何在 OpenTk 中的 Glcontrol 中移动图像

问题描述

我是 opentk 的新手我想从左到右平滑地移动图像。我该怎么做?

我曾尝试移动视口,但它看起来渲染不流畅。

int cnt = 1920; public void DrawImage(int image) {

        GL.Viewport(new Rectangle(cnt,ScreenWidth,ScreenHeight));
        cnt--;
        GL.MatrixMode(MatrixMode.Projection);
        GL.Pushmatrix();
        GL.LoadIdentity();

        //GL.Ortho(0,1920,1080,1);

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

        GL.disable(EnableCap.Lighting);

        GL.Enable(EnableCap.Texture2D);

        GL.ActiveTexture(TextureUnit.Texture0);
        GL.BindTexture(TextureTarget.Texture2D,image);

        
        RunShaders();

        GL.disable(EnableCap.Texture2D);
        GL.PopMatrix();

        GL.MatrixMode(MatrixMode.Projection);
        GL.PopMatrix();

        GL.MatrixMode(MatrixMode.Modelview);

        //ErrorCode ec = GL.GetError();
        //if (ec != 0)
        //    System.Console.WriteLine(ec.ToString());
        //Console.Read();
        glControl1.SwapBuffers();
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)