-
Pointer in win32 problem
I've written a 3d Point class and tested it from a console app in visual studio .net.
I have now started a blank windows app and written openGL commands to clear the screen and setup openGL etc..
However, now when I use my 3dpoint class to store float points for use with openGL drawing commands I get
Unhandled exception at 0x00412f3d in CitrisEngine.exe: 0xC0000005: Access violation reading location 0x00000008.
I have declared 3 pointers at the beginning of my main.cpp file
CSEPoint3* point1; etc..
then instantiated them in an init() function
point1 = new CSEPoint3(1.0f,1.0f,1.0f);
etc..
and then I call
glVertex3f(point1->x,point1->y,point1->z);
inside GLBEGIN() etc..
And I get these errors??
What am I doing wrong with the pointers.. When I do basically the same thing from a console app and output the point1->x etc.. to the std::cout it works fine.
What could be causing it from a win32 app.
Also, I used direct variables like CSEPoint3 point1;
point1.x and it worked fine. So its something with instantiating my class??
\Thanks anyway
-
Are you sure you call the init function? Try a debugging run of your app, see if it really behaves as you want.