.SUFFIXES: .SUFFIXES: .cc .h .o MIMAS=/usr/local LIBTOOL=libtool CXX=g++ MINIMALOBJECTS = minimal.o # CXXOPTS = -Wall -g CXXOPTS = -Wall -O6 -DNDEBUG all: minimal minimal: $(MINIMALOBJECTS) $(LIBTOOL) --mode=link g++ -o $@ $(MINIMALOBJECTS) $(MIMAS)/lib/libmimas.la clean: rm -Rf *~ *.o minimal .libs .deps DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) .cc.o: $(CXX) -Wp,-MD,.deps/$(*F).pp -c $< -o $@ $(CXXOPTS) -I$(MIMAS)/include @-cp .deps/$(*F).pp .deps/$(*F).P; \ tr ' ' '\012' < .deps/$(*F).pp \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ >> .deps/$(*F).P; \ rm .deps/$(*F).pp -include $(wildcard .deps/*.P) :-)
Note, that you need to use tabulators for intendation! You also may have to change the values for QTDIR and MIMAS depending on your installation.
#include <fstream> #include <GL/glut.h> #include <mimas/image.h> #include <mimas/image_fileinput.h> #include <mimas/image_mesaoutput.h> #include <mimas/rgba.h> using namespace mimas; using namespace std; int main( int argc, char *argv[] ) { int retval = 0; try { // Initialise GLUT. glutInit( &argc, argv ); // Throw exception, if argc is not equal to 2. MMERROR( argc == 2, mimasexception, , "Syntax: " << argv[0] << " <image-file>" ); // Load image. image< rgba< unsigned char > > img; ifstream f( argv[1], ios::binary ); MMERROR( f >> img, mimasexception, , "Error reading file \"" << argv[1] << "\"." ); // Access display and open a window. x11_display displ; image_mesaoutput< rgba< unsigned char > > win( &displ ); // Display the image and wait for three seconds. win << img << mimas::wait( 3000 ); } catch ( exception &e ) { // Display error message and set return value. cerr << e.what() << endl; retval = 1; }; return retval; }
$ make
If everything went well, then you should have a program, which can open and display single images.