Asg 4: Draw Lines of Points

Objectives

Using the point_t object, read a file, and add points to a list (std::vector), then draw them in a 2D GLUT window.

Assignment

  1. Using the C++ code from Assignment 02 and Assignment 03 use the code where point_t objects are stored on a std::vector<point_t* > list (vector) of pointers, then iterate through that list to draw a sequence of lines using OpenGL.

Details

  1. Your OpenGL code should set up a projection matrix with gluOrtho2D(0.0,w,0.0,h);
  2. Your OpenGL code should just use an identity matrix for the modelview matrix, i.e., glLoadIdentity();

Requirements

  1. Make sure to create a new point_t* each time data is read in (this gets added to the list)
  2. Make sure that you properly delete the list of points by deleteing each point pointer as you erase each one from the list (i.e., when the program exits)

Input

  1. The pointdata.txt file used to test the above program is:
    15 14
    600 320
    104 29
    19 78
    450 321
    	

Output

  1. Expected output with the above input file is:
    *** printing list
    15.00, 14.00
    600.00, 320.00
    104.00, 29.00
    19.00, 78.00
    450.00, 321.00
    	
    and a window showing something like what appears below:

Supplemental

  1. Here is a Makefile that you can use to compile the project:
    .SUFFIXES: .c .o .cpp .cc .cxx .C
    
    UNAME = $(shell uname)
    PLATFORM = $(shell uname -p)
    
    CC = g++
    COPTS = -g -Wall
    
    INCDIR =
    LIBDIR =
    
    ifeq ("$(shell uname)", "Linux")
    INC = \
      -I/usr/lib/glut-3.7/include
    LIBDIR = \
      -L/usr/lib -L/usr/X11R6/lib -L/usr/lib/glut-3.7/lib/glut
    LIBS = \
      -lglut -lGLU -lGL -lXmu -lXi -lXext -lX11 -lm
    else
    ifeq ("$(shell uname)", "Darwin")
    LIBS = \
      -framework OpenGL -framework GLUT -framework Foundation -lstdc++
    endif
    endif
    
    .c.o:
    	$(CC) -c $(INCDIR) $(COPTS) -o $@ $<
    
    .cpp.o:
    	$(CC) -c $(INCDIR) $(COPTS) -o $@ $<
    
    all : main
    
    OBJECTS = \
    point.o
    
    main : $(OBJECTS) main.o
    	$(CC) -o $@ $(INCDIR) $(COPTS) $(OBJECTS) $@.o $(LIBDIR) $(LIBS)
    
    point.o: point.h point.cpp
    
    clean :
    	rm -f *.o
    	rm -rf main
    	

Turn in

Turn in all of your code, in one tar.gz archive of your asg##/ directory, including:
  1. A README file containing
    1. Course id--section no
    2. Name
    3. Brief solution description (e.g., program design, description of algorithm, etc., however appropriate).
    4. Lessons learned, identified interesting features of your program
    5. Any special usage instructions
  2. Makefile
  3. source code (.h headers and .cpp source)
  4. object code (do a make clean before tar)

How to hand in

See handin notes

Grading scheme