我正在使用freeglut。我正在尝试让 FSAA 正常工作,但似乎没有任何效果。样本缓冲区为 1,样本为 4。但我没有看到任何抗锯齿。我错过了什么吗?目前,我正在运行 Ubuntu 12.04;不确定这是否会改变任何东西。
#include <GL/glut.h>
#include <GL/glext.h>
#include <stdio.h>
void render(void);
int main(int argc, char **argv){
glutInit(&argc,argv);
//Initialize the window
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_MULTISAMPLE);
glutInitWindowPosition(100,100);
glutInitWindowSize(200,200);
glutCreateWindow("Testing");
glutDisplayFunc(render);
//Enable FSAA
glEnable(GL_MULTISAMPLE);
//2D graphics
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT), 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
GLint buf, sbuf;
glGetIntegerv(GL_SAMPLE_BUFFERS, &buf);
printf("number of sample buffers is %d\n", buf);
glGetIntegerv(GL_SAMPLES, &sbuf);
printf("number of samples is %d\n", sbuf);
glutMainLoop();
return 0;
}
//Draw some stuff
void render(void){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glColor3f(0.0f,1.0f,0.0f);
glBegin(GL_LINE_LOOP);
glVertex2f(10.0,10.0);
glVertex2f(170.0,60.0);
glVertex2f(50.0,130.0);
glVertex2f(50.0,60.0);
glEnd();
glutSwapBuffers();
}
我很了解 SDL 和 GLFW。不过,我想让它在 freeglut 中工作。
更多信息:
显卡:ATI Radeon HD 4250
OpenGL 版本:3.3.11627 兼容性配置文件上下文