#include "stdafx.h" #include "DrawingRegion.h" #include <windows.h> #include <stdlib.h> #include <stdio.h> #include <math.h> #include <gl\glew.h> #pragma comment(lib, "glew32.lib") #include <gl\freeglut.h> #pragma comment(lib, "freeglut.lib") BEGIN_MESSAGE_MAP(CDrawingRegion, CWnd) ON_WM_PAINT() END_MESSAGE_MAP() // CDrawingRegion message handlers /////////////////////////////////// void CDrawingRegion::OnPaint() { CPaintDC dc(this); GetClientRect(&cr); if (wglMakeCurrent(dc.m_hDC, hglrc) == FALSE) { CTime t = CTime::GetCurrentTime(); } // C O D E if (SwapBuffers(wglGetCurrentDC()) == FALSE) { CTime t = CTime::GetCurrentTime(); } if (wglMakeCurrent(NULL, NULL) == FALSE) { CTime t = CTime::GetCurrentTime(); } glFlush(); } void CDrawingRegion::PreSubclassWindow() { // TODO: Add your specialized code here and/or call the base class PIXELFORMATDESCRIPTOR pfd; memset(&pfd, 0, sizeof(pfd)); pfd.nSize = sizeof(pfd); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.iPixelType = PFD_TYPE_RGBA; pfd.iLayerType = PFD_MAIN_PLANE; pfd.cColorBits = 24; pfd.cDepthBits = 16; CDC *pDC = GetDC(); int iPixelFormat = ChoosePixelFormat(pDC->m_hDC, &pfd); if (iPixelFormat == 0) { CTime t = CTime::GetCurrentTime(); } if (SetPixelFormat(pDC->m_hDC, iPixelFormat, &pfd) == FALSE) { CTime t = CTime::GetCurrentTime(); } if ((hglrc = wglCreateContext(pDC->m_hDC)) == NULL) { CTime t = CTime::GetCurrentTime(); } ReleaseDC(pDC); CWnd::PreSubclassWindow(); }</math.h></stdio.h></stdlib.h></windows.h>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)