Discussion:
MFC & OpenGL
(too old to reply)
Jessica Weiner
2006-02-25 00:43:54 UTC
Permalink
I want to create a splitter window using MFC that shows a opengl scene and a
toolbox on the side. To give you an idea, here is what I need:
Loading Image...

Right now, I can render the opengl scene in its own window without problems
but when I put it inside a splitter window, it crashes my program.

Here's how I am adding the opengl cview class into the splitter window:

m_pwndSplitter->CreateView(1,0,m_pThirdView ,m_ThirdViewSize,m_pContext)

Thanks.
Jess
Wolfgang Draxinger
2006-02-25 01:08:45 UTC
Permalink
Post by Jessica Weiner
I want to create a splitter window using MFC that shows a
You should know, that even Microsoft has depreciated MFC and
advices developers not to start any new projects with MFC.

The MFC are IMHO a huge pile of ****, if you look inside the code
(which comes with the Professional and Enterprise Versions of
VC++) you sometimes get scared.
Post by Jessica Weiner
Right now, I can render the opengl scene in its own window
without problems but when I put it inside a splitter window, it
crashes my program.
No wonder if you look at the way how MFC implements splitters.
The problem is, that a MFC Splitter is a weird combination of 4
windows all sharing the same DC. The first window is the one
that contains the splitter and the 2 panes, then the splitter
gets it's own window and the other 2 are passed over to you. Now
to get OpenGL working inside such a pane you must get it it's
own DC, which means: You need to create a new window class,
register it, and create a subwindow within the pane using that
window class.

Anyway OpenGL in subwindows is always a bit of a nightmare, even
without screwed up toolkits.

Wolfgang Draxinger
--
Elaine
2006-02-25 14:31:31 UTC
Permalink
Sounds like you had some sort of a bad experience with MFC at some point.

Microsoft was pushing managed code and the new Windows Forms for .Net.
However, people have complained that the Windows Forms approach does not
provide a full framework for a standalone application.

MFC is an excellent development environment, I have used it for many
projects. Its rock solid, reliable and very easy to use to generate GUI.
MFC provides a large number of fundamental classes to support a broad range
of development tasks. It is also extremely easy to debug since Microsoft
provides all of the source code with the compiler. Because of the full
access to the source, MFC is 10 times easier than VB to debug.

Far from deprecating MFC, Microsoft plans to continue to support it as a
very active component. According to the following Microsoft web page,
Microsoft has made substantial investment in MFC for Visual Studio 2005.

http://msdn.microsoft.com/visualc/whidbey/mfc2005/default.aspx

MFC: Visual Studio 2005 and Beyond

Steve Teixeira
Microsoft Corporation

June 2005


The Microsoft Foundation Class (MFC) Library continues to be the most
popular C++ application framework in use today. Thousands of independent
software vendors (ISVs) and IT departments continue to invest heavily in
MFC, both for existing code and for new projects. Microsoft is committed to
ensuring MFC remains a competitive and viable application framework and MFC
developers are equipped to take advantage of new platform technologies.

MFC in Visual Studio 2005
Microsoft has made some key investments in the MFC Library for Visual Studio
2005, particularly in the areas of reliability, security, and .NET
integration. .NET integration enables MFC applications to leverage the power
and productivity of the .NET platform as a natural extension of MFC. The
reliability and security enhancements in MFC make for a more productive
development process with fewer end-user issues, and existing MFC
applications can take advantage of these enhancements with little more than
a simple recompile in many cases.

.NET Integration
Visual Studio 2005 fully supports the use of the .NET framework from within
any MFC application. Visual C++ makes .NET more accessible from native code
than ever before, allowing developers to combine native and managed modules
in a single executable and to seamlessly call between the two. In addition
to the ease of access to .NET code and APIs from MFC applications, the MFC
Library also supports hosting of WinForms controls and forms from within MFC
applications. This enables MFC developers to leverage the rich component
model and design-time support for WinForms without compromising existing
investment in MFC.

Security
One of the major themes of Visual C++ 2005 is enhanced security features
that make it easy for developers to eliminate potential points of
vulnerability and reduce the overall surface area exposed to attackers. This
enhanced security starts in the compiler, which generates special code to
guard against a variety of stack-based exploits. Heavy investment has also
been made in securing the C Runtime Library (CRT) to eliminate many of the
potential attack vectors found in previous versions of the libraries. The
secure CRT replaces all of the unsafe CRT functions with more secure
equivalents as well as adding additional parameter checking to existing CRT
functions. The MFC Library now fully leverages the compiler's security
features as well as those of the secure CRT, meaning that MFC applications
linked with the Visual Studio 2005's MFC Library pose a greatly reduced
opportunity for intentional exploits and a significantly reduced likelihood
of unintentional memory overwrite defects.

Reliability
Recognizing "DLL hell" as a major obstacle to long-term application
reliability, MFC now supports Windows Side-by-Side (WinSxS) installation,
allowing libraries to be appropriately versioned. Side-by-side installations
of MFC enabled by WinSxS technology reduce the errors often associated with
DLL version incompatibility and enables MFC libraries to be much more
effectively serviced and updated with a minimum of end-user impact.

