That doesn’t sound like it. But, here’s the code anyway:
SDL_Init(SDL_INIT_EVERYTHING);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE,8 );
SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32 );
SDL_Surface* drawContext;
Uint32 flags;
int width = 800, height = 600;
flags = SDL_OPENGL | SDL_HWSURFACE | SDL_GL_ACCELERATED_VISUAL;
drawContext = SDL_SetVideoMode(width, height, 0, flags);
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,500.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(10.0);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glShadeModel(GL_SMOOTH);
glEnable(GL_CULL_FACE);
glFrontFace(GL_CCW);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glFrustrum…? Actually, I’ve never used that before, but I have used gluPerspective though. That’s similar I suppose.
Wait, I just looked at the tutorial and I notice that for their gluPerspective() they have set up, they set the first parameter “fovy” as 54.0f… whereas I’m using 45.0f… so I put that number in and sure enough, it’s working better now.
Hmm… gosh, such a newbie at this. xP So anyway, would I need to change the fovy for a different window resolution then?