Jump to content
xisto Community
Keeper

Opengl And Mfc Dialog Based Application some comments about using it together

Recommended Posts

AS you probably know you can create a simple OpenGL applications using WinAPI functionality only (you can create it using Microsoft Visual Studio), but if you are making somethink with real windows interface and want to create application with multiple windows/dialogs/buttons with Windows Styles etc... you can use MFC (Microsoft Foundation Classes) to do it ...
But i did a 2 hours web search to find example of using OpenGL windows inside MFC created Dialog window.

I found it and want to share my results now.

My application is a simple OpenGL based tool, which shows OpenGL viewport on the Window. In the OpenGL viewport showed plane with reflection of sphere which rotates over it. My project uses 2 textures.

You can download it here :
Source files: http://forums.xisto.com/no_longer_exists/

P.S. This application were created using Andre Stein's "An VC++ example that shows you how to use OpenGL n a Mfc Dialog."
Internet: http://www.steinsoft.net/

By the way i want to ask the question about OpenGL performance...
My application takes 60% of CPU time ... Anybody knows where is problem and how to optimise it?

____________________________________________
Keeper, Sons of the Dragon http://forums.xisto.com/no_longer_exists/

Share this post


Link to post
Share on other sites

I would love to take a look at it, but according to your http://forums.xisto.com/no_longer_exists/ directory, it does not exist on the server.

By the way, why would you want to use MFC with OpenGL anyway? Take a look at the majority of high-quality games out there, most of them don't even touch MFC.

By the way i want to ask the question about OpenGL performance...My application takes 60% of CPU time ... Anybody knows where is problem and how to optimise it?

You are using MFC aren't you? :D Sorry, but that's usually it.

OpenGL performs at the same rate your program (and you) understand video card and CPU interactions, it's all software based stuff. Like all other programs, OpenGL apps have the same limits (except the video card and CPU, of course).

Share this post


Link to post
Share on other sites

Oops i put wrong link to the source code....

Here is right one: http://forums.xisto.com/no_longer_exists/
It was only practical work at the univercity, but i'm interested why the hell it takes so many resources??? It's not great game to count lots of polygons... :P

Anyway take a look and answer me what will be ur CPU time % given to my program...

Best reguards...

____________________________________________
Keeper, Sons of the Dragon http://forums.xisto.com/no_longer_exists/

Share this post


Link to post
Share on other sites

Strange, that -should- work out of the box, no?Anyway, I had to add glaux.lib to the linker's list of libs to include. It uses 99% CPU time. Though, I assume it's just using whatever it can get it's hands onto, if I did a lot of other things, it'd prolly drop down, with no performance loss.And with optimization, as long as you're using MFC, it ain't going to happen. Use pure API calls instead for more power. All I'd say MFC is good for is general apps, and even then I'd still rather not touch them.You'd think that since they're wrapper classes for the Win32 APIs, they'd be easier to use, too... :P

Share this post


Link to post
Share on other sites

To think that I could port the code to Dev-C++ unscathed... well, I tried (I don't have VC++) but it failed, so I couldn't play around with the exe. Can any of you compile this without it?

Share this post


Link to post
Share on other sites

I just tried too, and failed. Although, that's because I'm missing all the MFC libs. As I understand it, the only way for you to be able to use MFC would be to build custom libs for MingW, and since no-one has access to source, it's most likely not going to happen.

Share this post


Link to post
Share on other sites

Iam new to vc++ .While following books and starting for doing programsin 2 ways. First when choosing an MFCAppWizard(exe) and compiling filename.Cpp and build filename.Exe it always gives a error like --------------------Configuration: hello - Win32 Debug--------------------Compiling resources...D:MSDev98hellohello.Rc(11) : fatal error RC1015: cannot open include file 'afxres.H'.Error executing rc.Exe.Hello.Exe - 1 error(s), 0 warning(s)Second,Here I choose Win32 Console application--------------------Configuration: hello1 - Win32 Debug--------------------Compiling...Error spawning cl.ExeHello1.Exe - 1 error(s), 0 warning(s)In both ways the see++ source I wrote is#include <iostream.H>Void main(){ cout<<"Hello...";}Please anybody help me?-Radhiya

Share this post


Link to post
Share on other sites

OpenGL MFC connection

Opengl And Mfc Dialog Based Application

 

Dear,

 

Here I got a problem, I must implementing a kind of software about modeling and Image Processing. I've implemented software that have ability to catch hand movement, especially to drive a ship, so can control the direction of hand movement. When, the right hand is upper then the left hand that indicate s the direction is turn left. And vice versa.

 

Then the second is software about OpenGL, that it is modeling of ship movement, turn left , turn right or just go trough.

 

Both of it was implemented in MFC.

 

My problem is how to connect two software, so when my first software catch the hand's user movement, it can modeling at screen of computer.

Would some body help me??

 

I really appreciate it.

 

Thanks

 

-reply by Sarwo Edi

Share this post


Link to post
Share on other sites
Closing the first dialog box..at the same time opening the second.??Opengl And Mfc Dialog Based ApplicationI have started working with Visual C++ 2008 mfc dialog base application.My first dialog box contains two buttons. When I click on one button, I am supposed to open a second dialog box, at the same time closing the first dialog box.-question by jasmine

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.