Results 1 to 2 of 2

Thread: No object drawn in 2nd window

  1. #1
    Guest

    No object drawn in 2nd window

    main()
    {
    ......
    a=window 1;
    .....
    b=window2;
    set a;
    draw()
    .....
    set b
    draw();
    .....
    }

    draw()
    {
    ......
    }


    my code is something like that.
    I uesd the same draw function in both the windows( both the window has different view points)

    object is drawn in the 1st one but not the second. fuction call works perfectly(checked it with a "draw" line apart from the object. line was drawn but not the object.)


    related
    while doing a different task I tried to calll the draw function second time in one window(kinda redrawing the object). nothing drawn in the window.(rest of them-function call, control transfers work perfectly)

    my questions are
    1. how to get the object in the second window
    2. can i use the same drawing function in different windows
    3. if i use glutPostRedisplay() what are the things will be updated in main program and screen(ex. which functions will be called, what variables are updated etc.)

    Many Thanks
    Mil

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: No object drawn in 2nd window

    I wrote a little dual windows program in glut yet to post it on my website.

    But I am guessing you have not set you window to be drawn to correctly.


    Yes, you can have both windows share functions.

    Here is how you have to setup each window, if you would like a copy of the full working source code drop me an e-mail, make sure "openGL forum" is in the subject line else it may get deleted as spam.

    Code :
    // Main program
    int main(int argc, char** argv)
    {
       glutInit(&argc, argv);
       glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
       glutTimerFunc( 10, TimeEvent, 1);
       glutInitWindowSize (500, 500);
       glutInitWindowPosition (10, 10);
       window_1 = glutCreateWindow (argv[0]);
       glutSetWindowTitle("GlutWindow 1");
       glutDisplayFunc(display_1);
       glutReshapeFunc(reshape_1);
       glutKeyboardFunc(keyboard);
       glutPassiveMotionFunc( entry_1 );
       init ();
       window_2 = glutCreateWindow (argv[0]);
       glutSetWindowTitle("GlutWindow 2");
       glutPassiveMotionFunc( entry_2 );
       glutDisplayFunc(display_2);
       glutReshapeFunc(reshape_2);
       init ();
       glutMainLoop();
       return 0;
    }

Similar Threads

  1. OpenGl window appears but nothing drawn, need help please
    By aliouchka in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 04-05-2016, 06:54 PM
  2. Background object drawn in foreground. How to correct?
    By Ravenik in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-03-2014, 09:21 AM
  3. Win7 driver problem--nothing drawn in the window.
    By muvee in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 08-27-2009, 02:41 AM
  4. gluLookAt() function to rotate around drawn object
    By glSpider in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 04-02-2009, 10:55 AM
  5. Replies: 2
    Last Post: 01-12-2007, 08:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean