Giter Club home page Giter Club logo

opengl-model-viewer's Introduction

OpenGL Model Viewer

This project is a real-time renderer for .stl format files, built using the OpenGL graphics API. I primarily used Joey de Vries' tutorials at learnopengl.com to teach myself OpenGL, and they inspired much of this design.

Features

Fully adjustable ambient, diffuse and specular (Phong) lighting

Alien

Mouse, scroll and keyboard controls for oribiting and zooming around the model

Bust

Explode effect on start

Elephant

Ability to load high-detail (> 1 million polygons) models

Head

Adjustable FOV

Rat

Sample models retrieved from turbosquid.com:

Files

File Contents
main.cpp config.ini file parsing, GLFW setup, OpenGL setup, input processing functions and main rendering loop
camera.hpp/cpp Camera class: stores camera position and angle state, handles camera movement and FOV adjustment, calculates view and projection matrices
mesh.hpp/cpp Mesh class: loads and stores mesh vertices and indices, draws meshes
model.hpp/cpp Model class: recursively processes, loads and stores meshes, iteratively draws those meshes
shader.hpp/cpp Shader class: loads, compiles, links and binds shaders, updates shader uniforms
shaders/model/*.glsl GLSL shaders for the model. geometry.glsl only exists for explode effect
config.ini Configuration file for changing any model, material, lighting, graphical or window properties that may need to be customized. I have future plans to move this configuration to a GUI

Dependencies

Library Description Link
OpenGL Open-source graphics API, written by graphics hardware manufacturers. This project uses version 4.1 as it is pre-installed on all modern MacOS devices Website
GLFW Cross-platform library used for window management, OpenGL context management, and user input processing Website
Assimp Library for importing 3D models Website
GLM Math library for OpenGL programming, designed with GLSL in mind. Used for vector and matrix operations Website
inih .ini file parsing library. Used to parse config.ini Original Library
Header-only version used

Build

This project has not been tested on any platforms other than my development machine (2018 MBP). I may look into improving this in the future.

opengl-model-viewer is expected to work on all MacOS machines, but this is unverified. It will not work on Windows or Linux machines without modifcation to the OpenGL importing process (this project uses the preinstalled OpenGL found on MacOS, and therefore does not use a extension loading library such as GLEW). The GLFW installation should also be modified as it is now using a MacOS-only pre-compiled binary. Assimp, GLM, and inih should not need modification for building on other systems.

opengl-model-viewer's People

Contributors

shanetwilliams avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.