Problem with refresh (freeglut)

This is a discussion on Problem with refresh (freeglut) within the Game Programming forums, part of the General Programming Boards category; i'm doing something like that to create a 3d rendered animation (using C++): Code: #include <freeglut.h> using namespace std; void ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    10

    Problem with refresh (freeglut)

    i'm doing something like that to create a 3d rendered animation (using C++):

    Code:
    #include <freeglut.h>
    using namespace std;
    
    void StartingScene();
    void RefreshScene();
    void MyInit();
    void MyDelete();
    
    int main(int argc, char* argv[])
    {
    	glutInit(&argc,argv);
    	glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
    	glutInitWindowPosition( 30,30 );
    	glutInitWindowSize( 640,480 );
    	glutCreateWindow("Game 1");
    	glutDisplayFunc(StartingScene); 
    	glutIdleFunc ( RefreshScene);
    	MyInit();
    	glutMainLoop();
    	MyDelete();
    	return 0;
    }
    
    
    void StartingScene()
    {
    	//starting scene
    }
    
    void RefreshScene()
    {
     	//refreshing image code
    }
    
    void MyInit()
    {
    	//initialitation of certain classes and variables
    }
    
    void MyDelete()
    {
    	glutIdleFunc (0);
    	//deallocation of dynamics allocations
    }
    but what's happening is that the "scene" is redrawed only if the system calls a "redraw" (so the Scene go on only if i resize the window or if i move that on the screen).

    (The computing of time for some strange reason is done. So if i move the window after 3 sec. i will see my scene but 3 sec later).

    Someone knows a tutorial explaining such func or explain it to me? thanks.

    my StartingScene includes the same code of the RefreshScene.
    So RefreshScene draws the same points, but in different coords. (also do the changing of coords and drawing at the same time)

  2. #2
    Registered User
    Join Date
    Dec 2009
    Posts
    10

    founded

    luckily i found something to answer my question. but probably i'll have new problems.. ^^

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 09:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM
  5. Monitor Refresh Rates
    By SlyMaelstrom in forum Tech Board
    Replies: 4
    Last Post: 05-24-2006, 02:08 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21