This project showcases texture rendering in OpenGL, using custom shaders and UI controls built with Dear ImGUI. The program renders two textures of Yoshi, the popular character from Super Mario, on two separate squares, allowing real-time control of their positions and background color through the UI. Developed entirely from scratch, this project explores OpenGL’s rendering pipeline, including vertex and fragment shaders, buffers, and texture handling. The use of Dear ImGUI demonstrates the integration of UI elements to control and modify object properties dynamically.
- Window Creation: Set up from scratch to create a rendering window.
- Rendering Pipeline: Custom implementation of the OpenGL rendering pipeline, including shaders and texture handling.
- Textures: Two Yoshi textures are rendered on two squares, created from triangles.
- UI Controls: Dear ImGUI integration to allow real-time modification of texture positions and background color.
Handles the transformation of 3D coordinates into screen space and passes texture coordinates to the fragment shader.
layout (location = 0) in vec4 position;
layout (location = 1) in vec2 textureCoordinate;
out vec2 vTextureCoordinates;
uniform mat4 uModelViewProjectionMatrix;
void main()
{
gl_Position = uModelViewProjectionMatrix * position;
vTextureCoordinates = textureCoordinate;
}
Renders the texture color on the object, blending it with the background color.
layout (location = 0) out vec4 color;
in vec2 vTextureCoordinates;
uniform vec4 uColor;
uniform sampler2D uTexture;
void main()
{
vec4 textureColor = texture(uTexture, vTextureCoordinates);
color = textureColor;
}
- Dependencies: External libraries like GLEW and GLFW required for OpenGL rendering.
- Release: Contains the final executable of the project.
- OpenGL1: The main project folder containing:
- Assets: Stores shaders and textures used in the project.
- Include: Contains header files, including external libraries like glm, ImGUI, and stb_image.
- Source: Contains C++ source files and main.cpp (App.cpp).
- Clone the repository:
git clone https://github.com/Pecas-Dev/OpenGL-Project-1.git
-
Navigate to the Release folder within the project directory. Inside, you will find an executable that allows you to run the app directly.
-
If you prefer to build the project manually, open the solution in Visual Studio, choose the x86 Platform, and build the project.
-
Once the program is running, you can use the Dear ImGUI interface to manipulate the textures and background color in real-time.
- Use Dear ImGUI UI controls to move textures and change the background color.
This project was created by Pecas Dev.