digitalmars.D.learn - DerelictGL3 and glBegin() access violation.
- Kayomn (52/52) Feb 28 2018 Maybe I'm missing something, but whenever I attempt to call
- bauss (3/55) Feb 28 2018 Most likely a library issue. Are you sure that you link to the
- Kayomn (6/10) Feb 28 2018 I'm using DUB for package management and linking and any library
- Mike Parker (7/10) Feb 28 2018 No, not a bug. glBegin is one of the deprecated OpenGL functions.
- Mike Parker (18/19) Feb 28 2018 Whoa. Just noticed this. That's an older version of DerelictGL3
- Kayomn (4/24) Feb 28 2018 Yeah, I knew they were deprecated, just weren't aware Derelict
- Mike Parker (5/8) Feb 28 2018 Yeah, I decided against documenting the older version as I don't
- Kayomn (4/13) Feb 28 2018 I was originally was only using them to make sure I could render
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.
Feb 28 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.?
Feb 28 2018
On Wednesday, 28 February 2018 at 12:36:37 UTC, bauss wrote:On Wednesday, 28 February 2018 at 12:02:27 UTC, Kayomn wrote:I'm using DUB for package management and linking and any library loading I'm using I'm remembering to load. This bug seems to be happening on both Windows and Linux with the same configuration and there's no other topics on it from Google searches that appear to be having the same issue.[...]Most likely a library issue. Are you sure that you link to the libraries correctly etc.?
Feb 28 2018
On Wednesday, 28 February 2018 at 12:02:27 UTC, Kayomn wrote:Is this a DerelictGL3 bug? Am I missing something else that I should be initializing? Other things like glClear() seem to be working fine.No, not a bug. glBegin is one of the deprecated OpenGL functions. DerelictGL3 these days doesn't attempt to load any of the deprecated stuff unless you explicitly tell it to. To do so, you need to override the default behavior at compile time. Please see the DerelictGL3 documentation for the details: http://derelictorg.github.io/packages/gl3/
Feb 28 2018
On Wednesday, 28 February 2018 at 12:02:27 UTC, Kayomn wrote:import derelict.opengl3.gl3;Whoa. Just noticed this. That's an older version of DerelictGL3 you're using there. You should really be using the latest version of both DerelictGL3 and DerelictGLFW3. The -alpha versions are what I recommend. They're perfectly fine, despite the -alpha in the version tag. But if you want to continue with the old 1.x version of DerelictGL3, then you can get access to the deprecated stuff by replacing the `gl3` import with `gl` can using `DerelictGL` in place of `DerelictGL3`: ======== import derelict.opengl3.gl; ... DerelictGL.load(); DerelictGL.reload(); ======== Note that this also loads all of the same stuff as DerelictGL3, so you don't need to make use of that anywhere.
Feb 28 2018
On Wednesday, 28 February 2018 at 14:02:48 UTC, Mike Parker wrote:On Wednesday, 28 February 2018 at 12:02:27 UTC, Kayomn wrote:Yeah, I knew they were deprecated, just weren't aware Derelict doesn't load them. Thanks though, I'd been up and down the Derelict docs page and I didn't see anything about this.import derelict.opengl3.gl3;Whoa. Just noticed this. That's an older version of DerelictGL3 you're using there. You should really be using the latest version of both DerelictGL3 and DerelictGLFW3. The -alpha versions are what I recommend. They're perfectly fine, despite the -alpha in the version tag. But if you want to continue with the old 1.x version of DerelictGL3, then you can get access to the deprecated stuff by replacing the `gl3` import with `gl` can using `DerelictGL` in place of `DerelictGL3`: ======== import derelict.opengl3.gl; ... DerelictGL.load(); DerelictGL.reload(); ======== Note that this also loads all of the same stuff as DerelictGL3, so you don't need to make use of that anywhere.
Feb 28 2018
On Wednesday, 28 February 2018 at 16:47:49 UTC, Kayomn wrote:Yeah, I knew they were deprecated, just weren't aware Derelict doesn't load them. Thanks though, I'd been up and down the Derelict docs page and I didn't see anything about this.Yeah, I decided against documenting the older version as I don't encourage people to use it. I understand some people will have to, which is why I'll still add bugfixes if necessary, but as soon as is reasonable I'm going to kill it.
Feb 28 2018
On Wednesday, 28 February 2018 at 16:58:38 UTC, Mike Parker wrote:On Wednesday, 28 February 2018 at 16:47:49 UTC, Kayomn wrote:I was originally was only using them to make sure I could render something. When they weren't working however I was wondering if I mis-configured something.Yeah, I knew they were deprecated, just weren't aware Derelict doesn't load them. Thanks though, I'd been up and down the Derelict docs page and I didn't see anything about this.Yeah, I decided against documenting the older version as I don't encourage people to use it. I understand some people will have to, which is why I'll still add bugfixes if necessary, but as soon as is reasonable I'm going to kill it.
Feb 28 2018