Replace line 43 with the following piece of code:
int framebufferWidth;
int framebufferHeight;
glfwGetFramebufferSize(this->window, &framebufferWidth, &framebufferHeight);
glViewport(0, 0, framebufferWidth, framebufferHeight);
In the first exercise, your task is to implement two different line rasterization algorithms. The exercise skeleton will handle the canvas; you will only tell it where and which color to draw a pixel.
The drawing canvas contains a grid with two separate points. You can position the points any way you like. The position of these points is also the input of your functions you will be implementing.
Make sure you test all the possible combinations of the two points' positions before handing in the exercise: horizontal lines, vertical lines (both directions!), almost vertical, and so on.
Make yourself comfortable using the debugger. Not just printing out to the console. The red dot is your closest friend. Use it often.
Implement a basic DDA line algorithm. No bells nor whistles required.
Add one bell and a couple of whistles. Copy your finished DDA algorithm and add anti-aliasing.
If the resulting pixel position isn't exactly aligned to the grid, color both positions. If it falls 90% to one position, draw the 90% color intensity there and the rest 10% to the other position.
Implement basic Bresenham line algorithm.
Since the framework by default has problems with retina, you may need to apply this quick fix:
Replace line 43 with the following piece of code:
int framebufferWidth;
int framebufferHeight;
glfwGetFramebufferSize(this->window, &framebufferWidth, &framebufferHeight);
glViewport(0, 0, framebufferWidth, framebufferHeight);
Add the following line between lines 156 and 157:
ImGui::SetWindowFontScale(0.5);