Results 1 to 7 of 7

Thread: how to display a second picture in a delayed time

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2012
    Posts
    2

    how to display a second picture in a delayed time

    Hi,


    I need to develop an application which do the following:


    1. The program will read in an image from disk and display it.
    2. The program will process the image.
    3. The program will also display the the processed the image.


    In step 2 and step 3, I also need the original image being
    displayed until the user close the image window or close the
    application.

    The problem is that, if I use glutmainloop() to display the
    first picture, the program keep trapped with the loop and do
    not proceed to process the image; while If I put the glutmainloop() after I processed the image, it violates my purpose since the I cannt got the image be displayed before
    it was being processed.


    In one words: I need a method to display an image (and keep
    the window open) while proceed to process this image and then displayed the processed image in a second window.

    Could anyone just tell me how can I do this?

    Thanks a lot.



  2. #2
    Senior Member Regular Contributor Kopelrativ's Avatar
    Join Date
    Apr 2011
    Posts
    214

    Re: how to display a second picture in a delayed time

    I usually use glfw instead of glut. It gives you all the control over the main loop.

    Of course, there are solutions for glut also.

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2012
    Posts
    2

    Re: how to display a second picture in a delayed time

    I am learning glfw, but stil dont know how.

    Could you tell me how to keeping displaying an image while
    proceed?

  4. #4
    Senior Member Regular Contributor
    Join Date
    Jun 2009
    Location
    FL , USA
    Posts
    192

    Re: how to display a second picture in a delayed time

    Just to give you a direction, create multiple forms - i.e if you are working on Windows MFC or Win Forms. Then each form has a device context. Create multiple graphics context and attach them to different device contexts. This will chanellize your graphics data to different forms. You can refer to wgl*() functions (wglCreateContext)that talk about making a graphics context etc.

    In short you will have two graphic contexts. Make one of them the current one using wglSetCurrentContext() where you will render your image. Then when you are ready for processing, create another graphic context and make that current one.

  5. #5
    Senior Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Karachi, Pakistan
    Posts
    810

    Re: how to display a second picture in a delayed time

    I dont think you need two context here, use a single context. For displaying image, just display it normally. For processing image, you can either attach a timer callback (glutTimerFunc) and do processing it it or you can do the processing in the idle callback function (glutIdleFunc).
    For displaying both images, just render the processed image at an offset from the original image.
    Regards,
    Mobeen

  6. #6
    Senior Member Regular Contributor
    Join Date
    Jun 2009
    Location
    FL , USA
    Posts
    192

    Re: how to display a second picture in a delayed time

    I had thought of that option but following is required:

    In one words: I need a method to display an image (and keep
    the window open) while proceed to process this image and then displayed the processed image in a second window.
    Two windows are needed here.

  7. #7
    Senior Member Regular Contributor Kopelrativ's Avatar
    Join Date
    Apr 2011
    Posts
    214

    Re: how to display a second picture in a delayed time

    So you have two images, but you can still show them in the same window, side by side? That would be easier.

    Then you need no timers. When the second image is available, you simply assign it to the other texture.

Similar Threads

  1. glutBitmapCharacter delayed display
    By newbie1002 in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 10-02-2011, 02:56 PM
  2. display the current time
    By David22 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-04-2009, 10:18 AM
  3. Time of display
    By farshizzo in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-19-2006, 09:15 AM
  4. delayed display
    By Dynamyte in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-26-2004, 11:59 AM
  5. Can I display 2 or more windows at a time?
    By songeb in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 02-19-2002, 11:35 PM

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