[Comm] Re: OpenGL programming question (glut and fullscreen)

Andrey Brindeew =?iso-8859-1?q?abr_=CE=C1_altlinux=2Eru?=
Пн Апр 21 17:51:30 MSD 2003


On Mon, Apr 21, 2003 at 05:19:21PM +0400, Roman Savelyev wrote:
> | Приложенный к этому письму пример не работает.
> Это закономерно, т.к. в письме вложений не обнаружено :)

пардон, исправляюсь :-)

-- 
WBR, Andrey Brindeew.
"No one person can understand Perl culture completely"
(C) Larry Wall.
----------- следующая часть -----------
# gcc -o teapot teapot.c -L/usr/X11R6/lib/ -lGL -lglut

%: %.c
	gcc -pg -o $@ $< -L/usr/lib -L/usr/X11R6/lib -L. -lGL -lglut
----------- следующая часть -----------
#include <GL/glut.h>
#include <stdio.h>

float angle = 0.0 ;

void anim(void)
{
	angle += 1.0 ;
	if (angle >= 360.0) 
		angle -= 360.0 ;

	glutPostRedisplay() ;
}

void keyboard(unsigned char key, int x, int y)
{
	switch(key) 
	{
	default:
		exit(0) ;
	}
}

void display(void) // the disp[lay function
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ; 
	glRotatef(angle,1.0,1.0,1.0) ;
	glutSolidCube(1.0) ;
	glutSwapBuffers() ; 
}

void reshape(int w, int h) // the reshape function
{
   glViewport(0,0,(GLsizei)w,(GLsizei)h) ;
   glMatrixMode(GL_PROJECTION) ;
   glLoadIdentity() ;
   gluPerspective(60.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)
{
	glutInit(&argc, argv) ;
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH) ; 

	glutGameModeString("1152x864:24") ;
	if (glutGameModeGet(GLUT_GAME_MODE_WIDTH) != -1)  // if the width is different to -1
	{
		glutEnterGameMode()   ;		// enter full screen mode
		glutDisplayFunc(display) ;
		glutReshapeFunc(reshape) ;
		glutIdleFunc(anim) ;
		glutKeyboardFunc(keyboard) ;
		glutMainLoop() ;
	}
	else							// print out that this mode is not available
		printf("The current mode is not supported in this system\n") ;
	return 0 ;
}
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Тип     : application/pgp-signature
Размер  : 245 байтов
Описание: =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Url     : <http://lists.altlinux.org/pipermail/community/attachments/20030421/f7e7ae53/attachment-0004.bin>


Подробная информация о списке рассылки community