* SDL_opengl *でアキュムレーションバッファのカラーコンポーネントのサイズを変更しようとしていますが、SetAttribute
コマンドは何もしていないようです。ここで私が使用しているコードです。
(私はここに赤色成分を扱っていますが、実際のコードでは、私は色および蓄積バッファの両方にすべての4つの成分を通過させ、効果は同じであり、コードサイズを小さくする)SDL_GL_SetAttributeでカラーサイズが設定されない
#include <iostream>
#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
int main(int argc, char *argv[])
{
//Initialize all SDL subsystems
if(SDL_Init(SDL_INIT_EVERYTHING) < 0)std::cout << "SDL ERROR!";
// Try to Set the BitSize, while checking for errors
int BitSize = 1; //This number never makes a difference!!
int ErrorCode = 0;
ErrorCode += SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1) // This one WORKS
+ SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, BitSize) // These ones DON'T
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, BitSize)
;
if(ErrorCode < 0)std::cout << "SDL ERROR!";
// Create the Window
int w = 1000, h = 700;
int bpp = 32;
SDL_Surface* Screen = SDL_SetVideoMode(w, h, bpp, SDL_OPENGL |
SDL_NOFRAME |
SDL_DOUBLEBUF);
if(!Screen)std::cout << "SDL ERROR!";
// Check if BitSize's are correct (they are not)
// I'm using glGetInteger, but SDL_GL_GetAttribute yields the same output.
glGetIntegerv(GL_ACCUM_RED_BITS, &BitSize);
std::cout << "AccumBuffer color component size in bits is " << BitSize << "\n";
glGetIntegerv(GL_RED_BITS, &BitSize);
std::cout << "ColorBuffer color component size in bits is " << BitSize << "\n";
ErrorCode = SDL_GL_GetAttribute(SDL_GL_BUFFER_SIZE, &BitSize);
std::cout << "FrameBuffer BitSize is " << BitSize << "\n";
if(ErrorCode < 0)std::cout << "SDL ERROR!";
if(glGetError() != GL_NO_ERROR)std::cout << "GL ERROR";
return 0;
}
これは罰金コンパイルし、常に次の出力出力します。どんなに私はBitSize
変数を設定したもの
AccumBuffer color component size in bits is 16
ColorBuffer color component size in bits is 8
FrameBuffer Bit Size is 32
を。 SDL_GL_SetAttribute(SDL_GL_*_SIZE, int)
のような効果はありません。 32 bppでウィンドウを初期化するので、カラーバッファコンポーネントが8ビットに制限されている可能性があります。しかし、私は累積バッファの色の解像度を編集することはできませんか?