Click here to Skip to main content
12,072,456 members (54,972 online)
Rate this:
 
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>

How can I enable multisampling in OpenGL? Thanks!
Posted 13-May-11 7:16am
Comments
Manfred R. Bihy 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 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web03 | 2.8.160208.1 | Last Updated 13 May 2011
Copyright © CodeProject, 1999-2016
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