PDA

View Full Version : linux framework



sebastian
10-08-2000, 02:55 AM
hi,

could someone send me a simple openGL framework app ( res. switching, init code,..) for linux? i dont need special fx, just the setup would be cool...

thanks in advance,

sebastian ( sebastian_posch@c4.com )

rts
10-08-2000, 10:31 AM
Originally posted by sebastian:
hi,

could someone send me a simple openGL framework app ( res. switching, init code,..) for linux? i dont need special fx, just the setup would be cool...


The easiest way to get started is with GLUT




int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(640, 480);
glutCreateWindow(argv[0]);

/* Initialise stuff */
init();

/* Register callbacks */
glutDisplayFunc(displayCallback);
glutMouseFunc(mouseCallback);
glutIdleFunc(idleCallback);

glutMainLoop();
return 0;
}


Here's a simple Makefile:




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

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

PROG = my_executables_name

SRC = main.c somethingelse.c blah.c

OBJ = $(SRC:.c=.o)

all: $(PROG)

$(PROG): $(OBJ) Makefile
$(CC) -o $@ $(OBJ) $(LDFLAGS)

$(OBJ): Makefile


Hope this helps

MC
10-10-2000, 02:20 AM
You can use:

- Plain X commands, not difficult but not very friendly

- Use a third party library: glut or better, SDL, the last version (1.1.5) is really better than GLUT (true full screen, can change video mode, advanced event handling, sound support etc...). Check it at: http://www.libsdl.org/

rts
10-10-2000, 08:13 AM
Originally posted by MC:

- Use a third party library: glut or better, SDL, the last version (1.1.5)

Doh! How could I forget to mention
the fine SDL library? :P

Just to second what MC says,
yes, SDL is also a good thing to use to
quickly get started.