MultiSampling

I have a .NET control that is a opengl viewer. All the opengl functions are in a c# wrapper. My question is how do u turn MultiSampling on when not using glut to open a window? The control just drops onto a form and grabs the hdc of the control to make the render context. If I try to just use glEnable for multisampling it doesn’t work.

Any suggestions?

you have to set up a multisampled pixel format (under windows). however since you’re using the .net framework i suggest you to take a look at the opentk framework.

I’m not sure if OpenTK has MutliSampling working yet. Nothings been updated since last year.

I discovered that wglChoosePixelFormatARB is used to set up Multisampling for windows. I followed several examples from the Nvidia site and NeHe, but I’m using c# and I keep getting Object reference not set to an instance of an object. The error seems to be coming from within the wglChoosePixelFormatARB function. wglChoosePixelFormatARB does bring up intellisense so the function is declared correctly and none of the parameters sent to the function are null. I do have an hdc and a rendering context.

Has anyone had similar problems with wglChoosePixelFormatARB under c#?

i can assure you that opentk’s multisampling is working and that the project is currently under development (i’ve just used that library for a large-scale commercial project without troubles). at least take a look at their GLControl’s code.

Fixed the problem, I really didn’t have a valid hdc or rendering context.