Laborations

Important: Every lab 1-4 starts with a “dugga”, a short written test which takes about 15 minutes. This test is part of the grading system in order to make a larger part of the course material relevant for the grades. The alternative would be a full-scale exam but this is IMHO better in many ways. The fifth lab, lab 5, has an “omdugga” opportunity where you can try all the tests (with different but similar questions) again, giving you a second chance. There is no “fail” limit on the duggas, they are part of the total score and will be added to the score for the project.

The tests will cover both subjects relevant to the lab and other subjects covered in the recent lectures. I am aware that you will deepen your understanding on some parts during the lab, but you are expected to have gained some knowledge about that before the lab.

Concerning the second chance: You can not lower the result. A failed second chance will not ruin a better earlier result.

1. Generating procedural images on CPU and in GLSL

Dugga based on lecture 1-3

2. Using Open Shading Language in Blender or 3DSMAX

Dugga based on lecture 4-5

3. Fractals, terrains

Dugga based on lecture 6-7

4. Generating and modifying 3D shapes using geometry and tesselation shades

Dugga based on lecture 8-9

R1, R2: Two extra lab sessions if you havn’t finished. R1 starts with a retake for all duggas!

The lab material for most labs is originally designed for Linux but also runs under MacOSX and Windows. In the lab we use Codeblocks, and the lab material includes CodeBlocks project files.

Any other platform using MinGW may work. For lab 2, we will either use Blender, which is available for all three platforms, or 3DSMAX, which only works on Windows.


Using Codeblocks

Note: Project files for CodeBlocks are included so as long as they work you do not need to create new ones. Below is a guide for how make new ones (possibly a bit outdated, I will test it again ASAP).

Codeblocks is installed in the lab. Gabriel, my lab assistant, had the great idea to try it, and he found that he could mostly use my instructions, and it worked!

I have now went through the process while writing down how it works:

Create a new project

Select “OpenGL project”, name it suitably.

This creates a new folder. Best location: Side-by-side with the “common” folder.

Unpack the lab files. Put them in the folder you just created.

Right-click the project name

  Add files

    .c from lab files

    .c from common

    .c from common/WIndows

Go to Project->Build options

  Select “Search directories”

  Add common and common/WIndows

This will make the compiler find your .h files.

Build and run!

Problems? Shaders/models/textures not found? Are they located in the same folder as the project? Are you using my project file and “common” are not found? Is it located as specified, beside the new project folder?

PS: Under Window 10 and 11, you may have to install the latest graphics drivers/reinstall the drivers. Sounds a bit strange to me, but here is what I found:

Windows 10 and 11 problem

They mostly talk about reinstalling the drivers. I do not know if this really is the best fix. Let me know if this helps. I can’t test it myself at the moment.

Using Mac or Linux

I have included makefiles for Mac and Linux in one lab and plan to extend that in the future if those labs remain. There are also IDEs for both platforms, including Codeblocks.

This section may be extended in the future, when time allows.


Using DevC++ (now obsolete for the lab computers)

If you use Windows (which we must do in the lab) my main target was originally Embarcadero DevC++ (former Bloodshed DevC++). 

NOTE: Since DevC++ is not in the lab and Codeblocks seems to be working reasonably well, I am shifting towards Codeblocks as the new default.

This is a rather comfortable IDE which is easy to set up. It does have its issues, but I find it adequate for lab use. Any development system based on MinGW should work. However, Microsoft Visual Studio will not, because it has problems with error reporting.

In order to set up a project (e.g. a lab) for DevC++, do this:

Download Embarcadero DevC++ 6.3 if you don’t already have it.

Select File->New->Project (can also be done by clicking the left toolbar icon)

Select Multimedia, OpenGL, C project

Fill in a suitable name, e.g. Lab1

Save in the lab folder.

Right-click the project name in the Project area (left)

Add to project

Do this for all needed files, the main program, C files in common and also in common/Windows.

Note that you can ctrl-click to select several.

Remove “main.c”

Go to Tools -> Compiler options. You need to tell the compiler about search paths:

-I../common -I../common/Windows -I noise

This assumes that the common folder is located besides the lab folder, which I think is sensible.

Now you can compile with F9, run with F10… Sadly, you need to select the main program before compiing or the IDE will try to compile your shader.

© Ingemar Ragnemalm 2021