I am trying to get multisampling in my application, but for some reason the following (from the beginning of my program) does nothing on OS X or Linux.
:::C++
glfwWindowHint(GLFW_SAMPLES, 16); // does nothing!
glfwWindowHint(GLFW_RESIZABLE, false);
window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
glfwMakeContextCurrent(window);
The only thing I can think of is that my computer has an Intel Iris card, but I haven’t seen anybody complaining about problems with them. The problem also occurs in OpenFrameworks, but not in SFML, which is weird because I thought both of them used GLFW, not just OpenFrameworks.
That doesn’t seem to help. I used glfwGetWindowAttrib to check and it seems that the window is just creating without samples being set to 16 instead of 0, despite the hint.
Have you tried any other number of samples than 16? This may be probably than the maximum available, try 4 or 8 as these are guaranteed on most RTs by the DX11 spec which the Haswell GPU conforms to. Note that on Haswell the 2x mode is slower than the 4x mode.
GLFW picks the framebuffer pixel format most closely matching what’s been requested, so asking for 16 would give you 8 if that was the highest number of samples supported.
What are you requesting with glfwGetWindowAttrib? That function cannot return any information wrt number of samples, but it does return zero on errors (like invalid attributes).
I was running it with GLFW_SAMPLES as the argument, I hadn’t thought to check if that was actually something it could return. And I can confirm that reducing the number of samples in the hint doesn’t do anything.
It seems I’ve been wasting my time over a simple mistake - I had put all of my window hints before glfwInit() because my context-related hints broke the context if they followed, but it seems the samples hint actually needs to follow it.