All pastes #123639 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-08-09 13:27 UTC
rendered paste body
#include <iostream>
#include <GL/glut.h>
#include <windows.h>
#include <string>
using namespace std;
double WIDTH = 400, HEIGHT = 400;
double HMIN = -WIDTH/2, HMAX = WIDTH/2, KMIN = -HEIGHT/2, KMAX = HEIGHT/2;
void display() {
	glClear(GL_COLOR_BUFFER_BIT);
	glutSwapBuffers();
}
void mouse (int btn, int state, int x, int y) {
	double X = x*(HMAX-HMIN)/(WIDTH+HMIN);
	double Y = (HEIGHT-y)*(KMAX-KMIN)/(HEIGHT+KMIN);
	glutPostRedisplay();
	
}
int main(int argc, char** argv) {
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
	glutInitWindowSize(WIDTH, HEIGHT);
	glutInitWindowPosition(100, 100);
	glutCreateWindow("Keyboard Input");
	glutSetIconTitle("favicon.ico");
	glClearColor(0, 0, 0, 0);
	glColor3f(1, 1, 1);
	glMatrixMode(GL_MODELVIEW);
	glOrtho(HMIN, HMAX, KMIN, KMAX, -1, 1);
	glClear(GL_COLOR_BUFFER_BIT);
	//glutKeyboardFunc(keyboard);
	glutDisplayFunc(display);
	glutMouseFunc(mouse);
	glutMainLoop();
	return 0;
}