All pastes #277976 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-12-13 18:49 UTC
rendered paste body
#include <windows.h>
#include <GL/glut.h>


bool startWin(int width, int height)
{
	glutInitWindowSize(width, height);
	glutInitWindowPosition(100, 100);
	glutCreateWindow("whie");
	return true;
}

void init()
{
	glClearColor(0.0, 0.0, 0.0, 0.0);
	glShadeModel(GL_SMOOTH);
	glLoadIdentity();
}

void display()
{
	
	static GLubyte oneIndices[] = {0, 1, 2, 3, 4, 5, 6};
	static GLubyte twoIndices[] = {7, 1, 9, 10, 11};
	glClear(GL_COLOR_BUFFER_BIT);
	glDrawElements(GL_LINE_STRIP, 7, GL_UNSIGNED_BYTE, oneIndices);
	glDrawElements(GL_LINE_STRIP, 6, GL_UNSIGNED_BYTE, twoIndices);
	glFlush();
}

void reshape(int w, int h)
{
	glViewport (0, 0, (GLsizei) w, (GLsizei) h);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluOrtho2D(0.0, (GLdouble) w, 0.0, (GLdouble) h);
}

int main(int argc, char** argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	if (startWin(640, 480));
	{
		init();
		glutDisplayFunc(display);
		glutReshapeFunc(reshape);
		glutMainLoop();
	}
	return 0;
}