Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8371331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:08:08+00:00 2026-06-09T14:08:08+00:00

I am new to GLFW and made a simple texture mapping program. Problem is

  • 0

I am new to GLFW and made a simple texture mapping program. Problem is while running the program the memory resource increases non stop which I can see clearly in taskmanager.

After running the program for a few minutes, my computer’s fan speeds up and a heating problem occurs. How can I fix this problem?

Here is code for texture loading function

GLuint LoadTexture(const char* TextureName)
{
    GLuint Texture;  //variable for texture
    glGenTextures(1,&Texture); //allocate the memory for texture
    glBindTexture(GL_TEXTURE_2D,Texture); //Binding the texture

    if(glfwLoadTexture2D(TextureName, GLFW_BUILD_MIPMAPS_BIT)){
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
        return Texture;
    }else return -1;
}

Here is code for draw function

void display()
{
    glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); //clear background screen to black

    //Clear information from last draw
    glClear( GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);

    glMatrixMode(GL_MODELVIEW); //Switch to the drawing perspective
    glLoadIdentity(); //Reset the drawing perspective

    glTranslatef(0.0f,0.0f,-35.0f); //Translate whole scene to -ve z-axis by -35 unit


    GLuint text2D;
    text2D = LoadTexture("cicb.tga"); //loading image for texture

    glEnable(GL_TEXTURE_2D); //Enable texture
    glBindTexture(GL_TEXTURE_2D,text2D);//Binding texture

    glPushMatrix();
    glBegin(GL_POLYGON); //Begin quadrilateral coordinates
    glNormal3f(0.0f, 0.0f, 1.0f);//normal vector
    glTexCoord2f(0.0f, 0.0f); //Texture co-ordinate origin or  lower left corner
    glVertex3f(-10.0f,-11.0f,5.0f);
    glTexCoord2f(1.0f, 0.0f); //Texture co-ordinate lower right corner
    glVertex3f(10.0f,-11.0f,5.0f);
    glTexCoord2f(1.0f, 1.0f);//Texture co-ordinate top right corner
    glVertex3f(10.0f,-1.0f,-15.0f);
    glTexCoord2f(0.0f, 1.0f);//Texture co-ordinate top left corner
    glVertex3f(-10.0f,-1.0f,-15.0f);

    glEnd(); //End quadrilateral coordinates
    glPopMatrix();
    glDisable(GL_TEXTURE_2D);


    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D,text2D);
    glPushMatrix();

    glBegin(GL_POLYGON);
    glNormal3f(0.0f, 0.0f, 1.0f);
    glTexCoord2f(0.0f, 0.0f);//Texture co-ordinate origin or lower left corner
    glVertex3f(-10.0f,-1.0f,-15.0f);
    glTexCoord2f(10.0f, 0.0f); //Texture co-ordinate for repeating image ten times form
    //origin to lower right corner
    glVertex3f(10.0f,-1.0f,-15.0f);
    glTexCoord2f(10.0f, 10.0f);//repeat texture ten times form lower to top right corner.
    glVertex3f(10.0f,15.0f,-15.0f);
    glTexCoord2f(0.0f, 10.0f);//repeat texture ten time form top right to top left corner.
    glVertex3f(-10.0f,15.0f,-15.0f);
    glEnd();
    glPopMatrix();
    glDisable(GL_TEXTURE_2D); //Disable the texture
    glfwSwapBuffers();

}

If anyone want to see the problem by running exe then I can provide download link.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:08:10+00:00Added an answer on June 9, 2026 at 2:08 pm

    You seem to be loading your texture each time you call display(). (Once per frame in essence) I assume that is what is taking all your memory at some point. You just want to do this once outside of your display function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

new to c#. I'm trying to make a simple system where I can search
NEW EDIT: I have narrowed my problem to this - i have a view
I am trying to load and draw a 2d texture using OpenGL with GLFW
New to Tomcat and running Tomcat 7 in an Eclipse environment. I followed a
New to StackOverflow here. I'm working on the first Euler problem and have run
New to this community... I have to say I love this resource though, it's
New to Java, and can't figure out what I hope to be a simple
new to python. This is probably simple but I haven't found an answer. rndStr
New to iPhone app development, I have a problem compiling (or Build and Run)
new on ruby and using windows xp and rails 3, i want to send

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.