Δημοσιεύτηκε: 21 Ιούλ 2012, 15:55
από konnn
Δοκίμασε και αυτή την εντολή
Κώδικας: Επιλογή όλων
g++ -lGL -lglut -lGLU test.cpp -o test
.

με αυτόν το κώδικα
Κώδικας: Επιλογή όλων
//AUTH Computational Physics - Computer Graphics - GV2007-2012
//Project >> BasicCode/code12.cpp
//target : Set Coordinate system in Graphic window and draw a test-object
//--------------------------------------------------------

#include <stdio.h>
//#include <GL/glu.h>

#include <GL/glut.h>



void SetupG(GLfloat b)
{
glClearColor(b,b,b,0); //set attribute : background color
gluOrtho2D(0,100,0,100);
}

void mydisplay()
{
glClear(GL_COLOR_BUFFER_BIT); //clear Display Window
glColor3f(1.0,0.0,0.0); //set drawing color
glBegin(GL_LINES);
glVertex2i(10,10);
glVertex2f(30.5,80.0);
glEnd();

glFlush(); //necessary for processing OpenGL routines
}

int main(int argc, char **argv)
{
printf("AUTH Computational Physics - Computer Graphics - GV2007-2012\n");
printf("Project >> BasicCode/code12.cpp\n");
printf("target : Set Coordinate system in Graphic window and draw a test-object\n");
printf("--------------------------------------------------------\n");

glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutCreateWindow("My graphic window");

SetupG(0.5);
glutDisplayFunc(mydisplay);
glutMainLoop();
return 0;
}a