Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DerelictGL3.reload(); crashes the application in release mode #59

Open
dkorpel opened this issue Nov 18, 2017 · 0 comments
Open

DerelictGL3.reload(); crashes the application in release mode #59

dkorpel opened this issue Nov 18, 2017 · 0 comments

Comments

@dkorpel
Copy link

dkorpel commented Nov 18, 2017

When calling DerelictGL3.reload() after making a context for OpenGL, my application crashes when built in release mode. In debug mode it works just fine.

Example code: (glfw3.dll was taken from the 'lib-vc2015' folder and included in the same directory)

import derelict.glfw3.glfw3;
import derelict.opengl;

/+ 
dub.json:
{
	"name": "derelictGLissue",
	"dependencies": {
	"derelict-glfw3": "~>4.0.0-beta.1",
	"derelict-gl3": "~>2.0.0-beta.4",
	},
}
+/

int main() {

	DerelictGL3.load();
	DerelictGLFW3.load("glfw3.dll");

	if (!glfwInit())
	{
		glfwTerminate();
	}

	glfwWindowHint(GLFW_SAMPLES, 4);
	glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
	glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

	GLFWwindow* window = glfwCreateWindow(1280, 720, "Title", null, null);

	if (!window)
	{
		glfwTerminate();
		throw new Exception("Failed to create window");
	}
	glfwMakeContextCurrent(window);

	DerelictGL3.reload();

	while (!glfwWindowShouldClose(window))
	{
		glViewport(0, 0, 1280, 720);
		glClearColor(0.2f, 0.8f, 0.8f, 1.0f);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		glfwSwapBuffers(window);
		glfwPollEvents();
	}

	glfwDestroyWindow(window);
	glfwTerminate();
	return 0;
}

Running dub run succesfully shows a window, while running dub run --build=release results in an acces violation:

object.Error@(0): Access Violation
----------------
0x0042D613
0x00410944
0x00402A5D
Program exited with code 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant