All pastes #113517 Raw Edit

Mine

public cpp v1 · immutable
·published 2006-08-03 16:59 UTC
rendered paste body
void cVideoSystem::initVideo() const{	//set opengl vars	SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);		//Use at least 5 bits of Red	SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);	//Use at least 5 bits of Green	SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);		//Use at least 5 bits of Blue	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);	//Enable double buffering	//notice no depth buffer is set	CSetting &setting = CSetting::getSingleton();	//set up projection	glMatrixMode(GL_PROJECTION);	glLoadIdentity();	glViewport(0, 0, setting.video.res_x, setting.video.res_y);	glOrtho(-4.0, 4.0, 3.0, -3.0, -10.0, 10.0); 	glClearColor(.5f, .5f, .5f, 0.0f);	glShadeModel(GL_SMOOTH);	glDisable(GL_DEPTH);	//2d, we dont want depth yet	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);	glMatrixMode(GL_MODELVIEW);	glLoadIdentity();}void cVideoSystem::createWindow(){	//init SDL video    if (SDL_Init(SDL_INIT_VIDEO) == -1) 		throw cErrorCode(EC_SDL_INITVIDEO_FAILURE, EL_CRASH);	CSetting &setting = CSetting::getSingleton();	m_frameBufferSurface = SDL_SetVideoMode( setting.video.res_x, setting.video.res_y, setting.video.bpp, SDL_OPENGL | SDL_HWSURFACE);	if(!m_frameBufferSurface)		throw cErrorCode(EC_SDL_SETVIDEOMODE_FAILURE, EL_CRASH);	//set window title    SDL_WM_SetCaption("RAND prototype application", NULL);}///////////////////////////////////////////////////int main(int argc, char *argv[]){...	cVideoSystem *video = new cVideoSystem();	video->createWindow();	video->initVideo();...	CEGUI::System::getSingleton().renderGUI();}