The simplest OpenGL calls through OpenTK are crashing with
An unhandled exception of type 'System.AccessViolationException' occurred in OpenTK.dll
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Crashes with any combination of precompiled CSFML+.Net - 2.0, 2.1, 2.2 and with latest 2.3 git sources.
Also tried switching OpenTK from latest git version to precompiled binaries from OpenTK website - same crash.
Win7 and VS2015RC (I think it also crashed with 2013, can't say for sure).
NVidia 650TI, latest 352.86 (Witcher 3) drivers, same thing with 350.12 (GTAV) drivers. OpenGL - 4.5.
Also reported
here on github by another fellow.
I also noticed that when you create a window with OpenTK the context has IsCurrent set to true, while with SFML it's false.
Minimal code, the beginning is a copy of Window example:
using System;using SFML.Window;using OpenTK;using OpenTK.Graphics;using OpenTK.Graphics.OpenGL;namespace MinimalTests
{ internal static class SFMLTK
{ /// <summary> /// The main entry point for the application. /// </summary> private static void Main
() { // Request a 24-bits depth buffer when creating the window ContextSettings contextSettings
= new ContextSettings
(); contextSettings
.DepthBits = 24; // Create the main window Window window
= new Window
(new VideoMode
(640,
480),
"SFML window with OpenGL", Styles
.Default, contextSettings
); // Make it the active window for OpenGL calls window
.SetActive(); // Initialize OpenTK Toolkit
.Init(); GraphicsContext context
= new GraphicsContext
(new ContextHandle
(IntPtr
.Zero),
null); // Try to get the vendor name and crash Console
.WriteLine(GL
.GetString(StringName
.Vendor)); } }}