se provo a compilare ad esempio questo file:
codice:
#include <GL/glut.h>
#include "stdlib.h"
#define RAMPSIZE 16
#define RAMP1START 32
#define RAMP2START 48
static float rotAngle = 0.;
/* Initialize antialiasing for color index mode,
* including loading a green color ramp starting
* at RAMP1START, and a blue color ramp starting
* at RAMP2START. The ramps must be a multiple of 16.
*/
void init(void)
{
int i;
for (i = 0; i < RAMPSIZE; i++) {
GLfloat shade;
shade = (GLfloat) i/(GLfloat) RAMPSIZE;
glutSetColor(RAMP1START+(GLint)i, 0., shade, 0.);
glutSetColor(RAMP2START+(GLint)i, 0., 0., shade);
}
glEnable (GL_LINE_SMOOTH);
glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
glLineWidth (1.5);
glClearIndex ((GLfloat) RAMP1START);
}
/* Draw 2 diagonal lines to form an X
*/
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glIndexi(RAMP1START);
glPushMatrix();
glRotatef(-rotAngle, 0.0, 0.0, 0.1);
glBegin (GL_LINES);
glVertex2f (-0.5, 0.5);
glVertex2f (0.5, -0.5);
glEnd ();
glPopMatrix();
glIndexi(RAMP2START);
glPushMatrix();
glRotatef(rotAngle, 0.0, 0.0, 0.1);
glBegin (GL_LINES);
glVertex2f (0.5, 0.5);
glVertex2f (-0.5, -0.5);
glEnd ();
glPopMatrix();
glFlush();
}
void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= h)
gluOrtho2D (-1.0, 1.0,
-1.0*(GLfloat)h/(GLfloat)w, 1.0*(GLfloat)h/(GLfloat)w);
else
gluOrtho2D (-1.0*(GLfloat)w/(GLfloat)h,
1.0*(GLfloat)w/(GLfloat)h, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void keyboard(unsigned char key, int x, int y)
{
switch (key) {
case 'r':
case 'R':
rotAngle += 20.;
if (rotAngle >= 360.) rotAngle = 0.;
glutPostRedisplay();
break;
case 27: /* Escape Key */
exit(0);
break;
default:
break;
}
}
/* Main Loop
* Open window with initial window size, title bar,
* color index display mode, and handle input events.
*/
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_INDEX);
glutInitWindowSize (200, 200);
glutCreateWindow (argv[0]);
init();
glutReshapeFunc (reshape);
glutKeyboardFunc (keyboard);
glutDisplayFunc (display);
glutMainLoop();
return 0;
}
mi da questi errori:
codice:
Compilatore: Default compiler
Building Makefile: "C:\Documents and Settings\Rocco\Desktop\glui\prog\prova\Makefile.win"
Esecuzione di make...
make.exe -f "C:\Documents and Settings\Rocco\Desktop\glui\prog\prova\Makefile.win" all
gcc.exe -c main.c -o main.o -I"C:/Dev-Cpp/include"
gcc.exe main.o -o "Esercizio1.exe" -L"C:/Dev-Cpp/lib" -mwindows -lopengl32
main.o(.text+0x15):main.c: undefined reference to `__glutInitWithExit'
main.o(.text+0x30):main.c: undefined reference to `__glutCreateWindowWithExit'
main.o(.text+0x4c):main.c: undefined reference to `__glutCreateMenuWithExit'
main.o(.text+0x8e):main.c: undefined reference to `glutSetColor'
main.o(.text+0xa4):main.c: undefined reference to `glutSetColor'
main.o(.text+0xbb):main.c: undefined reference to `_imp__glEnable'
main.o(.text+0xd2):main.c: undefined reference to `_imp__glHint'
main.o(.text+0xe4):main.c: undefined reference to `_imp__glLineWidth'
main.o(.text+0xf6):main.c: undefined reference to `_imp__glClearIndex'
main.o(.text+0x111):main.c: undefined reference to `_imp__glClear'
main.o(.text+0x120):main.c: undefined reference to `_imp__glIndexi'
main.o(.text+0x12a):main.c: undefined reference to `_imp__glPushMatrix'
main.o(.text+0x145):main.c: undefined reference to `_imp__glRotatef'
main.o(.text+0x154):main.c: undefined reference to `_imp__glBegin'
main.o(.text+0x16b):main.c: undefined reference to `_imp__glVertex2f'
main.o(.text+0x182):main.c: undefined reference to `_imp__glVertex2f'
main.o(.text+0x18c):main.c: undefined reference to `_imp__glEnd'
main.o(.text+0x193):main.c: undefined reference to `_imp__glPopMatrix'
main.o(.text+0x19f):main.c: undefined reference to `_imp__glIndexi'
main.o(.text+0x1a9):main.c: undefined reference to `_imp__glPushMatrix'
main.o(.text+0x1bf):main.c: undefined reference to `_imp__glRotatef'
main.o(.text+0x1ce):main.c: undefined reference to `_imp__glBegin'
main.o(.text+0x1e5):main.c: undefined reference to `_imp__glVertex2f'
main.o(.text+0x1fc):main.c: undefined reference to `_imp__glVertex2f'
main.o(.text+0x206):main.c: undefined reference to `_imp__glEnd'
main.o(.text+0x20d):main.c: undefined reference to `_imp__glPopMatrix'
main.o(.text+0x214):main.c: undefined reference to `_imp__glFlush'
main.o(.text+0x239):main.c: undefined reference to `_imp__glViewport'
main.o(.text+0x24b):main.c: undefined reference to `_imp__glMatrixMode'
main.o(.text+0x255):main.c: undefined reference to `_imp__glLoadIdentity'
main.o(.text+0x298):main.c: undefined reference to `_imp__gluOrtho2D'
main.o(.text+0x2d8):main.c: undefined reference to `_imp__gluOrtho2D'
main.o(.text+0x2ea):main.c: undefined reference to `_imp__glMatrixMode'
main.o(.text+0x2f4):main.c: undefined reference to `_imp__glLoadIdentity'
main.o(.text+0x37b):main.c: undefined reference to `glutPostRedisplay'
main.o(.text+0x3c4):main.c: undefined reference to `glutInitDisplayMode'
main.o(.text+0x3d9):main.c: undefined reference to `glutInitWindowSize'
main.o(.text+0x3fe):main.c: undefined reference to `glutReshapeFunc'
main.o(.text+0x40e):main.c: undefined reference to `glutKeyboardFunc'
main.o(.text+0x41e):main.c: undefined reference to `glutDisplayFunc'
main.o(.text+0x426):main.c: undefined reference to `glutMainLoop'
make.exe: *** [Esercizio1.exe] Error 1
Esecuzione terminata
nella cartella GL che si trova nella cartella include del dev-cpp ho copiato questi files:
nella cartella lib sempre nella cartella del dev-cpp ho copiato il file glut32.lib
poi non ho fatto altro... dovevo copiare qualke altro file che ha a che vedere con le librerie o solo solo questi qui che ho già copiato ?