Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 10

Thread: VC6.0: PBuffer don't run without Debug-Info

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2004
    Posts
    17

    VC6.0: PBuffer don't run without Debug-Info

    Hello,

    i'am not sure if this question is out of Topic or not.
    I (have to) work with MS Visual C++ 6.0 on a GL Programm with PBuffer. I've a curios Problem.

    If I compile in Debug mode everythig is fine. If i change to Release Mode the Programm starts and terminates without any message.

    If I add in the Debug-Info drop-Down the last entry (dont know how it's named in english), the Programm runs fine again!!! How can this be?

    Have anybody a Poblem like this? Any Ideas?

    Thanks for advice

    Adler

  2. #2
    Junior Member Newbie
    Join Date
    Aug 2002
    Posts
    21

    Re: VC6.0: PBuffer don't run without Debug-Info

    Hi,

    Did you try to display OpenGL's error messages?

    Code :
    	GLenum glErr;
    	int    retCode = 0;
     
    	glErr = glGetError();
    	while (glErr != GL_NO_ERROR) {
    		std::cerr << gluErrorString(glErr) << std::endl;
     
    		retCode = 1;
    		glErr = glGetError();
    	}
    You should look for errors while you are creating the pixel buffer.

    Also, before setting the pixel buffer as the current rendering target, do you check if it is still valid?

    Code :
    	int flag = 0;
    	wglQueryPbufferARB( m_pBuffer, WGL_PBUFFER_LOST_ARB, &amp;flag );
    I hope it helps!

  3. #3
    Intern Contributor
    Join Date
    Jun 2002
    Location
    grenoble, france
    Posts
    94

    Re: VC6.0: PBuffer don't run without Debug-Info

    I've got pbuffers run several times without any problems under VC6, under any compile setting, there must be a problem with your code I guess..
    Would you mind giving further details on how you're actually using pbuffers?

    regards,

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Sep 2000
    Location
    SWEDEN
    Posts
    718

    Re: VC6.0: PBuffer don't run without Debug-Info

    Mopst likely you're relying on an uninitialised variable being zero. When running in debug mode, allocated memory tends to be cleared to zero, which obviously doesn't happen in release. But it is really impossible for us to debug your code for you. Put lots of assert(!glGetError()) among your gl calls and step through the code in a debugger.

  5. #5
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Melbourne,Victoria,Australia
    Posts
    767

    Re: VC6.0: PBuffer don't run without Debug-Info

    harsman is most likely correct, though just relying on assert( !glGetError() ) might miss what is actually causing the problem. It is most likely an uninitialised variable, but it might not be something you use in GL (it might be a string or a pointer or anything really). In Project settings, set the warning level to Level 4 and the compiler might tell you where this is happening.

  6. #6
    Junior Member Newbie
    Join Date
    Oct 2004
    Posts
    17

    Re: VC6.0: PBuffer don't run without Debug-Info

    Hello,

    I tried a lot. I checked on OpenGL Errors, but there
    aren't any. I checked if PBuffers are valid too, but the Programm crashed on first Time Initialisation.

    I found that it crushed in a call to wglChoosePixelFormatARB.

    These are the parameters to wglChoosePixelFormat. The entries are the same in Debug and Release mode

    iAttribs[0] = WGL_DRAW_TO_PBUFFER_ARB;
    iAttribs[1] = 1;
    iAttribs[2] = WGL_PIXEL_TYPE_ARB;
    iAttribs[3] = WGL_TYPE_RGBA_ARB;
    iAttribs[4] = WGL_DOUBLE_BUFFER_ARB;
    iAttribs[5] = 1;
    iAttribs[6] = WGL_SUPPORT_OPENGL_ARB;
    iAttribs[7] = 1;
    iAttribs[8] = WGL_RED_BITS_ARB;
    iAttribs[9] = 2;
    iAttribs[10] = WGL_GREEN_BITS_ARB;
    iAttribs[11] = 2;
    iAttribs[12] = WGL_BLUE_BITS_ARB;
    iAttribs[13] = 2;
    iAttribs[14] = WGL_ALPHA_BITS_ARB;
    iAttribs[15] = 2;
    iAttribs[16] = WGL_COLOR_BITS_ARB;
    iAttribs[17] = 8;
    iAttribs[18] = WGL_BIND_TO_TEXTURE_RGBA_ARB;
    iAttribs[19] = GL_TRUE;
    iAttribs[20-31] = 0;

    fAttribs[0-31] = 0.0f;

    m_hGLDC = wglGetCurrentDC();
    int pixelFormat = 0;
    unsigned int count = 0;

    wglChoosePixelFormatARB(m_hGLDC, iAttribs, fAttribs, 32, &pixelFormat, &count);

    I tried to compile with Warning Level 4 in Release mode, bute there are a lot of Warnings from Windows Header. There are also a lot Warnings from glprocs.h, which i use to Access the Extensions. I've got this from the GLSDK.

    The glprocs Warnings are like this:
    glprocs.c(522) : warning C4054: 'type cast' : From functionpointer 'int (__stdcall *)()' to 'void *'

    Thanks for any advice again

    Adler

  7. #7
    Junior Member Newbie
    Join Date
    Aug 2002
    Posts
    21

    Re: VC6.0: PBuffer don't run without Debug-Info

    Hi,

    I don't get the part
    iAttribs[20-31] = 0;

    fAttribs[0-31] = 0.0f;
    What are those indices in the array? iAttribs[20] = 0 would have been enough. And for fAttribs, simply pass NULL to wglChoosePixelFormatARB instead.

    Also, did you check for the validity of the DC which was returned?

    Cheers!

  8. #8
    Member Regular Contributor
    Join Date
    Feb 2001
    Location
    Montréal, QC, Canada
    Posts
    345

    Re: VC6.0: PBuffer don't run without Debug-Info

    > iAttribs[20-31] = 0;
    which means in fact
    iAttribs[-11] = 0;

    > fAttribs[0-31] = 0.0f;
    which means in fact
    fAttribs[-31] = 0.0f;

    You're writting in some bad memory place.

    I would suggest you you use Paul Neetle's memory manager. It will probably help you find flaws in your code:
    http://www.fluidstudios.com/pub/Flui...ry_Manager.zip

    EDIT: replaced url with a link to the last version

  9. #9
    Junior Member Newbie
    Join Date
    Oct 2004
    Posts
    17

    Re: VC6.0: PBuffer don't run without Debug-Info

    Hmpf.

    Eh sorry about my shortcut with
    iAttrib[20-31] = 0
    That means:
    iAttrib[20] = 0; iAttrib[21]=0 and so on! I wouldn't
    write that down.
    The only reason, that these Fields are set are Modularity of the code, because I can set some
    of the fields I need.

    I will check the DC again. I think that I validate it. If I found my mistake I will post it.

    Thanks for help!

    Adler

  10. #10
    Junior Member Newbie
    Join Date
    Oct 2004
    Posts
    17

    Re: VC6.0: PBuffer don't run without Debug-Info

    Hello everybody

    I found the Problem. I use exeption Handling to
    catch invalid Context of Variables. if a Variable
    is invalid I throw an error and catch it at
    the End of the Function.

    I'am not sure why, but if I do that the Programm
    runs only in Debug mode.

    I remove the try .. catch block and write
    the Messages with cerr directly.

    Now everything works fine. Thanks a lot for your help again

    Adler

Posting Permissions

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