This project contains the source code for a framebuffer implementation in C++. It allows you to manipulate and display colors on a virtual screen. It also provides functionality to clear the screen, set the current color, and store color values in a vector. This repository was made to use as a template for the different activities in the Computer Graphics course.
Files • Features • How To Use
- src: the file that implements de solution.
- CMakeLists.txt: the CMake configuration.
The main features of the application include:
- Framebuffer: The framebuffer.h file provides a framebuffer vector that represents the virtual screen. It is a 1-dimensional vector of Color objects, with dimensions defined by the SCREEN_WIDTH and SCREEN_HEIGHT constants.
- Color Manipulation: The colors.h file defines the Color struct, which represents an RGB color. It provides functionality to create colors, perform arithmetic operations (addition and multiplication), and clamp color values within a specified range.
- Clearing the Screen: The clear() function in framebuffer.h clears the framebuffer by filling it with the clearColor value. It utilizes the std::fill algorithm to efficiently set all elements of the vector.
To clone and run this application, you'll need Git, CMake, Chocolatey (in order to execute Make) and a C++ compiler installed on your computer. From your command line:
# Clone this repository
$ git clone https://github.com/bl33h/computerGraphicsTemplateFiles
# Open the folder
$ cd src
# Run the app
$ g++ main.cpp -o framebuffer
$ ./framebuffer
# Build the app using CMake
$ cmake -G "Unix Makefiles" -S . -B build
$ cd build/
$ make
$ GAME.exe