0% found this document useful (0 votes)
24 views3 pages

Glutinit Glut - Single Glut - RGB

The document contains C code for an OpenGL program that initializes a window and display context, defines functions for initialization and drawing, and contains the main function to run the program. The initialization function sets colors, point size, and projection. The display function clears the screen and draws points or lines. The main function initializes GLUT, sets window properties, registers display callback, calls initialization, and enters main loop.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views3 pages

Glutinit Glut - Single Glut - RGB

The document contains C code for an OpenGL program that initializes a window and display context, defines functions for initialization and drawing, and contains the main function to run the program. The initialization function sets colors, point size, and projection. The display function clears the screen and draws points or lines. The main function initializes GLUT, sets window properties, registers display callback, calls initialization, and enters main loop.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

#include <GL/freeglut.

h>
void myDisplay(void)
{}
void main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,100);
glutCreateWindow("dayansjkandadnaskjdnkndaojdn");
glutDisplayFunc(myDisplay);
glutMainLoop();
}

#include <GL\glut.h>

void myInit(void){

glClearColor(1.0, 1.0, 1.0, 0.0);

glColor3f(0.0, 0.0, 1.0);// maau ve la mau xanh lam

glPointSize(5.0);

glMatrixMode(GL_PROJECTION);

glLoadIdentity();

gluOrtho2D(0.0, 640.0, 0.0, 480.0);

void myDisplay(void){

glClear(GL_COLOR_BUFFER_BIT);// xoa man hinh

glBegin(GL_POINTS);

glVertex2i(100, 50);

glVertex2i(100, 150);

glVertex2i(150, 150);

glEnd();

glFlush();

void main(int argc, char** argv)

glutInit(&argc, argv); //khoi tao toolkit


glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);

glutInitWindowSize(640, 480);// thiet lap

glutInitWindowPosition(100, 100);

glutCreateWindow("Day la choung trinh");

glutDisplayFunc(myDisplay);

myInit();

glutMainLoop();

}
#include <GL\glut.h>
void myInit(void){
glClearColor(1.0, 1.0, 1.0, 0.0);
glColor3f(0.0, 0.0, 1.0);// maau ve la mau xanh lam
glPointSize(5.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 640.0, 0.0, 480.0);
}
void myDisplay(void){
glClear(GL_COLOR_BUFFER_BIT);// xoa man hinh
glBegin(GL_POINTS);
glVertex2i(289, 190);
glColor3f(0.1, 0.0, 0.0);
glVertex2i(320, 128);
glColor3f(0.0, 1.0, 0.0);
glVertex2i(239, 67);
glColor3f(0.0, 0.0, 1.0);
glVertex2i(194, 101);
glColor3f(0.1, 0.0, 0.0);
glVertex2i(129, 83);
glColor3f(0.1, 0.0, 0.0);
glVertex2i(75, 73);
glColor3f(0.1, 0.1, 0.0);
glVertex2i(74, 74);
glColor3f(0.1, 0.0, 0.1);
glVertex2i(20, 10);
glColor3f(0.1, 1.0, 0.0);
glEnd();
glFlush();

}
void main(int argc, char** argv)
{
glutInit(&argc, argv); //khoi tao toolkit
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(640, 480);// thiet lap
glutInitWindowPosition(100, 100);
glutCreateWindow("Day la choung trinh");

glutDisplayFunc(myDisplay);
myInit();
glutMainLoop();

#include <GL\glut.h>
void myInit(void){
glClearColor(1.0, 1.0, 1.0, 0.0);
glColor3f(0.0, 0.0, 1.0);// maau ve la mau xanh lam
glPointSize(5.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 640.0, 0.0, 480.0);
}
void myDisplay(void){
glClear(GL_COLOR_BUFFER_BIT);// xoa man hinh
glBegin(GL_LINE_STRIP);

glVertex2i(74, 274);
glVertex2i(212, 174);
glVertex2i(20, 100);
glVertex2i(24, 174);
glEnd();
glFlush();

}
void main(int argc, char** argv)
{
glutInit(&argc, argv); //khoi tao toolkit
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(640, 480);// thiet lap
glutInitWindowPosition(100, 100);
glutCreateWindow("Day la choung trinh");

glutDisplayFunc(myDisplay);
myInit();
glutMainLoop();

You might also like