2011-01-13 38 views
1

我正在嘗試使用SDL/opengl進行多重採樣,但SDL不會接受設置SDL_MULTISAMPLEBUFFERS和SDL_MULTISAMPLESAMPLES。相反,這些都保留爲0,SDL_SetVideoMode()將在以後失敗。我知道我的硬件可以用4倍多重採樣完成這種像素格式。我正在運行Ubuntu 10.10。SDL/opengl多重採樣不起作用

代碼:

SDL_Init(SDL_INIT_VIDEO); 
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); 
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); 
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); 
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); 
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); 
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); 
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0); 
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); 
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); 
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); 

Uint32 flags; 
flags = SDL_OPENGL; 
if(m_bFullscreen) 
{ 
    flags = flags | SDL_FULLSCREEN; 
} 
SDL_SetVideoMode(m_sizeX, m_sizeY, 0, flags); 
+0

什麼是您的視頻卡和驅動程序? – SurvivalMachine

+0

GF7950GT在Linux-x86_64上的驅動程序260.19.06 – gufftan

回答

0

添加這些測試:

if (SDL_Init(SDL_INIT_VIDEO) < 0) { 
    fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError()); 
    EXIT_FAILURE; 
} 

if (SDL_SetVideoMode(m_sizeX, m_sizeY, 0, flags) == NULL) { 
    fprintf(stderr, "Unable to create OpenGL screen: %s\n", SDL_GetError()); 
    SDL_Quit(); 
    EXIT_FAILURE; 
} 

然後看你的stderr輸出。