This commit is contained in:
lipe89 2026-03-12 09:39:09 +00:00
commit e4c8917154
16 changed files with 319 additions and 0 deletions

BIN
AULA2/main Executable file

Binary file not shown.

35
AULA2/main.cpp Normal file
View file

@ -0,0 +1,35 @@
#include <GL/glut.h>
void display(void)
{
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0,0,0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-2, 2, -2, 2);
glBegin(GL_POINTS);
glVertex2f(-0.5, -0.5);
glVertex2f(-0.5, 0.5);
glVertex2f(0.5,0.5);
glEnd();
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500, 500);
glutCreateWindow("GLUT: Exercicio 1");
glutDisplayFunc(display);
glutMainLoop();
return 0;
}

28
AULA2/main2.cpp Normal file
View file

@ -0,0 +1,28 @@
#include <GL/glut.h>
void display(void) {
glClearColor(0, 1, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}
// Setup the rendering state
void SetupRC(void) {
// Set clear color to blue
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}
int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500, 500);
glutCreateWindow("GLUT: Simple");
glutDisplayFunc(display);
glutMainLoop();
return 0;
}

BIN
AULA2/main3 Executable file

Binary file not shown.

51
AULA2/main3.cpp Normal file
View file

@ -0,0 +1,51 @@
#include <GL/freeglut_std.h>
#include <GL/gl.h>
#include <GL/glut.h>
// Called to draw scene
void RenderScene(void) {
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
// Set current drawing color to red :R G B
glColor3f(1.0f, 0.0f, 0.0f);
// Draw a filled rectangle with current color
glRectd(100.0f, 150.0f, 150.0f, 100.0f);
// Flush drawing commands
glFlush();
}
// Setup the rendering state
void SetupRC(void) {
// Set clear color to blue
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}
// Called by GLUT library when the window has cahnge size
void ChangeSize(GLsizei w, GLsizei h) {
// Prevent a divide by zero
if (h == 0)
h = 1;
// Set Viewport to window dimensions
glViewport(0, 0, w, h);
// Reset coordinate system
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Establish clipping volume (len, right, booom, top,near, far)
if (w <= h)
glOrtho (0.0f, 250.0f, 0.0f, 250.0f*h/w, 1.0, -1.0);
else glOrtho(0.0f, 250.0f * w / h, 0.0f, 250.0f, 1.0, -1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
// Main program entry point
int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(400, 350);
glutInitWindowPosition( 10, 10);
glutCreateWindow("GLUT: GLRect");
glutDisplayFunc(RenderScene);
glutReshapeFunc(ChangeSize);
SetupRC();
glutMainLoop();
}