Results 1 to 2 of 2

Thread: Pointer in win32 problem

  1. #1
    gommo
    Guest

    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

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Are you sure you call the init function? Try a debugging run of your app, see if it really behaves as you want.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width