DerelictGL3 and glBegin() access violation.

Kayomn spam at kayomn.net
Wed Feb 28 12:02:27 UTC 2018


Maybe I'm missing something, but whenever I attempt to call 
glBegin() with anything my program immediately encounters an 
access violation.

I've got a very simple setup, with this being my main:

import base.application;

import derelict.opengl3.gl3;
import derelict.glfw3.glfw3;

int main(string[] args) {
	DerelictGL3.load();

	version (Windows) {
		DerelictGLFW3.load(".\\dll\\glfw3.dll");
	} else {
		DerelictGLFW3.load();
	}
	return Application(args).run();
}

And I'm remembering to reload after creating the GL context in 
the window class:

public this(int width,int height,string title) {
	if (glfwInit()) {
		// Hint configuration.
		glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR,3);
		glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR,3);
		glfwWindowHint(GLFW_RESIZABLE,false);
		glfwWindowHint(GLFW_OPENGL_PROFILE,GLFW_OPENGL_CORE_PROFILE);

		this.nextTick = Time.getTicks();
		this.handle = glfwCreateWindow(
			this.width = width,
			this.height = height,
			toStringz(this.title = title),
			null,
			null
		);

		if (this.handle is null) {
			// Failure.
			Debug.log("GLFW Error: Failed to create window handle 
instance.");
			glfwTerminate();
		} else {
			import derelict.opengl3.gl3 : DerelictGL3;

			// Set positon.
			glfwSetWindowPos(this.handle,100,100);
			glfwMakeContextCurrent(this.handle);
			DerelictGL3.reload();
		}
	} else {
		Debug.log("GLFW Error: Failed to intialize.");
	}
}

Is this a DerelictGL3 bug? Am I missing something else that I 
should be initializing? Other things like glClear() seem to be 
working fine.


More information about the Digitalmars-d-learn mailing list