MSAA in OpenGLContext

Hi Jules,


I'm a newbie in the world of OpenGL and I'm actually trying to use multisampling to remove aliasing from my OpenGL context, in which I display a simple cylinder, with gluCylinder(). I have searched in this forum and on the Internet, and I've found that Juce handles multisampling thanks to this initialization code :

OpenGLPixelFormat format;
format.multisamplingLevel = 4;

I added this code in the JuceDemo, in OpenGLDemo.cpp, and it actually worked. But, when I try to use the same code for my cylinder, multisampling doesn't seem to be set correctly... So I wonder if it has something to do with the fact that JuceDemo uses shaders and I don't, if it has something to do with the fact that I use Glu, or if I've missed something in the initialization of multisampling. Here are the main points of my code (I work on VS2013) :

// When I create and attach my context to the renderer
mOGLContext = new juce::OpenGLContext();
juce::OpenGLPixelFormat format;
format.multisamplingLevel = 8;


// When I set OpenGL attributes
gluPerspective(70, (double)640 / 480, 1, 1000);

glViewport(0, 0, getWidth(), getHeight());

// When I draw in my context
glClearColor(0, 0, 0, 255);

gluLookAt(3, 1, 4, 0, 0, 0, 0, 0, 1);

GLUquadric* params = gluNewQuadric();
gluQuadricDrawStyle(params, GLU_FILL);
gluQuadricOrientation(params, GLU_OUTSIDE);
glRotated(180, 1, 0, 0);
gluCylinder(params, 0.05, 0.05, 3, 40, 1);





No idea, sorry - presumably there's something that your code or GLU is doing that prevents the MSAA, but I'm not sure what it'd be. Maybe there's a GL guru out there who can suggest what you might be changing?

glEnable(GL_MULTISAMPLE)? Not sure how it works with glu, but for primitives it is needed

I've already tried this but Visual told me GL_MULTISAMPLE is undefined. I've actually checked in gl.h and there is no trace of GL_MULTISAMPLE... My version of OpenGL is 6.14 (if I'm not wrong), if it has something to do with it.

But it makes me think I didn't try to use

#define GL_MULTISAMPLE 0x809D

I'm going to try this, I'll let you know.

Official OpenGL information:

Yes, I have the same lines in my custom openGL header. Don't know why they're not defined.

If it's missing, GL_MULTISAMPLE should probably be added here:

OK this on the latest tip now

Just adding glEnable(GL_MULTISAMPLE) doesn't seem to change anything, I'll try to use the buffers, to see how it goes.

Finally, I found what my problem was, nothing to do with buffers or glEnable(GL_MULTISAMPLING). Just a silly mistake, I was using most of my OpenGL functions in the paint() of my component and not in renderOpenGL().

Thanks for your help even though !