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 :
openGLContext.setMultisamplingEnabled(true); OpenGLPixelFormat format; format.multisamplingLevel = 4; openGLContext.setPixelFormat(format);
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(); mOGLContext->setComponentPaintingEnabled(true); mOGLContext->setContinuousRepainting(true); mOGLContext->setMultisamplingEnabled(true); juce::OpenGLPixelFormat format; format.multisamplingLevel = 8; mOGLContext->setPixelFormat(format); mOGLContext->setRenderer(this); mOGLContext->attachTo(*this); // When I set OpenGL attributes glEnable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(70, (double)640 / 480, 1, 1000); glViewport(0, 0, getWidth(), getHeight()); // When I draw in my context glClearColor(0, 0, 0, 255); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); 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); gluDeleteQuadric(params); glFlush()
Thanks,
Lyøks