Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ OpenGL
Hi everybody!
 
I'm writing a C++ code script using VS2008 and libraries freeglut and glew.
I wrote following code (I omit unnecessary code lines):
#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>
 
How can I enable multisampling in OpenGL? Thanks!
Posted 13-May-11 7:16am
csergio515
Comments
Manfred R. Bihy at 13-May-11 12:25pm
   
Please elaborate! What are you trying to achieve?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Have already looked here: http://www.opengl.org/wiki/Multisampling[^]?
 
Regards,
 
-MRB
  Permalink  
Comments
csergio at 13-May-11 13:20pm
   
Thank you for your help!
I try to implement the procedure but I block in step 5 because following error occurs:
1>.\DrawingRegion.cpp(138) : error C2065: 'wglGetExtensionsStringARB' : undeclared identifier
 
Why?!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.1411022.1 | Last Updated 13 May 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100