Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Dialog-based Interface

  1. #1

    Dialog-based Interface

    Here's my current dilemna. I have a dialog-based interface built in MFC using MSVC. In this interface, I have many buttons/text fields/etc. I have a small window in the interface that I would like to display 3-dimensional opengl scene. I can't figure out how to get the damned opengl view to display it's graphics, though. When I put breakpoints in my code in the rendering section, and then step through it, I can see the opengl scene I have built. Whenever I just run the program, though, I just get a blank spot where the opengl should be. Any suggestions are appreciated. If you post a link, please tell me what you're linking.

    Thanks,
    Joel
    Get back here, so that I may brain thee!

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,576

    Re: Dialog-based Interface

    Three questions:

    1) Have you verified that these OpenGL functions work outside of the dialong? Try using that CWnd as the main window of an application to see if the drawing functions are actually doing what they should. Or, try using glClearColor to change the color of the display to at least see if anything is being displayed by OpenGL.

    2) Are you sure your initialization code is working properly? Are you getting a valid pixel format?

    3) How do you go about putting that window in the dialog box?

  3. #3

    Re: Dialog-based Interface

    1. The same opengl code works in another application. glClearColor does nothing when I'm not stepping through the program in the debugger.

    2. I'm not sure how to do this.

    3. The opengl window is placed inside a static text window and I use GetDlgItem to get the CStatic pointer which I pass to the constructor of the object that handles all the opengl stuff.

    Currently, the dialog shows the first frame of my opengl test animation when I run it. I have a button that calls the OnPaint() method of my CDialog-derived window, which when pressed, does update the opengl view. So what I need to know is a way to force the update continuously.

    Thanks,
    Joel
    Get back here, so that I may brain thee!

  4. #4
    Intern Contributor
    Join Date
    Mar 2000
    Location
    PA, USA
    Posts
    70

    Re: Dialog-based Interface

    You said that you see the first frame of your animation in the static text window...does it stay there? Or, does it disappear immediately?

    Normally, when using OpenGL with a Windows window, you need to override the behavior of the OnEraseBackground handler to do nothing. The default behavior is that the window is cleared using GDI. The result is that your OpenGL-rendered scene is quickly overwritten by the GDI background clear. You would see a lot of flickering. There are many ways to overcome this. Since I'm not certain that this is your issue, I won't go into that yet.

    Also, if you want the animation to automatically increment through the frames, set a timer on the window to cause the animation to go forward.

  5. #5
    Junior Member Newbie
    Join Date
    Jan 2001
    Location
    london ont canada
    Posts
    25

    Re: Dialog-based Interface

    another possibility may be to set the clibsiblings and clipchildren styles in the dialog properties. since opengl requires these styles in a windowed application, i can't see any reason why a dialog-based app wouldn't either.

  6. #6

    Re: Dialog-based Interface

    Well, as of yesterday around 16:30 CST, I got OpenGL working in my interface. Thanks for your help everybody.
    Get back here, so that I may brain thee!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •