Search code examples
c#openglopentk

OpenTK GL.MatrixMode and GL.LoadMatrix not found


I'm trying to fix a problem while running into those two stackoverflow questons OpenGL with OpenTK wrapper cannot get projections to work and OpenTK Camera in C#. Both state I should use GL functions I just don't have!
What am I doing wrong/how can I get those? All three aren't available, even with the following usings

GL.MatrixMode()
MatrixMode.Projection
GL.LoadMatrix()

using OpenTK.Graphics.OpenGL4;
using OpenTK;

My guess is I missed a using, but since visual studio doesn't show me a single hotfix I'm kind of lost


Solution

  • I couldn't find up-to-date documentation for OpenTK, but seems that those using statements only import modern OpenGL functionality. As I said in comments, adding using OpenTK.Graphics.OpenGL; imports older functions such as those in your question.

    Modern OpenGL doesn't have functions for matrices, you must implement the functionality yourself, eg. declaring a matrix as a float matrix[ 16 ] and upload the matrices as uniforms using GL.UniformMatrix4.