avatar
Untitled

Guest 2.1K 31st Aug, 2020

// Lap_1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "Dependencies\glew\glew.h"
#include "Dependencies\freeglut\freeglut.h"
#include <math.h>
const int screenWidth = 640;
const int screenHeight = 480;

void init(void)
{
	glClearColor(0.0, 0.0, 0.0, 0.0);
	glShadeModel(GL_FLAT);
}

void DrawHCN(GLint x, GLint y, GLint r)
{

	glBegin(GL_POLYGON);
	glVertex2i(x - r + 15, y - r / 6);
	glVertex2i((x - r + 15) + (2 * r - 30) , y - r / 6);
	glVertex2i((x - r + 15) + (2 * r - 30), (y - r / 6) + (r / 3));
	glVertex2i(x - r + 15, (y - r / 6) + (r/3));

	glEnd();


}

void Draw(GLint x, GLint y, GLint r)
{
	GLfloat tiwcePI = (GLfloat) 2.0f* 3.14159265;
	glBegin(GL_TRIANGLE_FAN);
	glVertex2i(x, y);
	for (int i = 0; i <= 40; i++)
	{
		glVertex2i((GLint)(x + (r * cos(i *tiwcePI / 40)) + 0.5), (GLint)(y + (r * sin(i *tiwcePI / 40)) + 0.5));

	}
	glEnd();
}

void display()
{
	glClear(GL_COLOR_BUFFER_BIT);

	glColor3f(1.0, 0.0, 0.0);
	Draw(200, 200, 100);

	glColor3f(1, 1, 1);
	DrawHCN(200, 200, 100);

	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_RGBA);
	glutInitWindowSize(screenWidth, screenHeight);
	glutInitWindowPosition(100, 100);
	glutCreateWindow(argv[0]);
	init();
	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	glutMainLoop();
	return 0;
}
LOLCODE
Description

No description

To share this paste please copy this url and send to your friends
RAW Paste Data