OpenGL on Debian

Hey, I’m VERY much a newbie when it comes to OpenGL, i’m learning it for one of my highschool classes, i’m working on Debian and i apt-geted all of the openGL/GLUT files, but everytime i compile it complains about not finding files, so i move them to the directory it wants and try again, can anyone tell me what files i need to include and where to get the most basic openGL program to compile, and it you could tell me what the command should look like, that would be helpful to (I don’t think it’s just gcc -o helloworld helloworld.c)
THANKS ALOT

Here is a sample Makefile to build a trivial glut app:

EXE =

SRCS = main.c

OBJS = $(SRCS:.c=.o)

CFLAGS = -g -Wall -I/usr/X11R6/include

LDFLAGS = -L/usr/X11R6/lib -lGL -lGLU -lglut -lm

all: $(EXE)

(EXE): (OBJS)
(CC) -o @ (OBJS) (LDFLAGS)

.PHONY: clean
clean:
(RM) (OBJS) *~ $(EXE)

You need to fill in the executable’s name and the list of sources.

Here is a skeleton main.c:

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

/* Window title */
#define WINDOW_TITLE “Window title”

/* Initial window size */
#define WINDOW_WIDTH 300
#define WINDOW_HEIGHT 200

/*

  • Display callback.

  • Render your scene here.
    */
    static void DisplayCallback(void)
    {

    glFlush();
    glutSwapBuffers();
    }

/*

  • Reshape callback.
  • Reset your view matrix here.
    */
    static void ReshapeCallback(int width, int height)
    {

}

/*

  • Keyboard callback
  • Handle ANSI keystrokes here
    */
    static void KeyboardCallback(unsigned char key, int x, int y)
    {

}

/*

  • Special callback
  • Handle non-ANSI key presses here
    */
    static void SpecialCallback(int key, int x, int y)
    {

}

/*

  • Mouse callback
  • Handle mouse clicks here
    */
    static void MouseCallback(int button, int state, int x, int y)
    {

}

/*

  • Motion callback.
  • Handle mouse motion here
    */
    static void MotionCallback(int x, int y)
    {

}

/*

  • Idle callback.
  • Handle updates here
    */
    static void IdleCallback(void)
    {

}

int main(int argc, char *argv)
{

/* Initialise GLUT */
glutInit(&argc, argv);

/* Initialise window */
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);
glutCreateWindow(WINDOW_TITLE);

/* Install callbacks */
glutDisplayFunc(DisplayCallback);
glutReshapeFunc(ReshapeCallback);
glutKeyboardFunc(KeyboardCallback);
glutSpecialFunc(SpecialCallback);
glutMouseFunc(MouseCallback);
glutMotionFunc(MotionCallback);
glutIdleFunc(IdleCallback);

/* Run it */
glutMainLoop();

return 0;

}

Hope that helps.

[This message has been edited by rts (edited 02-13-2002).]

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.