- openglapplication.zip
- OpenGLApplication
- openglwizard.zip
- OpenGLWizard
- OpenGLWizard.sln
- OpenGLWizard
- 1033
- default.vcproj
- HTML
- 1033
- Images
- OpenGLWizard.png
- OpenGLWizard_Background.gif
- OpenGLWizard.ico
- OpenGLWizard.vcproj
- OpenGLWizard.vsdir
- OpenGLWizard.vsz
- Scripts
- 1033
- Templates
- 1033
|
// OGLView.cpp
// Created by Dave Kerr, 20/04/2002 22:44:15
#include "stdafx.h"
#include "OpenGLView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
IMPLEMENT_DYNCREATE(COpenGLView, CView)
BEGIN_MESSAGE_MAP(COpenGLView, CView)
ON_WM_ERASEBKGND()
ON_WM_SIZE()
ON_WM_DESTROY()
END_MESSAGE_MAP()
void COpenGLView::OnDraw(CDC* pDC)
{
// Make the OpenGL Surface current.
m_openGLSurface.MakeCurrent();
// Do any opengl drawing.
DoOpenGLDraw();
// Now blit the lot into the DC.
m_openGLSurface.Draw(pDC, 0, 0);
// Deactivate the surface.
m_openGLSurface.MakeNoneCurrent();
}
#ifdef _DEBUG
void COpenGLView::AssertValid() const
{
CView::AssertValid();
}
void COpenGLView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
BOOL COpenGLView::OnEraseBkgnd(CDC* pDC)
{
// The DIB Surface handles erasing the background.
return TRUE;
}
void COpenGLView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
// If size is silly (x=0 || y=0) don't create.
if(cx == 0 || cy == 0)
return;
// Recreate our DIB surface using the correct size.
m_openGLSurface.Create(cx, cy, 24);
// Call the override - this'll handle the viewport projection.
DoOpenGLResize(cx, cy);
}
void COpenGLView::OnDestroy()
{
// CView::OnDestroy();
// Destroy the surface.
m_openGLSurface.Destroy();
}
BOOL COpenGLView::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
if(cs.style&CS_PARENTDC)
cs.style -= CS_PARENTDC;
return CView::PreCreateWindow(cs);
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.