Jump to content
  • Advertisement
Sign in to follow this  
archanfel

OpenGL Memory Leak in OpenGL Tutorial

This topic is 4439 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, there. Have any of you ever compile the tutorial code in VS 2005? I just tried lesson 1 and lesson 2, It seems to have a small memory leak every time the window refreshes. But there isn't anything wrong in the rendering loop, though. Later I found out the memory keeps increasing upto a certain size, then stops increasing. [Edited by - archanfel on June 26, 2006 5:43:17 PM]

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Quote:
Have any of you ever compile the tutorial code in VS 2005?

I just tried lesson 1 and lesson 2...

Which tutorials are you referring to?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It will be the aux file then glaux.h
which is used for loading bitmaps, there is another header which is on the site for loading bitmaps use that instead if you are worried.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
NOTE #2: When the first tutorials were written, GLAUX was the way to go. Over time GLAUX lost support. Many of the tutorials on this site still use the old GLAUX code. If your compiler does not support GLAUX or you would rather not use it, download the GLAUX REPLACEMENT CODE from the main page (left menu).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by archanfel
Have any of you ever compile the tutorial code in VS 2005?

No

Quote:
Original post by archanfel
I just tried lesson 1 and lesson 2,
It seems to have a small memory leak every time the window refreshes.
But there isn't anything wrong in the rendering loop, though.

I'm not surprised. A lot of the nehe stuff is pretty badly written.

Good thing it's just a tutorial eh? it'd be a real problem if the leak was in some real game code.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Quote:
NOTE #2: When the first tutorials were written, GLAUX was the way to go. Over time GLAUX lost support. Many of the tutorials on this site still use the old GLAUX code. If your compiler does not support GLAUX or you would rather not use it, download the GLAUX REPLACEMENT CODE from the main page (left menu).


Share this post


Link to post
Share on other sites
I've excluded GLAUX.
and I am commenting out all the code in the drawing function as well.
and also I check carefully to make sure no dynamic memory allocation in the rendering loop.
and the memory leak is still there.

Anyone have a better idea what it may be?

Share this post


Link to post
Share on other sites
Quote:
I've excluded GLAUX.
and I am commenting out all the code in the drawing function as well.
and also I check carefully to make sure no dynamic memory allocation in the rendering loop.
and the memory leak is still there.

Can you post this version of your program, so we can take a look at it?

Share this post


Link to post
Share on other sites
It is too messy to post the entire code.

so this is the message loop:
while(!done) // Loop That Runs While done=FALSE
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting?
{
if (msg.message==WM_QUIT) // Have We Received A Quit Message?
{
done=TRUE; // If So done=TRUE
}
else // If Not, Deal With Window Messages
{
TranslateMessage(&msg); // Translate The Message
DispatchMessage(&msg); // Dispatch The Message
}
}
else // If There Are No Messages
{
// Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene()
if (active) // Program Active?
{
if (keys[VK_ESCAPE]) // Was ESC Pressed?
{
done=TRUE; // ESC Signalled A Quit
}
else // Not Time To Quit, Update Screen
{
DrawGLScene(); // Draw The Scene
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
}
}

if (keys[VK_F1]) // Is F1 Being Pressed?
{
keys[VK_F1]=FALSE; // If So Make Key FALSE
KillGLWindow(); // Kill Our Current Window
fullscreen=!fullscreen; // Toggle Fullscreen / Windowed Mode
// Recreate Our OpenGL Window
if (!CreateGLWindow("NeHe's OpenGL Framework",640,480,16,fullscreen))
{
return 0; // Quit If Window Was Not Created
}
}
}
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!