DerelictGL3 and glBegin() access violation.

bauss jj_1337 at live.dk
Wed Feb 28 12:36:37 UTC 2018


On Wednesday, 28 February 2018 at 12:02:27 UTC, Kayomn wrote:
> 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.

Most likely a library issue. Are you sure that you link to the 
libraries correctly etc.?


More information about the Digitalmars-d-learn mailing list