Results 1 to 3 of 3

Thread: problem when running program within IDE but works fine outside of the IDE

  1. #1

    problem when running program within IDE but works fine outside of the IDE

    My little program draws a colored point wherever the mouse is clicked and when you want to take a screenshot and make it a tga file you press F2. When I run this from the debug directory it runs as expected with no problems. However, if I run it within the IDE it keeps crashing when it returns to the render routine after the screen has been saved to file. The only difference between this and another tga screenshot program which works fine wherever its run from, is the user interaction so I am assuming that that is the cause.

    I have placed the files on my site at http://programming.swangen.co.uk/ope...ture_creator/.

    Thanks in advance for any help in what could be causing this error. The error actually states it is an unhandled exception in <program: address> : Access Violation.

    Tina
    Learning OpenGL while working on sourceforge projects:
    https://sourceforge.net/projects/simulant/ and
    https://sourceforge.net/projects/projectnova/

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Re: problem when running program within IDE but works fine outside of the IDE

    This often happens, when you donīt release your stuff properly. If you run your program from your directory, this doesnīt matter so much. It also crushes at termination, but you donīt recognise it. However if you start it from your IDE (especially in DEBUG mode), than the IDE might recognise the false termination and therefore you get an error message.
    Look in your code, where you release all your temporary variables, your OpenGL stuff, etc., somewhere has to be an error. You can use your debugger, to find the function, which caused the crash or you could do it the way i often do it: Write a small function, which can write text to a file (for example: ' Log ("Releasing OpenGL"); ') Put such a function everywhere, where you would expect something to be wrong, and hunt the error down, by surrounding it with those function calls.

    Good luck hunting.
    Jan.
    GLIM - Immediate Mode Emulation for GL3

  3. #3

    Re: problem when running program within IDE but works fine outside of the IDE

    Aha, found the problem.. strange why it didn't occur before the screenshot though...

    This section of code caused the problem
    screen = (GLubyte**)malloc(256);
    for (int l=0;l<256;l++)
    {
    screen[l] = (GLubyte*)malloc(256);
    }

    Forgot to specify the size of the variable type.

    screen = (GLubyte**)malloc(sizeof(GLubyte*) * 256);
    for (int l=0;l<256;l++)
    {
    screen[l] = (GLubyte*)malloc(sizeof(GLubyte) * 256);
    }

    Tina
    Learning OpenGL while working on sourceforge projects:
    https://sourceforge.net/projects/simulant/ and
    https://sourceforge.net/projects/projectnova/

Similar Threads

  1. Replies: 1
    Last Post: 04-07-2018, 07:38 PM
  2. 3D model works fine from within VC++, but not in standalone EXE
    By PeterHawkin in forum OpenGL: Windows
    Replies: 4
    Last Post: 09-09-2013, 11:21 AM
  3. Shadow map problem - works fine without shader
    By SiW in forum OpenGL: GLSL
    Replies: 1
    Last Post: 08-14-2006, 02:09 PM
  4. geforce2 98(works fine)change to xp(no opengl)!!!!!!!!
    By Xzaver in forum OpenGL: User Software
    Replies: 4
    Last Post: 01-27-2003, 10:34 PM
  5. Replies: 1
    Last Post: 03-28-2001, 07:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean