Skip to content

LuckyIntel/OpenGL-OBJ-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenGL OBJ Loader

How to download

Simply, click "Code" and download as zip.

How to setup project

First, create two folders named "lib" and "libraries" or any name you want in the project folder.

This project needs a glad build that you can get from https://glad.dav1d.de/ simply select C/C++ as the language, set profile to "Core" and at the API section select "gl" version as version 3.3 or more.Unzip glad, and open the "glad" folder.Now we have 2 folders inside that folder.From "include" folder copy and paste both "KHR" and "glad" folders to "libraries" folder in our project.From "src" folder, copy "glad.c" file to our project's folder."glad.c" should be in the same folder as "main.cpp" file.

Now we have to install the GLFW from https://www.glfw.org/ click download and install a GLFW build of your choice, or just build GLFW yourself from the source.After downloading the GLFW, you will see several folders.We are just going to use 2 of them.First, open "include" folder, copy "GLFW" inside our "libraries" folder in the project folder then delete "glfw3native.h" because we're not going to need it.Now about the other folders, you have to choose the correct GLFW library for your compiler.I am using GNU GCC compiler with MinGW so i just open the "lib-mingw-w64" folder and simply copy "libglfw3.a" to our "lib" folder in the project folder.

We have another library that we need to install for algebra and etc. and that is GLM, we can download GLM from https://github.com/g-truc/glm repository.Select a release, download, unzip and then open the folder.Copy "glm" folder to "libraries" folder.

Last library we need is stb, we can download it from https://github.com/nothings/stb just find "stb_image.h" file, then download it.Create a folder named "stbi" in "libraries" folder then copy the "stb_image.h" and paste it to the "stbi" folder.

With these libraries now project is ready to work.For adding "libraries" to include path and "lib" to libraries path, you need to do some settings in your IDE.

Known problems

1. Loading an OBJ file with more than an object causes the texture and/or color to apply on all objects.Planning to be fixed in V0.2

2. OBJLoader.hpp lacks of a triangulater function so loading an OBJ file that is not already triangulated will not work healthily.Planning to be fixed in V0.2

3. OBJLoader.hpp lacks of some faces.Planning to be fixed in V0.2

4. OBJLoader.hpp parseFile function seems to have a problem that's causing every mesh in the model to stack in just one mesh.I also believe this causes texture and color problems.Priority to be fixed in the V0.2 before everything.(Other problems can be delayed to V0.3)

About

Small C++ OpenGL OBJ loader example.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published