c# - OpenTk AccessViolationException when using any OpenGL method -


so i'm using opentk make opengl game in c#.

mostly working wonderfully, when try use opengl method, system.accessviolationexception.

right i'm working on simple shader class:

using opentk.graphics.opengl4; using system.io; using wsclient.utilities;  namespace wsclient.graphics {     internal class shader     {         public const string fragmentshaderext = ".fs";         public const string vertexshaderext = ".vs";          private readonly int _programid;          public shader(string path)             : this(path, file.readalltext(path + fragmentshaderext), file.readalltext(path + vertexshaderext)) { }          public shader(string name, string fragmentsource, string vertexsource)         {             _programid = gl.createprogram();              attachshader(shadertype.fragmentshader, fragmentsource);             attachshader(shadertype.vertexshader, vertexsource);              gl.linkprogram(_programid);              var glinfolog = gl.getprograminfolog(_programid);             if (!string.isnullorempty(glinfolog))                 clientlog.logerror($"::gl_error:: couldn't link shader \"{name}\"\n {glinfolog}");         }          public void bind() => gl.useprogram(_programid);          private void attachshader(shadertype type, string source)         {             var id = gl.createshader(type);             gl.shadersource(id, source);             gl.compileshader(id);             gl.attachshader(_programid, id);         }     } } 

but can't seem use gl.createprogram(); or other opengl method matter accessviolationexception. i've triple checked code, dependencies, , have tried solutions other posts , yet nothing has worked far.

any idea cause this?


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -