Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Okay I am new to OpenGL I am getting an odd issue. I am performing rotation on a bunch of triangles on a scene graph.

The rotation starts off really smooth everything is animating then much later you notice that the rendering starts flickering when you progress through time.

I have double buffering enabled with GLFW 2.7 any window apparently has double buffering, and I have GL Depth Testing enabled as well.

Edit and Update: The get time returns 0.028 - 0.019 when I remove the miliseconds update from the update code it basically does not have a flickering issue. Why is this ? Anyone know ? timer code looks like this

    using namespace ModernGLToolKit;
    startTime = glfwGetTime();

    float Timer::getTime()
    float time;
    endTime = glfwGetTime();
    time = endTime - startTime;
    startTime = endTime;
    return time;
// Main loop
int angle = 1;
int angle2 = 1;
while( isRunning && mRenderEngine->isRunning() )
    angle = (angle + 1) % 360;
    angle2 = (angle + 4) % 360;


    mSceneGraphRootNode->setRotation(glm::rotate(glm::mat4(1.0),(glm::mediump_float)angle, glm::vec3(1.0,1.0,0.0)));

    mChildTwo->setRotation(glm::rotate(glm::mat4(1.0),(glm::mediump_float)angle, glm::vec3(1.0,0.0,0.0)));
    mChildOne->setRotation(glm::rotate(glm::mat4(1.0),(glm::mediump_float)angle, glm::vec3(1.0,0.0,1.0)));





    // Check if ESC key was pressed or window was closed
    isRunning = !glfwGetKey( GLFW_KEY_ESC ) && glfwGetWindowParam( GLFW_OPENED );

A Scene node is where the the mesh gets transformed and handles the transformations

setting rotation looks like this

    SceneNode::setRotation(glm::mat4 rotation)
    mRotation = rotation;

    const glm::mat4&
     mTransform = mTranslation * mRotation * mScale;
     return mTransform;

Scene graph update looks like this.

SceneNode::Update(float miliseconds)
if (mParent != NULL)
    mWorldTransform = mParent->getWorldTransform() * getTransform() * miliseconds;
    mWorldTransform = getTransform() * miliseconds;
for (std::vector<SceneNode *>::const_iterator i = getChildIterBegin();i !=    getChildIterEnd();i++)

Can anyone help I think it could have to do with the timing I am going to test it out.

share|improve this question
Okay it was the timer I think its causing issues with the rotation matrix and possibly creeping errors? –  user31044 May 22 '13 at 23:03
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.