Introduction to Computer Graphics


Windows Setup



0. Install MinGW

WIP: Follow 64-bit directions if you are having more trouble with the following directions. I can do a nicer write-up if needed! MingGW does indeed work however! You can also try this tutorial: https://dorinlazar.ro/making-sdl2-and-gcc-5-2-work-together-on-windows/


MinGW is the minimalist version of the GNU environment for windows.

glxinfo I recommend the following basic packages to get started glxinfo

1. Setup - Finding our OpenGL Version


The first thing we want to do on our windows systems, is check which version of OpenGL we have.

  • In order to do this you will download the OpenGL Extension Viewer: GLView
  • GLView Download Link
  • glxinfo Notice in the OpenGL section I have version 4.4 on my machine.
  • If your machine is greater than 3.3 you are all set! If it is less than that, then let me know!

2. Identifying your graphics card


The GLView tool also provides information about your "Renderer" which is your graphics card.

  • View from the above screnshot your graphics card in the Systems Info area.
  • You will also see some useful information such as how much video memory (VRAM) you have available.
  • You can keep this in mind for later on in the semester.

3. Files - Downloading SDL


Now follow the directions to acquire SDL. I am assuming by this step you have properly downloaded MinGW wtih C++ installed. Please do that first. In addition, if you do not have success following my directions for whatever reason, you may try instead https://w3.cs.jmu.edu/bernstdh/web/common/help/cpp_mingw-sdl-setup.php

Windows Users:

At this point, you have now successfully aquired the SDL libraries. Now, move on to the next step.


4. GLAD - OpenGL Extensions


Note: I have done this setup for you in the repository.

GLAD is a tool that helps us use extensions in OpenGL. An OpenGL extension is some feature or functionality that a graphics card vendor provides. In other words, extensions are released over time, and they allow us to run a variety of commands on graphics cards to improve performance, or create neat visual effects.

Some information below.
  • A permanent link to the 3.3 profile I generated for this course is here. I have provided GLAD in the code repository already.
  • If you look at glad.h, you will see that it is essentially a giant list of function pointers.
  • (Optional just FYI): You can generate your own profile here: GLAD webservice
  • (Optional) If you are still having trouble, this link may be of use:GLAD and SDL2

5. Build - Linking SDL with source


Now that we have GLAD and SDL downloaded, we are ready to try and run our program. Depending on if you have a 64 bit machine or a 32 bit machine, you should follow the appropriate directions.

Note: I will be showing this for the 32 bit version of MinGW.

  1. Copy the .a files from the SDL
  2. MingGW
  3. Paste them in your
  4. MinGW
  5. Next copy the SDL directory include/ folder
  6. MinGW
  7. Paste into the MinGW include/ directory
  8. MinGW
  9. Next copy the SDL2.dll into the bin directory where you executable will be made. Note that you can see where the test program is that I have made (within an instance of MinGW), and that I have the .dll directly in the directory. Again, the directly I am copying from is the i686-w64-mingw32.
  10. MinGW
  11. Provide with the lab is a file called "mingwbuild64.sh". By running "mingwbuild64.sh" on your system, your file will actually compile just fine. However, let me show a "raw" version of compiling so you understand what is going on.
    • g++ -o test.exe lab.cpp -lmingw32 -lSDL2main -lSDL2
    • g++ - is our compiler
    • -o tells us to output and name the file test.exe
    • Our source files follow
    • Anything with "-l" (lowercase l) tell to include libraries of code for SDL.
  12. If the code compiles and you get weird runtime errors you can try the following:
    • g++ -static-libgcc -static-libstdc++ -o test.exe test.cpp -lmingw32 -lSDL2main -lSDL2 -mwindows
    • If errors persist, make sure you are not mixing 32 and 64 bit versions of .dlls or libraries.

6. Video Tutorial


If the instructions above did not work for whatever reason, you can try following this video tutorial I quickly made.

 

TBD!

 

(Best viewed in HD if you want to read the text).