Syllabus   Blank Homework   Quizzes  
Notes   Labs   Scores   Blank

Lab 2, due 1/16/19 (Wed), 6 pm
Dr. Tong Lai Yu

Introduction to Shader Programming

    Write a program that displays the OpenGL version you are using to make sure it supports glsl. Then write a shader program that applies the sin function to the y vertex values. The application program sends many points lying on a stright line. (use GL_LINE_STRIP in the application). First render it without the sin function, then modify your vertex shader to render it with the sin function. Observe what would be rendered. Also modify your vertex shader to do the following:
    1. rotate the sin curve by 90o about the z-axis
    2. translate the curve by (1, 1 )
    3. reflect the curve about the y-z plane
    4. scale it in y the direction by a factor of 3

    Experiment with various colors by modifying your fragment shader. Repeat the experiment with any other function you have learned and are interested.

Compile and run the program.

  • Write a report that shows all your work; make sample screen shots of your graphics outputs of the problem. Comment on and self-evaluate your work; state explicilty whether you have finished each part successfully! If you have finished all parts succussfully, give yourself 20 points, otherwise deduct some points that you feel apropriate. The instructor may adjust your score depending on your submitted report.

    Note: All your work must be saved in pdf file format and submitted online! Typically, your submitted pdf file should should consist of the source code you write that is highlighted. It should also have a screen shot of the output of the program. (But do not use screen shot for text outuput, including source code.) You must also put down your name but not your student ID in your submitted report. To submit your lab, you must first login by choosing your name, entering your student id, and clicking Login below.

    Choose your name:
    Enter your student id (xxxxxxxxx):