Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Opengl And Mfc Dialog Based Application, some comments about using it together
Keeper
post Jun 4 2005, 08:24 PM
Post #1


Advanced Member
*******

Group: Members
Posts: 143
Joined: 30-January 05
Member No.: 3,507



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://mechwarrior.nm.ru/files/opengl.rar

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://mercenaries.net.ru

Go to the top of the page
 
+Quote Post
osknockout
post Jun 4 2005, 10:18 PM
Post #2


Super Member
*********

Group: Members
Posts: 397
Joined: 14-November 04
From: Elysium
Member No.: 2,280



I would love to take a look at it, but according to your http://mechwarrior.nm.ru/files/ 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.
QUOTE
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? laugh.gif 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).
Go to the top of the page
 
+Quote Post
Keeper
post Jun 7 2005, 07:28 AM
Post #3


Advanced Member
*******

Group: Members
Posts: 143
Joined: 30-January 05
Member No.: 3,507



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

Here is right one: http://mechwarrior.nm.ru/opengl.rar
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... blink.gif

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://mercenaries.net.ru
Go to the top of the page
 
+Quote Post
dexter
post Jun 7 2005, 10:33 AM
Post #4


Advanced Member
*******

Group: Members
Posts: 142
Joined: 24-December 04
From: Queensland, Australia
Member No.: 2,902



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... tongue.gif
Go to the top of the page
 
+Quote Post
osknockout
post Jun 8 2005, 12:29 PM
Post #5


Super Member
*********

Group: Members
Posts: 397
Joined: 14-November 04
From: Elysium
Member No.: 2,280



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?
Go to the top of the page
 
+Quote Post
dexter
post Jun 9 2005, 02:43 AM
Post #6


Advanced Member
*******

Group: Members
Posts: 142
Joined: 24-December 04
From: Queensland, Australia
Member No.: 2,902



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.
Go to the top of the page
 
+Quote Post
iGuest
post Dec 27 2007, 05:51 PM
Post #7


Trap Double Mocha Member
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



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:\MSDev98\hello\hello.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.Exe

Hello1.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
Go to the top of the page
 
+Quote Post
iGuest
post Jul 3 2008, 07:02 AM
Post #8


Trap Double Mocha Member
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



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
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Program Flow(2)
  2. Opengl Pointer To Array(1)
  3. Win32: Dialog Box And Accelerator(0)
  4. Opengl(1)
  5. Detailed C Beginner Tut(2)
  6. Opengl(2)