Further enhancing reliability, Microsoft has also fixed more defects in the
Visual Studio 2005 release of MFC than with any previous release. Building
on MFC today will not only yield more secure applications but more reliable
and stable applications as well.

Beyond Visual Studio 2005
MFC continues to be the C++ application framework of choice for many
developers because the breath and depth of support that MFC provides for the
Microsoft platforms remains unmatched by other frameworks. Visual Studio
2005 makes it possible for the C++ developer to leverage existing C++ code,
the strengths of MFC, and the advantages of .NET, all within a single
application.

Looking beyond Visual Studio 2005, C++ developers should expect deepened
integration between MFC and the .NET framework. After the release of Windows
Longhorn, Microsoft intends to add MFC support for key Longhorn APIs and
features. Microsoft also intends to support the Avalon user interface
framework in MFC, providing MFC developers with a bridge to the future of
platform user interface design. In essence, as the platform evolves,
developers can look forward to seeing MFC updated to leverage the latest
managed and native APIs and frameworks.

MFC developers have access to more frameworks than any other type of
developer on the platform. As such, MFC developers are free to leverage the
best from all worlds as it makes business and technological sense to do so.
Microsoft fully expects to support this capability into the foreseeable
future.

Steve Teixeira is the Director of Partner Strategy for Microsoft Visual C++.
You can contact Steve to provide feedback on this document at
Post by Wolfgang Draxinger
Post by Jessica Weiner
I want to create a splitter window using MFC that shows a
You should know, that even Microsoft has depreciated MFC and
advices developers not to start any new projects with MFC.
The MFC are IMHO a huge pile of ****, if you look inside the code
(which comes with the Professional and Enterprise Versions of
VC++) you sometimes get scared.
Sam Brown
2006-02-25 17:31:33 UTC
Permalink
MFC is fine if you just want to throw a quick Windows app
together. It's when you want to change or support the
app in any way shape or form that you run into trouble!

Purely from a flexibilty point of view I've always preffered
writing my apps in raw Win32.

- SamB
Uwe Kotyczka
2006-02-27 10:25:46 UTC
Permalink
Post by Jessica Weiner
I want to create a splitter window using MFC that shows a opengl scene and a
http://limefocus.net/screenshot1.jpg
Invalid URL?
Post by Jessica Weiner
Right now, I can render the opengl scene in its own window without problems
but when I put it inside a splitter window, it crashes my program.
I've been using CView derived OpenGL classes within splitter windows
for years, no problem.
To see some source code you might have a look at my demo
http://www.8ung.at/kotyczka/opengl_en.html or
http://www.virtue.nu/kotyczka/opengl_en.html (mirror)
Post by Jessica Weiner
m_pwndSplitter->CreateView(1,0,m_pThirdView ,m_ThirdViewSize,m_pContext)
HTH
u***@web.de
2016-12-13 18:54:05 UTC
Permalink
Post by Uwe Kotyczka
To see some source code you might have a look at my demo
http://www.8ung.at/kotyczka/opengl_en.html or
http://www.virtue.nu/kotyczka/opengl_en.html (mirror)
Update: Now it can be found at
http://kotyczka.000webhostapp.com/opengl_en.html
Uwe Kotyczka
2017-01-02 00:13:44 UTC
Permalink
Post by u***@web.de
Post by Uwe Kotyczka
To see some source code you might have a look at my demo
http://www.8ung.at/kotyczka/opengl_en.html or
http://www.virtue.nu/kotyczka/opengl_en.html (mirror)
Update: Now it can be found at
http://kotyczka.000webhostapp.com/opengl_en.html
Moved once again to
http://kotyczka.webspace4free.net/opengl_en.html
Uwe Kotyczka
2018-05-30 23:06:11 UTC
Permalink
Post by Uwe Kotyczka
Post by u***@web.de
Post by Uwe Kotyczka
To see some source code you might have a look at my demo
http://www.8ung.at/kotyczka/opengl_en.html or
http://www.virtue.nu/kotyczka/opengl_en.html (mirror)
Update: Now it can be found at
http://kotyczka.000webhostapp.com/opengl_en.html
Moved once again to
http://kotyczka.webspace4free.net/opengl_en.html
It seems that free webhosting services do not last very long nowadays.
Now it can be found at
http://kotyczka.byethost24.com/opengl_en.html
Uwe Kotyczka
2018-05-30 23:06:19 UTC
Permalink
Post by Uwe Kotyczka
Post by u***@web.de
Post by Uwe Kotyczka
To see some source code you might have a look at my demo
http://www.8ung.at/kotyczka/opengl_en.html or
http://www.virtue.nu/kotyczka/opengl_en.html (mirror)
Update: Now it can be found at
http://kotyczka.000webhostapp.com/opengl_en.html
Moved once again to
http://kotyczka.webspace4free.net/opengl_en.html
It seems that free webhosting services do not last very long nowadays.
Now it can be found at
http://kotyczka.byethost24.com/opengl_en.html

Loading...