Vivid is an OpenGL-based rendering framework providing an intuitive 2D and 3D rendering API.
Shader-Based Rendering: The renderer utilizes the power of shaders to achieve real-time rendering with support for vertex, fragment, and geometry shaders. This allows for flexible and efficient customization of the rendering pipeline.
Basic Shapes: Easily render basic geometric shapes like cubes, spheres, cylinders, and planes. These primitives can be manipulated and combined to create complex scenes.
Texture Mapping: Apply textures to objects for more realistic and visually appealing results. Experiment with different materials and lighting setups.
Camera Controls: The renderer includes a camera system that allows you to navigate and explore the 3D environment using mouse and keyboard controls.
Lighting: Implement point-light lighting models.
Model Loading: Import 3D obj models from external files to populate your scenes with intricate designs.
User Interface: The renderer comes with a simple user interface that provides controls for adjusting rendering settings, camera parameters, and more.
To integrate this library into your project all you have to do is in your CMakeLists.txt add this folder as a subdirectory: add_subdirectory(Vivid)
.
Once this is done you can link this library by simply writing:
target_link_libraries(project_name
Vivid)
After this, you could simply write #include "Vivid.h"
, and use the Vivid API.
To get started follow these steps:
git clone git@github.com:Aviii06/Vivid.git
cd Vivid
git submodule update --init --recursive
Before running the renderer, ensure you have the necessary dependencies installed. This includes an OpenGL driver, a C++ compiler, and the necessary libraries (GLEW, GLFW, etc.).
Here is a checklist of dependencies for different operating systems:
- OpenGL
- CMake
- xorg-dev
- libglu1-mesa-dev
- freeglut3-dev
- mesa-common-dev
- libgl1-mesa-dev
- libglew-dev
- mesa-utils
- freeglut3-dev
- GTK (default)
- Make sure libgtk-3-dev is installed on your system.
build-essential
andlibgtk-3-dev
- OpenGL
- On MacOS, add AppKit and UniformTypeIdentifiers to the list of frameworks.
- OpenGL
- On Windows (both MSVC and MinGW), ensure you are building against ole32.lib, uuid.lib, and shell32.lib.
Doxygen
is used along with graphviz
and umlet
.
Use the provided build system (CMake, Makefile, etc.) to build the renderer. Make sure to configure the build with the appropriate settings for your system.
mkdir build && cd build
cmake .. -G Ninja
ninja -j8
The project comes with many example executables, like marchingSquare and ecs_test. You can directly run these binaries.
Once the renderer is running, feel free to explore the various features it offers. Modify shaders, adjust camera settings, load different models, and experiment with lighting configurations.
The API is inspired primarily by processing foundation.
You have a Rendering Interface which comes with 3 main functions: Setup()
, Draw()
, and ImGuiRender()
. You can create a new class which extends to RenderingInterface and override these functions.
This provides a multitude of different rendering APIs all with different levels of control to ease.
This API provides a complete entity-component-based architecture. You can initialise an entity and give it many components and they all get rendered automatically. This is useful for creating complex scenes with many objects.
For more information go to the ECS API
These APIs create a more processing-like feel to rendering. You call a Vivid::Renderer2D::Init();
or Vivid::Renderer3D::Init();
and can call many functions like Vivid::Renderer2D::DrawLine(point1, point2, thickness, color);
and more.
This makes it easy to create a small simulation which is not overly complicated.
This is useful for small renders. You can simply create a Mesh object from an Obj file and then render it out by calling the Draw(camera)
method.
This is an interface which is provided by Vivid to ease the rendering process.
class ExampleInterface : public Rendering
The Setup()
function runs once and is useful for initializing your variables.
The first line of the setup is reserved for your openGL configs. You can write your own configs or use one of the premade configs.
For 3D it is recommended to use: OPENGL_CONFS
And for 2D: OPENGL_2D_CONFS
This function is called every frame. And is not inside the ImGUI context.
This function is similar to Draw()
but is inside ImGUI context so this could be used to create custom UI elements.
To see examples using these APIs you can look in the examples folder in the root directory of the repo.
First in your Setup()
function use the macro OPENGL_2D_CONFS
.
To get started with 2D API you need to call Vivid::Renderer2D::Init();
in your Setup()
function. This initializes the 2D renderer.
In your Draw()
loop call Vivid::Renderer2D::BeginScene();
and once all the DrawCalls have been made call Vivid::Renderer2D::EndScene();
In between these two functions, you can use the Renderer2D API to render anything. This all gets BatchRendered for optimal performance.
Examples can be found in examples/examples2D
.
Write the Vivid::CreateApplication()
function:
Application* Vivid::CreateApplication()
{
Application* app = Application::GetInstance(1920, 1080, "Rendering2D");
OrthoCamera* orthoCamera = new OrthoCamera(0, 1920, 0, 1080);
app->SetCamera(orthoCamera);
app->SetRenderingInterface(new ExampleInterface);
return app;
}
It is advised to have OrthoCamera
for 2D scenes.
This is a client-side function which is used in the library to create an Application.
After the in your main function simply call: return Vivid::main(0, nullptr);
This calls Vivid's main function.
First in your Setup()
function use the macro OPENGL_CONFS
.
The 3D rendering API is still WIP.
Currently for 3D rendering it is advised to use the ECS based approach.
Examples can be found in examples/examples3D
.
Write the Vivid::CreateApplication()
function:
Application* Vivid::CreateApplication()
{
Application* app = Application::GetInstance(1920, 1080, "Rendering2D");
app->SetRenderingInterface(new ExampleInterface);
return app;
}
By Default it uses EditorCamera
which provides WASD movements and mouse control.
After the in your main function simply call: return Vivid::main(0, nullptr);
This calls Vivid's main function.
#Contribute If you find issues or want to contribute enhancements, fork the repository, make your changes, and submit a pull request. We welcome contributions from the community.
For more detailed information on how to use the renderer, including API documentation and usage examples, refer to the Documentation of this repository.
This project is licensed under the MIT License, which means you are free to use, modify, and distribute the code as long as you include the original license text.