www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Derelict3 object.Error (0): Access Violation?

reply Alexander <awpatapoff gmail.com> writes:
import std.stdio;

import derelict.opengl3.gl3;

import derelict.sdl2.sdl;

pragma(lib, "DerelictUtil.lib");

pragma(lib, "DerelictGL3.lib");

pragma(lib, "derelictSDL2.lib");

void main(){

  	DerelictGL3.load();
	DerelictGL3.reload();
  //DerelictSDL2.load();



  writeln("Fred is nigh on impossible to

configure");

}

this is all the code I have, and I get an object.Error (0): 
Access Violation.
I have looked all over the internet and I am unable to find a fix 
for this.
Any ideas on how to fix this or what is the cause?
Nov 26 2015
next sibling parent reply Rikki Cattermole <alphaglosined gmail.com> writes:
On 27/11/15 8:48 PM, Alexander wrote:
 import std.stdio;

 import derelict.opengl3.gl3;

 import derelict.sdl2.sdl;

 pragma(lib, "DerelictUtil.lib");

 pragma(lib, "DerelictGL3.lib");

 pragma(lib, "derelictSDL2.lib");

 void main(){

       DerelictGL3.load();
      DerelictGL3.reload();
   //DerelictSDL2.load();



   writeln("Fred is nigh on impossible to

 configure");

 }

 this is all the code I have, and I get an object.Error (0): Access
 Violation.
 I have looked all over the internet and I am unable to find a fix for this.
 Any ideas on how to fix this or what is the cause?
When you activate an OpenGL context you reload it. You do not do this when one is not activated.
Nov 26 2015
next sibling parent reply Alexander <awpatapoff gmail.com> writes:
On Friday, 27 November 2015 at 07:53:09 UTC, Rikki Cattermole 
wrote:
 On 27/11/15 8:48 PM, Alexander wrote:
 import std.stdio;

 import derelict.opengl3.gl3;

 import derelict.sdl2.sdl;

 pragma(lib, "DerelictUtil.lib");

 pragma(lib, "DerelictGL3.lib");

 pragma(lib, "derelictSDL2.lib");

 void main(){

       DerelictGL3.load();
      DerelictGL3.reload();
   //DerelictSDL2.load();



   writeln("Fred is nigh on impossible to

 configure");

 }

 this is all the code I have, and I get an object.Error (0): 
 Access
 Violation.
 I have looked all over the internet and I am unable to find a 
 fix for this.
 Any ideas on how to fix this or what is the cause?
When you activate an OpenGL context you reload it. You do not do this when one is not activated.
import derelict.opengl3.gl3; import derelict.glfw3.glfw3; import buffer, shader; pragma(lib, "DerelictGLFW3"); pragma(lib, "DerelictGL3"); pragma(lib, "DerelictUtil"); pragma(lib, "dl"); int main() { DerelictGL3.load(); DerelictGLFW3.load(); GLFWwindow* window; if (!glfwInit()) return -1; window = glfwCreateWindow(640, 480, "Hello World", null, null); if (!window) { glfwTerminate(); return -1; } /* Make the window's context current */ glfwMakeContextCurrent(window); DerelictGL3.reload(); while (!glfwWindowShouldClose(window)) { glfwSwapBuffers(window); glfwPollEvents(); } glfwTerminate(); return 0; } Ah ok! so here's my updated code. I still get the object error. I am trying to get a blank window to appear. I call the reload after I set the glfwcontext. I'm not sure what I'm missing here.
Nov 27 2015
parent reply Mike Parker <aldacron gmail.com> writes:
On Friday, 27 November 2015 at 09:24:47 UTC, Alexander wrote:
 On Friday, 27 November 2015 at 07:53:09 UTC, Rikki Cattermole
 Ah ok!
 so here's my updated code. I still get the object error. I am 
 trying to get a  blank window to appear. I call the reload 
 after I set the glfwcontext. I'm not sure what I'm missing here.
There's nothing obvious that jumps out. You really should not have been seeing an access violation with the first bit of code you posted if the problem were simply that no context were loaded. I suggest you try again with just a simple call to DerelictGL3.load and see if you still get the error. If so, see if you can run a hello world.
Nov 27 2015
parent Alexander <awpatapoff gmail.com> writes:
On Friday, 27 November 2015 at 16:26:44 UTC, Mike Parker wrote:
 On Friday, 27 November 2015 at 09:24:47 UTC, Alexander wrote:
 On Friday, 27 November 2015 at 07:53:09 UTC, Rikki Cattermole
 Ah ok!
 so here's my updated code. I still get the object error. I am 
 trying to get a  blank window to appear. I call the reload 
 after I set the glfwcontext. I'm not sure what I'm missing 
 here.
There's nothing obvious that jumps out. You really should not have been seeing an access violation with the first bit of code you posted if the problem were simply that no context were loaded. I suggest you try again with just a simple call to DerelictGL3.load and see if you still get the error. If so, see if you can run a hello world.
I managed to get it working. I couldn't do a writeln command because I was getting that same error. I created a new project and that fixed the problem. :) thanks for the help!
Nov 27 2015
prev sibling parent reply Mike Parker <aldacron gmail.com> writes:
On Friday, 27 November 2015 at 07:53:09 UTC, Rikki Cattermole 
wrote:

 When you activate an OpenGL context you reload it. You do not 
 do this when one is not activated.
Doing so shouldn't cause an access violation, though. It would be throwing a DerelictException saying that no context has been loaded yet.
Nov 27 2015
parent Mike Parker <aldacron gmail.com> writes:
On Friday, 27 November 2015 at 16:20:47 UTC, Mike Parker wrote:
 On Friday, 27 November 2015 at 07:53:09 UTC, Rikki Cattermole 
 wrote:

 When you activate an OpenGL context you reload it. You do not 
 do this when one is not activated.
Doing so shouldn't cause an access violation, though. It would be throwing a DerelictException saying that no context has been loaded yet.
I meant to say, failure to do so.
Nov 27 2015
prev sibling parent Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Friday, 27 November 2015 at 07:48:15 UTC, Alexander wrote:
 import std.stdio;

 import derelict.opengl3.gl3;

 import derelict.sdl2.sdl;

 pragma(lib, "DerelictUtil.lib");

 pragma(lib, "DerelictGL3.lib");

 pragma(lib, "derelictSDL2.lib");

 void main(){

  	DerelictGL3.load();
 	DerelictGL3.reload();
  //DerelictSDL2.load();



  writeln("Fred is nigh on impossible to

 configure");

 }

 this is all the code I have, and I get an object.Error (0): 
 Access Violation.
 I have looked all over the internet and I am unable to find a 
 fix for this.
 Any ideas on how to fix this or what is the cause?
the Error (0) is almost always a null pointer dereference. Why that would be occurring for just attempting to load the libs i'm not sure.
Nov 27 2015