updated
git-svn-id: svn://anubis/sdl-opengl-bare@2 486f0dac-8830-0410-96c3-f050bc5976a0
This commit is contained in:
parent
fc5a9f1767
commit
32a589d633
22
sdl_tmplt.c
22
sdl_tmplt.c
@ -11,6 +11,13 @@ void init(void)
|
||||
glClearColor (0.0, 0.0, 0.0, 0.0);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glShadeModel(GL_FLAT);
|
||||
glViewport(0, 0, WIDTH, HEIGHT);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(60.0, (GLfloat)WIDTH/(GLfloat)WIDTH, 1.0, 30.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -3.6);
|
||||
}
|
||||
|
||||
void display(void)
|
||||
@ -22,20 +29,9 @@ void display(void)
|
||||
glVertex3f(0.0, 1.0, 0.0);
|
||||
glVertex3f(0.0, -1.0, 0.0);
|
||||
glEnd();
|
||||
SDL_GL_SwapBuffers();
|
||||
}
|
||||
|
||||
void reshape(GLsizei w, GLsizei h)
|
||||
{
|
||||
glViewport(0, 0, w, h);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -3.6);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (SDL_Init(SDL_INIT_VIDEO))
|
||||
@ -57,9 +53,7 @@ int main(int argc, char *argv[])
|
||||
SDL_WM_SetCaption(argv[0], argv[0]);
|
||||
|
||||
init();
|
||||
reshape(WIDTH, HEIGHT);
|
||||
display();
|
||||
SDL_GL_SwapBuffers();
|
||||
SDL_Event event;
|
||||
while (SDL_WaitEvent(&event))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user