This project showcases texture rendering in OpenGL, using custom shaders and UI controls built with Dear ImGUI. The program renders two textures of Yoshi, 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;
}
Project Root
├── OpenGL1.sln // Visual Studio solution file
├── .gitattributes
├── .gitignore
├── bin // Binary files
├── Dependencies // External dependencies
│ ├── x86
│ │ ├── GLEW
│ │ └── GLFW
│ └── x64
│ ├── GLEW
│ └── GLFW
│
├── Release // Pre-compiled executables
│ ├── OpenGL1_x64.bat // Run x64 OpenGL1
│ ├── OpenGL1_x86.bat // Run x86 OpenGL1
│ └── Platforms
│ ├── x64 // 64-bit builds
│ │ └── OGL-P1 // Contains the necessary files to run the executable.
│ │ └── Assets
│ │ ├── Shaders
│ │ └── Textures
│ └── Win32 // 32-bit builds
│ └── OGL-P1 // Contains the necessary files to run the executable.
│ └── Assets
│ ├── Shaders
│ └── Textures
│
└── OpenGL1
├── Assets // Stores shaders, and textures.
│ ├── Textures
│ └── Shaders
│
└── Project // Contains the source code for the OpenGL1 Project.
├── include
└── source
Clone the repository:
git clone https://github.com/Pecas-Dev/OpenGL-Project-1.git
The easiest way to run the simulation is using the pre-compiled executables:
- Navigate to the
Release
folder. - Choose the appropriate version for your system (
x64
or86
). - Run the
OpenGL1_x64.bat
orOpenGL1_x86.bat
or file.
To build the project from source:
- Open
OpenGL1.sln
in Visual Studio. - Choose your configuration (Debug/Release) and platform (x64/x86).
- Build the solution.
- Run the program.
- Use Dear ImGUI UI controls to move textures and change the background color.
This project was created by Pecas Dev.