Initally updating the window when compiled using Visual Studio 2005
Posted by Mike Pliam
on 09/09/2008 03:38pm
have rebuilt the MFC/OpenGL interface using Visual Studio 2005. Essentially no major coding changes were required.
The revised application runs quite nicely with one exception. When first booting up the app, the view window is transparent. This is immediately corrected by doing any action that requires updating the window, for example, minimizing and then restoring, moving the window partially off the computer screen, then back again, etc.
I would like to have the application automatically update the window on the initial boot. I have implemented CView::OnInitialUpdate(), and while this method is always called when first opening the application, I cannot get any of the usual methods to work to programatically, i.e., Invalidate(), etc.
It was not a problem with the same code using Visual Studio 7.0 and earlier.
Can anyone out there help me solve this problem?
Played around with this app called OG, which I download here. Written me a little program that I want to use wiff this OG. But I want the user to call it from a menu.So I
adds it as a OG function in OG.cpp and og.h.( It is basically my WinMain function if the little program is standalone ). Yeah I use CreateMyWindow here.
When I close this menuopenGLWindowNew type thing. The original OG STUFF no work, no more. The toolbar she is dead. The menu OG opengl commands she is dead.( Except my MenuWindow type thing and exit,open, etc.)
What is wrong? I would like to know how to use this following wiff in OG.
I create struct and than I would
Than I must goes
tHestruct = (myStruct*)(GetWindowLong(g_hWnd,GWL_USERDATA));
than I do this
wglMakeCurrent( tHestruct.tHe_hDC, tHestruct.tHe_hRC );
But is no good.
This is problems I get:
1) How I get g_hWnd for Og app?
2) How I do my assignment operator definition is sposed to be defined?.
Me not no how to do this? Me no want to use childWinnows.
great application first of all.
I would like to write your code in Borland C++
coz that's my platform.
I can run the program but i just see the blue background.
I've used the FormPaint event handler as OnPaint, could it be he problem?
I would like to thank you for the effort you have put into writting the article "Function graphics in 3D" in CodeGuru. It helped me a lot to write a 3D viewer for my 2D spectra data.
I have found a small problem regarding resources management. I think the OpenGL rendering context should be removed before destroying the view. I found this problem in my application because I implemented the 3D viewer in a dialog box and each time the dialog box was invoked, the memory requirements grew up significantly. I solved it by adding this code:
// specify the target DeviceContext (window) of the subsequent OGL calls
// release definitely OGL Rendering Context
if (m_hRC!=NULL) ::wglDeleteContext(m_hRC);
I would also like to ask you if you know why I can't implement alpha-blending into the viewer. I added a menu option in order to enable alpha blending but it doesn't work properly. This is the code I'm using in response to the menu command:
I tried to put different images in different sub-windows,
but failed. Here was what I tried.
Four sub-windows were directly inherited from CView (MFC),
, say CView1:CView, CView2:CView, CView3:CView,
CView4:CView, as shown in following.
| || |
| window 1 || window 2 |
| || |
| || |
| window 3 || window 4 |
| || |
For example, I want to put
(1) sin(x)*sin(y) in window 1
(2) cos(x)*sin(y) in window 2
(3) cos(x)*cos(y) in window 3
(4) sin(x)*tan(y) in window 4
Unfortunately, only the current data was drawn in the
current sub-window, and all previous images were erased,
although seperate codes were written in different CView's
(CView1, CView2, CView3, CView4).
I'm afraid OpenGL shared a same buffer for all CView's.
Could you tell me how to put data on different sub-windows?
I mean I just want to put (1) in CView1, (2) in CView2, (3)
in CView3, and (4) in CView4. Thanks a lot.