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 9221937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:41:44+00:00 2026-06-18T03:41:44+00:00

I am using freeglut, windows 8, vs2012 and the newest nvidia driver. But the

  • 0

I am using freeglut, windows 8, vs2012 and the newest nvidia driver. But the glut idle functions has a weird behavior. It does nothing until I resize the window or click on the window.

Or somehow glut doesn’t want to rerender the screen, even if some variables have changed.

#include <iostream>
#include <stdlib.h>
#include <GL/glut.h>

using namespace std;


GLfloat rotateQuad = 0;



void initRendering() {


    glEnable(GL_DEPTH_TEST);

}

//Called when the window is resized

void handleResize(int w, int h) {

    //Tell OpenGL how to convert from coordinates to pixel values

    glViewport(0, 0, w, h);



}

//Draws the 3D scene

void drawScene() {

    //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

    glRotatef(rotateQuad,0,0,1);

    glBegin(GL_QUADS); //Begin quadrilateral coordinates



    glVertex3f(-0.5f, -0.5f, 0.0f);

    glVertex3f(0.5f, -0.5f, 0.0f);

    glVertex3f(0.5f, 0.5f, 0.0f);

    glVertex3f(-0.5f, 0.5f, 0.0f);

    glEnd(); //End quadrilateral coordinates


    glutSwapBuffers(); //Send the 3D scene to the screen

}
void idle(){
    rotateQuad+=1;
    if(rotateQuad > 360) rotateQuad=0;
}
int main(int argc, char** argv) {

    //Initialize GLUT

    glutInit(&argc, argv);

    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

    glutInitWindowSize(400, 400); //Set the window size

    //Create the window

    glutCreateWindow("Quad Rotate");

    initRendering(); //Initialize rendering

    glutIdleFunc(idle);

    glutDisplayFunc(drawScene);

    glutReshapeFunc(handleResize);

    glutMainLoop(); //Start the main loop

    return 0;

}

Any ideas what went wrong?

  • 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-18T03:41:46+00:00Added an answer on June 18, 2026 at 3:41 am

    Your idle function just updates the rotation; it’s not actually asking GLUT to repaint, so no repaints are happening until something else triggers it (such as a window interaction or resize). Call glutPostRedisplay in your idle function. See: http://www.lighthouse3d.com/tutorials/glut-tutorial/glutpostredisplay-vs-idle-func/

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

Sidebar

Related Questions

How to make the Haskell GLUT binding using freeglut instead of the original GLUT
I'm trying to make the windows cursor stay inside my window. I'm using freeglut
I've started using OpenGL a while ago, using GLUT. You can't pass member functions
Im having an issue using GLUT with monodevelop. Im using the following code: #include
I'm using GLUT (freeglut3) (via the Haskell GLUT bindings). import Graphics.UI.GLUT handleKBMouse :: KeyboardMouseCallback
I have written some effects in C++ (g++) using freeglut on Linux, and I
I'm involved in a development project that is using freeglut (based on the long
Using C++ preprocessor directives, is it possible to test if a preprocessor symbol has
#include<iostream> #includeGlew\glew.h #includefreeGlut\freeglut.h using namespace std; int main(int argc, char* argv[]) { GLint ExtensionCount;
I'm using MSVC++ and freeglut in order to use openGL. Now, I have a

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.