Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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
Comments
Manfred Rudolf Bihy 13-May-11 12:25pm    
Please elaborate! What are you trying to achieve?

1 solution

Have already looked here: http://www.opengl.org/wiki/Multisampling[^]?

Regards,

-MRB
 
Share this answer
 
Comments
cammaratasergio 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900