Git Product home page Git Product logo

learnopengl's Introduction

learnopengl.com code repository

Contains code samples for all chapters of Learn OpenGL and https://learnopengl.com.

Windows building

All relevant libraries are found in /libs and all DLLs found in /dlls (pre-)compiled for Windows. The CMake script knows where to find the libraries so just run CMake script and generate project of choice.

Keep in mind the supplied libraries were generated with a specific compiler version which may or may not work on your system (generating a large batch of link errors). In that case it's advised to build the libraries yourself from the source.

Linux building

First make sure you have CMake, Git, and GCC by typing as root (sudo) apt-get install g++ cmake git and then get the required packages: Using root (sudo) and type apt-get install libsoil-dev libglm-dev libassimp-dev libglew-dev libglfw3-dev libxinerama-dev libxcursor-dev libxi-dev libfreetype-dev libgl1-mesa-dev xorg-dev .

Build through CMake-gui: The source directory is LearnOpenGL and specify the build directory as LearnOpenGL/build. Creating the build directory within LearnOpenGL is important for linking to the resource files (it also will be ignored by Git). Hit configure and specify your compiler files (Unix Makefiles are recommended), resolve any missing directories or libraries, and then hit generate. Navigate to the build directory (cd LearnOpenGL/build) and type make in the terminal. This should generate the executables in the respective chapter folders.

Build through Cmake command line:

cd /path/to/LearnOpenGL
mkdir build && cd build
cmake ..
cmake --build .

Note that CodeBlocks or other IDEs may have issues running the programs due to problems finding the shader and resource files, however it should still be able to generate the executables. To work around this problem it is possible to set an environment variable to tell the tutorials where the resource files can be found. The environment variable is named LOGL_ROOT_PATH and may be set to the path to the root of the LearnOpenGL directory tree. For example:

`export LOGL_ROOT_PATH=/home/user/tutorials/LearnOpenGL`

Running ls $LOGL_ROOT_PATH should list, among other things, this README file and the resources directory.

Mac OS X building

Building on Mac OS X is fairly simple:

brew install cmake assimp glm glfw freetype
cmake -S . -B build
cmake --build build -j$(sysctl -n hw.logicalcpu)

Create Xcode project on Mac platform

Thanks @caochao: After cloning the repo, go to the root path of the repo, and run the command below:

mkdir xcode
cd xcode
cmake -G Xcode ..

Glitter

Polytonic created a project called Glitter that is a dead-simple boilerplate for OpenGL. Everything you need to run a single LearnOpenGL Project (including all libraries) and just that; nothing more. Perfect if you want to follow along with the chapters, without the hassle of having to manually compile and link all third party libraries!

learnopengl's People

Contributors

64 avatar agnat avatar alexpanter avatar ankitsinghkushwah avatar butchdean avatar daeunsong avatar domgries avatar dotlive avatar elect86 avatar github-jane-doe avatar haraldreingruber-dedalus avatar ibbles avatar joeydevries avatar jonassorgenfrei avatar jsoref avatar kr4ftw0rk avatar linesight avatar lpapp-foundry avatar mahiuchun avatar nicholasblaskey avatar pattakosn avatar rbarkmore avatar renardjojo avatar shivmsit avatar snowylake avatar utoni avatar v7medz avatar yc-feej avatar zmertens avatar zryan3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

learnopengl's Issues

Performance warning

In deferred_shading.cpp:231, on intel HD4000 i got, what this buffer alredy bound

So maybe this line is unnecessary?

IBL textured example does not copy over all required shaders

The IBL specular textured example uses multiple shaders from the previous example:

Shader equirectangularToCubemapShader("2.2.1.cubemap.vs", "2.2.1.equirectangular_to_cubemap.frag");
Shader irradianceShader("2.2.1.cubemap.vs", "2.2.1.irradiance_convolution.frag");
Shader prefilterShader("2.2.1.cubemap.vs", "2.2.1.prefilter.frag");
Shader brdfShader("2.2.1.brdf.vs", "2.2.1.brdf.frag");
Shader backgroundShader("2.2.1.background.vs", "2.2.1.background.frag");

But the pre build event will only copy the two pbr shaders and needs to be adjusted.

Just a minor issue as you can still copy over the shaders manually to run the sample.

unable to make Unix make file using cmake 2.8

Hello,

I am using Ubuntu 14.04 with Clion. I am unable to make Unix Make files using cmake. My current cmake version is 2.8.

here is the cmake error while building Unix makefiles.
"Error in configuration process, project files may be invalid"

Thanks in advance.

mac build failed

build git:(master) make -j8
[ 3%] Built target STB_IMAGE
[ 3%] Built target GLAD
[ 4%] Linking CXX executable bin/1.getting_started/1.getting_started__2.1.hello_triangle
[ 6%] Linking CXX executable bin/1.getting_started/1.getting_started__2.4.hello_triangle_exercise2
[ 7%] Linking CXX executable bin/1.getting_started/1.getting_started__2.2.hello_triangle_indexed
[ 7%] Linking CXX executable bin/1.getting_started/1.getting_started__2.3.hello_triangle_exercise1
[ 6%] Linking CXX executable bin/1.getting_started/1.getting_started__1.2.hello_window_clear
[ 8%] Linking CXX executable bin/1.getting_started/1.getting_started__1.1.hello_window
[ 8%] Linking CXX executable bin/1.getting_started/1.getting_started__2.5.hello_triangle_exercise3
[ 9%] Linking CXX executable bin/1.getting_started/1.getting_started__3.1.shaders_uniform
Undefined symbols for architecture x86_64:
"_CVDisplayLinkCreateWithCGDisplay", referenced from:
__glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
__glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
"_CVDisplayLinkGetNominalOutputVideoRefreshPeriod", referenced from:
_vidmodeFromCGDisplayMode in libglfw3.a(cocoa_monitor.m.o)
"_CVDisplayLinkRelease", referenced from:
__glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
__glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
ld: symbol(s) not found for architecture x86_64

need CoreVideo framework?

Floor Size Difference between 'Advanced Lighting' and 'Gamma Correction'

Hi Joey, these tutorials are seriously the best. I ran into a gotcha between the two aforementioned tutorials and this is just a suggestion to prevent anyone else from running into it too.

I noticed a difference in lighting between my implementation of 'Gamma Correction' from the repository version; my version seemed several shades darker. I spent about an hour tracking down what it was because I knew I had to get this right to make sure I was handling gamma correction the right way.

What I had done was use the code I wrote while following the 'Advanced Lighting' tutorial as a template for 'Gamma Correction'. My mistake was that the model data for the size of the floor changes from 8x8 units to 5x5 units between the two. My 'floor' was wider than the repository demo, so the light hits less area, and the surface 'appears' darker. Missing this made me think I had errors in handling gamma.

I recommend changing the model size in 'Advanced Lighting' to 5x5 units since the model size doesn't affect that tutorial as much; this would keep anyone else from making the same mistake. Anyway, just a suggestion!

Possible fix for PBR shader

Adding the " + 0.001;" solves similar/identical artifacts noted a few lines bellow (divide by zero), only reason why i say possible is it only occurs in high angles with reflective surfaces (roughness < 1.0f)
float G = GeometrySmith(N, V, L, roughness) + 0.001 ;

Easiest surface to test it on is a normal map with low roughness, move view down and look along the horizon and towards the light source

Using your code with GLEW instead

Hi, thanks so much for these tutorials that are helping me out to dig into OpenGL.
I am using your code, everything is almost is the same, except the main, since I use GLEW. However I get a black screen. I tryed by changing the camera position, no luck though.

I wil just post to the main, since the rest remains as you did.

int main()
{
	
	// glfw: initialize and configure

	if (!glfwInit())
	{
		fprintf(stderr, "Falló al iniciar GLFW\n");
		getchar();
		return -1;
	}

	glfwWindowHint(GLFW_SAMPLES, 4);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
	//glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Sólo para MAC
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

	// Crea ventana y establece el contexto OpenGL
	
	GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "Render objeto", NULL, NULL);
	if (window == nullptr)
	{
		std::cout << "Falló al crear la ventana GLFW" << std::endl;
		glfwTerminate();
		return -1;
	}

	glfwMakeContextCurrent(window);

	// Initialize GLEW
	glewExperimental = GL_TRUE; //habilita opengl > 2
	glewInit();
	
	// Ensure we can capture the escape key being pressed below
	glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);

	//Manejo mouse y teclado
	glfwSetCursorPosCallback(window, mouse_callback);
	glfwSetScrollCallback(window, scroll_callback);


	// Listener del mouse
	glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);

	//glfwPollEvents();
	// Configurar OpenGL
	// -----------------------------
	glEnable(GL_DEPTH_TEST); 

	// Acepta las caras más cercanas a la cámara
	glDepthFunc(GL_LESS); //puestas por mi

	// Descarta triángulos que no estén frente a la cámara
	glEnable(GL_CULL_FACE); //puestas por mi

	// crea/compila shaders
	// -------------------------
	//ourShader.setShaders("data/shaders/texture.vs", "data/shaders/texture.fs");
	Shader ourShader("data/shaders/texture.vs", "data/shaders/texture.fs",nullptr);

	// Carga modelo	
	Model ourModel("data/modelos/nanosuit.obj");
	//ourModel.setModel("data/modelos/nanosuit.obj");,



	// wireframe
	//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	
	// render loop
	// -----------
	
	while (!glfwWindowShouldClose(window))
	{
		// tiempo por frame
		// --------------------
		float currentFrame = glfwGetTime();
		deltaTime = currentFrame - lastFrame;
		lastFrame = currentFrame;
		
		// input

		processInput(window);

		// render

		glClearColor(0.05f, 0.05f, 0.05f, 1.0f);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		// Habilitar shaders antes de setear uniforms
		ourShader.use();

		// view/projection transformaciones
		glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);
		glm::mat4 view = camera.GetViewMatrix();
		// Setea variables uniforms - globales a todos los píxeles
		ourShader.setMat4("projection", projection);
		ourShader.setMat4("view", view);

		// carga/renderiza modelo
		glm::mat4 model;
		model = glm::translate(model, glm::vec3(0.0f, -1.75f, 0.0f)); // traslada hacia abajo para que esté en el centro de la escena
		model = glm::scale(model, glm::vec3(0.2f, 0.2f, 0.2f));	// achicamos, modelo grande
		ourShader.setMat4("model", model);
		ourModel.Draw(ourShader);


		// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
		// -------------------------------------------------------------------------------
		glfwSwapBuffers(window);
		glfwPollEvents();
	}

	// glfw: terminate, clearing all previously allocated GLFW resources.
	// ------------------------------------------------------------------
	glfwTerminate();
	return 0;
}

// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly
// ---------------------------------------------------------------------------------------------------------
void processInput(GLFWwindow *window)
{
	if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
		glfwSetWindowShouldClose(window, true);

	if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
		camera.ProcessKeyboard(FORWARD, deltaTime);
	if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
		camera.ProcessKeyboard(BACKWARD, deltaTime);
	if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)
		camera.ProcessKeyboard(LEFT, deltaTime);
	if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)
		camera.ProcessKeyboard(RIGHT, deltaTime);
}

I am using VS 2015, I set the path to the shaders and model files, I checked out and are being read.
I appreciate any hint about this.
Best!

cmake Configuration

I recently worked my way through the tutorials, and I had some problems getting all the dependencies installed (campus computer, no admin rights, etc.) so I put together Glitter. Basically it bundles all the dependencies as submodules and statically compiles/links to avoid any dll-copying or installation headaches. I've verified that it works under Mac OSX (10.10) for makefiles/Xcode and Windows (8.1) (VS2013/15), and I'm reasonably confident it builds under most standard flavors of Linux.

Is this of any interest or use to you? Could possibly try to integrate some of it into this repository's cmake configuration or something. In any case, thanks for the tutorials! I found them immensely helpful. 😄

Cleaning textures samples

The textures examples (transformations also) need a quick cleaning, you can remove:

  • the color values from the vbo buffer
  • the color attribute setup in the vao and fixing the stride and offset of the rest
  • the vertex attribute in the shader and the passing color variable

I would have pulled, but since you are reworking the samples, I guess it's easier and faster if you do it :p

Also I am not so confident with C.. I am using Kotlin actually :)

Edit:

  • in transformations render loop, glUniformMatrix4fv shall go after the program binding
  • in camera_keyboard_dt, there is no Do_Movement()
  • in camera_class this is useless float cameraSpeed = 2.5 * deltaTime;
  • add glDeleteTextures() in texture samples
  • in blendingSort, 3.2.blending.vs contains actually a fragment code

A cmake error and some compile errors (win 7, visual studio 2010)

Dear sir,
After I downloaded the source code, I found there is no file naming text_rendering, while will cause some cmake errors. So I commented in the CMakeLists.txt the line 115: 2.text_rendering and successfully cmake the code.
So I continue to run the sln file in the visual studio 2010, but there appeared many errors as follows:

3 > G: \ \ Program \ LearnOpenGL \ LearnOpenGL - master \ includes \ LearnOpenGL/filesystem h (23) : error C2601: "givenRoot" : local function definition is illegal
3 > G: \ \ Program \ LearnOpenGL \ LearnOpenGL - master \ includes \ LearnOpenGL/filesystem h (23) : error C2143: syntax errors: lack of ";"(in front of the "} ")
3 > G: \ \ Program \ LearnOpenGL \ LearnOpenGL - master \ includes \ LearnOpenGL/filesystem h (24) : error C2470: "root", looks like a function definition, but there is no parameter list;Skip the function body
3 > G: \ \ Program \ LearnOpenGL \ LearnOpenGL - master \ includes \ LearnOpenGL/filesystem h (25) : error C2065: "root", not statement of identifiers
3 >..\ SRC \ 5. Advanced_lighting \ 8. Deferred_shading \ deferred_shading CPP (107) : warning C4244: "initialization" : from the "double" to "GLfloat", may be loss of data
3 >..\ SRC \ 5. Advanced_lighting \ 8. Deferred_shading \ deferred_shading CPP (108) : warning C4244: "initialization" : from the "double" to "GLfloat", may be loss of data

I have no idea how to make it, forgive me for my poor English...

typo

In the README on Linux deps, did you mean libglfw3-dev? Without 3, the default package is v2.

Setting CMake GLFW and Assimp library params does not affect generated makefiles

Hello!
So I've stumbled upon this issue while trying to build against mingw env. Setting mentioned CMake project values seems to make no difference in final makefiles as building still tries to search lib files in repository's ./lib folder and headers in ./includes

cmake_conf

Trying to build yield:

E:\WORK\repo\GIT\learnOpenGL_build>mingw32-make
[ 1%] Building C object CMakeFiles/GLAD.dir/src/glad.c.obj
[ 1%] Linking C static library libGLAD.a
[ 1%] Built target GLAD
[ 2%] Building CXX object CMakeFiles/STB_IMAGE.dir/src/stb_image.cpp.obj
[ 3%] Linking CXX static library libSTB_IMAGE.a
[ 3%] Built target STB_IMAGE
[ 3%] Building CXX object CMakeFiles/4.advanced_opengl__10.2.asteroids.dir/src/4.advanced
_opengl/10.2.asteroids/asteroids.cpp.obj
[ 4%] Linking CXX executable E:\WORK\repo\GIT\learnOpenGL\bin\4.advanced_opengl\4.advance
d_opengl__10.2.asteroids.exe
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file

CMakeFiles\4.advanced_opengl__10.2.asteroids.dir/objects.a(asteroids.cpp.obj): In function
ZN6Assimp8Importer8ReadFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEj': E:/WORK/repo/GIT/learnOpenGL/includes/assimp/Importer.hpp:645: undefined reference to Ass
imp::Importer::ReadFile(char const*, unsigned int)'
CMakeFiles\4.advanced_opengl__10.2.asteroids.dir/objects.a(asteroids.cpp.obj): In function
ZN5Model9loadModelERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE': E:/WORK/repo/GIT/learnOpenGL/includes/learnopengl/model.h:55: undefined reference to Assi
mp::Importer::Importer()'
E:/WORK/repo/GIT/learnOpenGL/includes/learnopengl/model.h:60: undefined reference to Assi mp::Importer::GetErrorString() const' E:/WORK/repo/GIT/learnOpenGL/includes/learnopengl/model.h:67: undefined reference to Assi
mp::Importer::~Importer()'
E:/WORK/repo/GIT/learnOpenGL/includes/learnopengl/model.h:55: undefined reference to `Assi
mp::Importer::~Importer()'

E:/WORK/repo/GIT/learnOpenGL/lib/glfw3.lib(CMakeFiles/glfw.dir/init.c.obj):(.text$mn+0x6):
undefined reference to _chkstk' E:/WORK/repo/**GIT/learnOpenGL/lib/glfw3.lib**(CMakeFiles/glfw.dir/init.c.obj):(.text$mn+0xb): undefined reference to __security_cookie'
E:/Programs/MINGW/v510/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: E:/WOR
K/repo/GIT/learnOpenGL/lib/glfw3.lib(CMakeFiles/glfw.dir/init.c.obj): bad reloc address 0x
b in section `.text$mn'
E:/Programs/MINGW/v510/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: final
link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status

CMakeFiles\4.advanced_opengl__10.2.asteroids.dir\build.make:98: recipe for target 'E:/WORK
/repo/GIT/learnOpenGL/bin/4.advanced_opengl/4.advanced_opengl__10.2.asteroids.exe' failed
mingw32-make[2]: *** [E:/WORK/repo/GIT/learnOpenGL/bin/4.advanced_opengl/4.advanced_opengl
__10.2.asteroids.exe] Error 1
CMakeFiles\Makefile2:67: recipe for target 'CMakeFiles/4.advanced_opengl__10.2.asteroids.d
ir/all' failed
mingw32-make[1]: *** [CMakeFiles/4.advanced_opengl__10.2.asteroids.dir/all] Error 2
Makefile:82: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

So I guess that's it. Had to temporarily throw in my mingw built libs inside repo directory to build binaries.

Something wrong with the code.

The codes are:

  1. std::vector normalMaps = this->loadMaterialTextures(material, aiTextureType_HEIGHT, "texture_normal");
  2. std::vector heightMaps = this->loadMaterialTextures(material, aiTextureType_AMBIENT, "texture_height");

why cannot I import other .obj model?

Dear sir,
I want to use your example program to import my own model,but when I adjust the file path and run the program.It displays an error like '0x00D44BDB has unhandled exception(in 1.model_loading.exe ): 0xC0000005: 'Could you tell me how to import my own model correctly?Thanks in advance.

Dark mode for the website?

Hello.

I currently find very annoying having to switch between my dark-colored Visual Studio (or editor) to the brightly-colored website, it really kills my eyes at night.

I think it'd be a great idea to have a small button that switches the page's theme to a dark-colored background and light-colored text (basically invert the colors).

I'm not a web developer but I think it's just a matter of tweaking a bit the CSS and adding a JS button that switches between the themes. And I think many people would appreciate it.

Thanks for reading.

Error in shader of point light

Original:
vec3 lightDir = normalize(light.position - FragPos);

But it's incorrect(see in any samples):
Must be
vec3 lightDir = normalize(FragPos-light.position);

But I don't like visual result

Building on Mac OSX, issues with stb_image

Hello there,

I saw that this hasn't been properly tested on OSX so I thought I could help out a little bit in that department.

First I installed glfw, glew, assimp and glm through homebrew. I had to compile SOIL from source since I couldn't find anything on homebrew for that. Running the CMakeLists.txt file in this repository didn't give me any errors, but when I ran make I got lots of duplicate symbol errors:

[ 26%] Linking CXX executable bin/6.pbr/6.pbr_2.2.2.ibl_specular_textured
duplicate symbol _stbi_is_hdr_from_memory in:
    /usr/local/lib/libSOIL.a(stb_image_aug.c.o)
    libSTB_IMAGE.a(stb_image.cpp.o)
...
duplicate symbol _stbi_ldr_to_hdr_gamma in:
    /usr/local/lib/libSOIL.a(stb_image_aug.c.o)
    libSTB_IMAGE.a(stb_image.cpp.o)
ld: 20 duplicate symbols for architecture x86_64

I believe this is due to SOIL also including a version of stb_image in its binary, although I can't say for sure. I am surprised that other people have not run into this issue either.

This would be most easily fixed, I think, by simply removing stb_image.cpp from the sources on platforms that are affected by this. I will see if I can get this working in the CMakeLists.txt tomorrow, but it's hard to know if this issue will crop up on other platforms (I should be able to test it on windows, however).

Frame buffer size on Retina displays

first, my deep gratitude for your tutorials, I have become a proud patron :)
there is an issue with running the tutorials on retina screens.
Using constants width and height to set the viewport renders only a quarter of the screen in the lower left corner. It seems that every glViewport call should be preceded with a glfwGetFramebufferSize call? Unless there is a way to detect the device pixel ratio using glfw?

Shadow Mapping problems...

Hi Joey, i honestly don't know if you would see this message if i would have sent it to your website, but i have ggotten a problem with shadow mapping, and i have followed your tutorial very closely but still, i have this problem that my shadow (on a small scene made of cubes and a plane to look like a really basic military base) is somehow shown from above at an angle, it makes my scene really ugly, but i have tried everything and i just don't know how to fix it... i hope that since it is your tutorial i have followed that you could maybe help me out?

Thanks in advance,
David.

A issue about the params of glm::perspective()

The following codes calculates the perspective matrix:
// Create camera transformations
glm::mat4 view;
view = camera.GetViewMatrix();
glm::mat4 projection = glm::perspective(camera.Zoom, (GLfloat)WIDTH / (GLfloat)HEIGHT, 0.1f, 100.0f);

I found the camera.Zoom is degree but not radians, so we got a strange result.
we should use camera.Zoom/glm::two_pi() as fovy.

Error in the shader of POM

Hi

I found problem in shader for POM and CSM

In this line, driver generated TDM error:
float numLayers = mix(maxLayers, minLayers, abs(dot(vec3(0.0, 0.0, 1.0), viewDir)));

findSOIL.cmake doesn't work in Fedora 23

Hello Joey,

Thank you for the great tutorial!

I'm using fedora 23 and installed SOIL with dnf. It turns out that the actual path to it is /usr/include/SOIL, which is not mentioned in your findSOIL.cmake file.

This is only a one-line change, I can offer you a pull request if you feel appropriate.

Jinbo

Calculation of NormalMatrix

Hi there,

not an issue but more of a question: in your normal mapping tutorial code https://github.com/JoeyDeVries/LearnOpenGL/blob/master/src/5.advanced_lighting/4.normal_mapping/normal_mapping.vs

shouldn't the NormalMatrix be computed by transpose(inverse(ModelToViewMatrix)) (which is WorldToView * ModelToWorld) instead of the ModelToWorld matrix like you have it in the code? (at least from what I've read from other sources)

My guess is that they're both correct. Depending on which space we want our calculations to be in, which in the case of your tutorial you have the LightPos, ViewPos in world space - not eye/camera space - so you construct the normal matrix using the 'model' (ModelToWorld) matrix, is that correct?

no use variable

in the 2.lighting-4.lighting_maps example, no use variable emissionMap , here the code

GLuint diffuseMap, specularMap, emissionMap;
glGenTextures(1, &diffuseMap);
glGenTextures(1, &specularMap);
glGenTextures(1, &emissionMap);

Some compiling problems under Ubuntu 14.04

I am getting some weird errors complaining about 'XConvertSelection' when I run the make, this is what the output looks like:

Linking CXX executable bin/2.lighting/1.colors
/usr/bin/ld: /usr/local/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection'
//usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [bin/2.lighting/1.colors] Error 1
make[1]: *** [CMakeFiles/1.colors.dir/all] Error 2
make: *** [all] Error 2

Any idea on how to work around this? Thanks in advance.

Provide which version of MSVC the windows lib are compatible with

The cmake script doesn't work out of the box, I get linking errors, it's probably because I have MSVC 11 (2012), I don't know if I should use 2013 or 2015.

Can't cmake detect that or have a way to select a folder containing the proper lib files according to this?

Cache uniform locations?

I've been going through the Shaders and other tutorials (and porting them to Rust) and was slightly suprised that glGetUniformLocation is always called directly when setting a uniform (like here).
I profiled this a few ago (on an OpenGL 2.1 Desktop app) and found them well worth caching for uniforms that are updated within a render loop.
Might be worth mentioning in the text, or even adding to the Shader class?

Why the deferred shading tutorial so painfully slow?

@JoeyDeVries

TBH, I have to admit a I have an old gpu ( GeForce 210 1 gb supports GL3 Core and DX10.1), but I compiled the deferred shading tutorial and it is painfully slow (around 9-8 FPS), I checked other tutorials (as OGLDEV) and it is very fast ( about 250 fps), I examined it with renderdoc, it seems every framebuffer call takes too much time and the renderquad function takes more time than rendering the 10 nanosuits together, why does this happen? and does this happen to you or anybody else??

Many compile errors in window7 64

basic_lighting_specular.obj : error LNK2019: unresolved external symbol glewInit referenced in function main
1>basic_lighting_specular.obj : error LNK2019: unresolved external symbol glfwInit referenced in function main
1>basic_lighting_specular.obj : error LNK2019: unresolved external symbol glfwTerminate referenced in function main
1>basic_lighting_specular.obj : error LNK2019: unresolved external symbol glfwWindowHint referenced in function main
1>basic_lighting_specular.obj : error LNK2019: unresolved external symbol glfwCreateWindow referenced in function main
1>basic_lighting_specular.obj : error LNK2019: unresolved external symbol glfwWindowShouldClose referenced in function main
1>basic_lighting_specular.obj : error LNK2019: unresolved external symbol glfwSetWindowShouldClose referenced in function "void __cdecl key_callback(struct GLFWwindow *,int,int,int,int)" (?key_callback@@YAXPEAUGLFWwindow@@hhhh@Z)
1>basic_lighting_specular.obj : error LNK2019: unresolved external symbol glfwPollEvents referenced in function main
1>basic_lighting_specular.obj : error LNK2019: unresolved external symbol glfwSetInputMode referenced in function main

Porting to native android c++

Hi dear friend,
I would like to port it / rewrite some parts of your code for native android application.
May I do that ? ( I won't get trouble )

Thank you for reading

Master branch doesn't build on Linux

Hey Joey,

I follow your site and noticed you recently merged the PBR stuff. When I followed the instructions to build on Linux, the final make failed, with apparent issues in PBR related code. Here's a complete output:

$ make
Scanning dependencies of target STB_IMAGE
[  1%] Building CXX object CMakeFiles/STB_IMAGE.dir/src/stb_image.cpp.o
[  2%] Linking CXX static library libSTB_IMAGE.a
[  2%] Built target STB_IMAGE
Scanning dependencies of target GLAD
[  3%] Building C object CMakeFiles/GLAD.dir/src/glad.c.o
[  3%] Linking C static library libGLAD.a
[  3%] Built target GLAD
Scanning dependencies of target 6.pbr__2.2.1.ibl_specular
[  4%] Building CXX object CMakeFiles/6.pbr__2.2.1.ibl_specular.dir/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp.o
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:26:2: error: #error OpenGL header already included, remove this include, glad already provides it
 #error OpenGL header already included, remove this include, glad already provides it
  ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:406:0: warning: "GL_ALL_ATTRIB_BITS" redefined
 #define GL_ALL_ATTRIB_BITS 0xFFFFFFFF
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:829:0: note: this is the location of the previous definition
 #define GL_ALL_ATTRIB_BITS 0x000fffff
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:409:0: warning: "GL_CLIENT_ALL_ATTRIB_BITS" redefined
 #define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:830:0: note: this is the location of the previous definition
 #define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:926:0: warning: "GL_SRC1_ALPHA" redefined
 #define GL_SRC1_ALPHA 0x8589
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1610:0: note: this is the location of the previous definition
 #define GL_SRC1_ALPHA GL_SOURCE1_ALPHA
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:936:0: warning: "GL_FOG_COORD_SRC" redefined
 #define GL_FOG_COORD_SRC 0x8450
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1604:0: note: this is the location of the previous definition
 #define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:937:0: warning: "GL_FOG_COORD" redefined
 #define GL_FOG_COORD 0x8451
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1605:0: note: this is the location of the previous definition
 #define GL_FOG_COORD GL_FOG_COORDINATE
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:938:0: warning: "GL_CURRENT_FOG_COORD" redefined
 #define GL_CURRENT_FOG_COORD 0x8453
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1611:0: note: this is the location of the previous definition
 #define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:939:0: warning: "GL_FOG_COORD_ARRAY_TYPE" redefined
 #define GL_FOG_COORD_ARRAY_TYPE 0x8454
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1609:0: note: this is the location of the previous definition
 #define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:940:0: warning: "GL_FOG_COORD_ARRAY_STRIDE" redefined
 #define GL_FOG_COORD_ARRAY_STRIDE 0x8455
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1612:0: note: this is the location of the previous definition
 #define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:941:0: warning: "GL_FOG_COORD_ARRAY_POINTER" redefined
 #define GL_FOG_COORD_ARRAY_POINTER 0x8456
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1608:0: note: this is the location of the previous definition
 #define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:942:0: warning: "GL_FOG_COORD_ARRAY" redefined
 #define GL_FOG_COORD_ARRAY 0x8457
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1606:0: note: this is the location of the previous definition
 #define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:943:0: warning: "GL_FOG_COORD_ARRAY_BUFFER_BINDING" redefined
 #define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1615:0: note: this is the location of the previous definition
 #define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:944:0: warning: "GL_SRC0_RGB" redefined
 #define GL_SRC0_RGB 0x8580
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1607:0: note: this is the location of the previous definition
 #define GL_SRC0_RGB GL_SOURCE0_RGB
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:945:0: warning: "GL_SRC1_RGB" redefined
 #define GL_SRC1_RGB 0x8581
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1614:0: note: this is the location of the previous definition
 #define GL_SRC1_RGB GL_SOURCE1_RGB
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:946:0: warning: "GL_SRC2_RGB" redefined
 #define GL_SRC2_RGB 0x8582
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1617:0: note: this is the location of the previous definition
 #define GL_SRC2_RGB GL_SOURCE2_RGB
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:947:0: warning: "GL_SRC0_ALPHA" redefined
 #define GL_SRC0_ALPHA 0x8588
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1613:0: note: this is the location of the previous definition
 #define GL_SRC0_ALPHA GL_SOURCE0_ALPHA
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:948:0: warning: "GL_SRC2_ALPHA" redefined
 #define GL_SRC2_ALPHA 0x858A
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1616:0: note: this is the location of the previous definition
 #define GL_SRC2_ALPHA GL_SOURCE2_ALPHA
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:949:0: warning: "GL_BLEND_EQUATION_RGB" redefined
 #define GL_BLEND_EQUATION_RGB 0x8009
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:1707:0: note: this is the location of the previous definition
 #define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:1056:0: warning: "GL_COMPARE_REF_TO_TEXTURE" redefined
 #define GL_COMPARE_REF_TO_TEXTURE 0x884E
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:2040:0: note: this is the location of the previous definition
 #define GL_COMPARE_REF_TO_TEXTURE GL_COMPARE_R_TO_TEXTURE_ARB
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:1057:0: warning: "GL_CLIP_DISTANCE0" redefined
 #define GL_CLIP_DISTANCE0 0x3000
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:2041:0: note: this is the location of the previous definition
 #define GL_CLIP_DISTANCE0 GL_CLIP_PLANE0
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:1058:0: warning: "GL_CLIP_DISTANCE1" redefined
 #define GL_CLIP_DISTANCE1 0x3001
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:2038:0: note: this is the location of the previous definition
 #define GL_CLIP_DISTANCE1 GL_CLIP_PLANE1
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:1059:0: warning: "GL_CLIP_DISTANCE2" redefined
 #define GL_CLIP_DISTANCE2 0x3002
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:2043:0: note: this is the location of the previous definition
 #define GL_CLIP_DISTANCE2 GL_CLIP_PLANE2
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:1060:0: warning: "GL_CLIP_DISTANCE3" redefined
 #define GL_CLIP_DISTANCE3 0x3003
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:2039:0: note: this is the location of the previous definition
 #define GL_CLIP_DISTANCE3 GL_CLIP_PLANE3
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:1061:0: warning: "GL_CLIP_DISTANCE4" redefined
 #define GL_CLIP_DISTANCE4 0x3004
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:2042:0: note: this is the location of the previous definition
 #define GL_CLIP_DISTANCE4 GL_CLIP_PLANE4
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:1062:0: warning: "GL_CLIP_DISTANCE5" redefined
 #define GL_CLIP_DISTANCE5 0x3005
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:2037:0: note: this is the location of the previous definition
 #define GL_CLIP_DISTANCE5 GL_CLIP_PLANE5
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:1065:0: warning: "GL_MAX_CLIP_DISTANCES" redefined
 #define GL_MAX_CLIP_DISTANCES 0x0D32
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:2036:0: note: this is the location of the previous definition
 #define GL_MAX_CLIP_DISTANCES GL_MAX_CLIP_PLANES
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:1072:0: warning: "GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT" redefined
 #define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:2045:0: note: this is the location of the previous definition
 #define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:1083:0: warning: "GL_MAX_VARYING_COMPONENTS" redefined
 #define GL_MAX_VARYING_COMPONENTS 0x8B4B
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:2044:0: note: this is the location of the previous definition
 #define GL_MAX_VARYING_COMPONENTS GL_MAX_VARYING_FLOATS
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:1474:0: warning: "GL_PATCHES" redefined
 #define GL_PATCHES 0x000E
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:5487:0: note: this is the location of the previous definition
 #define GL_PATCHES 0xE
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:1897:0: warning: "GL_SHADER_STORAGE_BARRIER_BIT" redefined
 #define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:5279:0: note: this is the location of the previous definition
 #define GL_SHADER_STORAGE_BARRIER_BIT 0x2000
 ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:665:0: warning: ignoring #pragma region  [-Wunknown-pragmas]
 #pragma region "User input"
 ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:727:0: warning: ignoring #pragma endregion  [-Wunknown-pragmas]
 #pragma endregion
 ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:180:148: error: conflicting declaration ‘typedef void (* GLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, const void*)’
 PROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
                                                                                                                     ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:10618:25: note: previous declaration as ‘typedef void (* GLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*)’
 typedef void (APIENTRY *GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLc
                         ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:4:0,
                 from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:
/home/joshua/Code/GitHub/LearnOpenGL/includes/glad/glad.h:181:151: error: conflicting declaration ‘typedef void (* GLDEBUGPROCARB)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, const void*)’
 CARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
                                                                                                                     ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:6:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/GL/glew.h:3399:25: note: previous declaration as ‘typedef void (* GLDEBUGPROCARB)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*)’
 typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const 
                         ^
In file included from /home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:12:0:
/home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h: In constructor ‘Shader::Shader(const char*, const char*, const char*)’:
/home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:64:13: warning: unused variable ‘success’ [-Wunused-variable]
         int success;
             ^
/home/joshua/Code/GitHub/LearnOpenGL/includes/learnopengl/shader.h:65:14: warning: unused variable ‘infoLog’ [-Wunused-variable]
         char infoLog[512];
              ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp: In function ‘int main()’:
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:91:15: error: ‘class Shader’ has no member named ‘Use’
     pbrShader.Use();
               ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:92:48: error: ‘class Shader’ has no member named ‘Program’
     glUniform1i(glGetUniformLocation(pbrShader.Program, "irradianceMap"), 0);
                                                ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:93:48: error: ‘class Shader’ has no member named ‘Program’
     glUniform1i(glGetUniformLocation(pbrShader.Program, "prefilterMap"), 1);
                                                ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:94:48: error: ‘class Shader’ has no member named ‘Program’
     glUniform1i(glGetUniformLocation(pbrShader.Program, "brdfLUT"), 2);
                                                ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:95:48: error: ‘class Shader’ has no member named ‘Program’
     glUniform3f(glGetUniformLocation(pbrShader.Program, "albedo"), 0.5f, 0.0f, 0.0f);
                                                ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:96:48: error: ‘class Shader’ has no member named ‘Program’
     glUniform1f(glGetUniformLocation(pbrShader.Program, "ao"), 1.0f);
                                                ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:98:22: error: ‘class Shader’ has no member named ‘Use’
     backgroundShader.Use();
                      ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:99:55: error: ‘class Shader’ has no member named ‘Program’
     glUniform1i(glGetUniformLocation(backgroundShader.Program, "environmentMap"), 0);
                                                       ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:185:36: error: ‘class Shader’ has no member named ‘Use’
     equirectangularToCubemapShader.Use();
                                    ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:186:69: error: ‘class Shader’ has no member named ‘Program’
     glUniform1i(glGetUniformLocation(equirectangularToCubemapShader.Program, "equirectangularMap"), 0);
                                                                     ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:189:76: error: ‘class Shader’ has no member named ‘Program’
     glUniformMatrix4fv(glGetUniformLocation(equirectangularToCubemapShader.Program, "projection"), 1, GL_FALSE, glm::v
                                                                            ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:195:80: error: ‘class Shader’ has no member named ‘Program’
         glUniformMatrix4fv(glGetUniformLocation(equirectangularToCubemapShader.Program, "view"), 1, GL_FALSE, glm::val
                                                                                ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:228:22: error: ‘class Shader’ has no member named ‘Use’
     irradianceShader.Use();
                      ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:229:55: error: ‘class Shader’ has no member named ‘Program’
     glUniform1i(glGetUniformLocation(irradianceShader.Program, "environmentMap"), 0);
                                                       ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:232:62: error: ‘class Shader’ has no member named ‘Program’
     glUniformMatrix4fv(glGetUniformLocation(irradianceShader.Program, "projection"), 1, GL_FALSE, glm::value_ptr(captu
                                                              ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:238:66: error: ‘class Shader’ has no member named ‘Program’
         glUniformMatrix4fv(glGetUniformLocation(irradianceShader.Program, "view"), 1, GL_FALSE, glm::value_ptr(capture
                                                                  ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:265:21: error: ‘class Shader’ has no member named ‘Use’
     prefilterShader.Use();
                     ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:266:54: error: ‘class Shader’ has no member named ‘Program’
     glUniform1i(glGetUniformLocation(prefilterShader.Program, "environmentMap"), 0);
                                                      ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:269:61: error: ‘class Shader’ has no member named ‘Program’
     glUniformMatrix4fv(glGetUniformLocation(prefilterShader.Program, "projection"), 1, GL_FALSE, glm::value_ptr(captur
                                                             ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:283:58: error: ‘class Shader’ has no member named ‘Program’
         glUniform1f(glGetUniformLocation(prefilterShader.Program, "roughness"), roughness);
                                                          ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:286:69: error: ‘class Shader’ has no member named ‘Program’
             glUniformMatrix4fv(glGetUniformLocation(prefilterShader.Program, "view"), 1, GL_FALSE, glm::value_ptr(capt
                                                                     ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:316:16: error: ‘class Shader’ has no member named ‘Use’
     brdfShader.Use();
                ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:326:15: error: ‘class Shader’ has no member named ‘Use’
     pbrShader.Use();
               ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:327:55: error: ‘class Shader’ has no member named ‘Program’
     glUniformMatrix4fv(glGetUniformLocation(pbrShader.Program, "projection"), 1, GL_FALSE, glm::value_ptr(projection))
                                                       ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:328:22: error: ‘class Shader’ has no member named ‘Use’
     backgroundShader.Use();
                      ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:329:62: error: ‘class Shader’ has no member named ‘Program’
     glUniformMatrix4fv(glGetUniformLocation(backgroundShader.Program, "projection"), 1, GL_FALSE, glm::value_ptr(proje
                                                              ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:352:19: error: ‘class Shader’ has no member named ‘Use’
         pbrShader.Use();
                   ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:354:59: error: ‘class Shader’ has no member named ‘Program’
         glUniformMatrix4fv(glGetUniformLocation(pbrShader.Program, "view"), 1, GL_FALSE, glm::value_ptr(view));
                                                           ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:355:53: error: ‘class Shader’ has no member named ‘Program’
         glUniform3fv(glGetUniformLocation(pbrShader.Program, "camPos"), 1, &camera.Position[0]);
                                                     ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:368:56: error: ‘class Shader’ has no member named ‘Program’
             glUniform1f(glGetUniformLocation(pbrShader.Program, "metallic"), (float)row / (float)nrRows);
                                                        ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:373:60: error: ‘class Shader’ has no member named ‘Program’
                 glUniform1f(glGetUniformLocation(pbrShader.Program, "roughness"), glm::clamp((float)col / (float)nrCol
                                                            ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:381:67: error: ‘class Shader’ has no member named ‘Program’
                 glUniformMatrix4fv(glGetUniformLocation(pbrShader.Program, "model"), 1, GL_FALSE, glm::value_ptr(model
                                                                   ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:393:57: error: ‘class Shader’ has no member named ‘Program’
             glUniform3fv(glGetUniformLocation(pbrShader.Program, ("lightPositions[" + std::to_string(i) + "]").c_str()
                                                         ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:394:61: error: ‘class Shader’ has no member named ‘Program’
                 glUniform3fv(glGetUniformLocation(pbrShader.Program, ("lightColors[" + std::to_string(i) + "]").c_str(
                                                             ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:399:63: error: ‘class Shader’ has no member named ‘Program’
             glUniformMatrix4fv(glGetUniformLocation(pbrShader.Program, "model"), 1, GL_FALSE, glm::value_ptr(model));
                                                               ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:404:26: error: ‘class Shader’ has no member named ‘Use’
         backgroundShader.Use();
                          ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:405:66: error: ‘class Shader’ has no member named ‘Program’
         glUniformMatrix4fv(glGetUniformLocation(backgroundShader.Program, "view"), 1, GL_FALSE, glm::value_ptr(view));
                                                                  ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp: In function ‘void renderSphere()’:
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:463:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int y = 0; y < Y_SEGMENTS; ++y)
                           ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:467:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for (int x = 0; x <= X_SEGMENTS; ++x)
                                   ^
/home/joshua/Code/GitHub/LearnOpenGL/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp:486:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < positions.size(); ++i)
                           ^
CMakeFiles/6.pbr__2.2.1.ibl_specular.dir/build.make:62: recipe for target 'CMakeFiles/6.pbr__2.2.1.ibl_specular.dir/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp.o' failed
make[2]: *** [CMakeFiles/6.pbr__2.2.1.ibl_specular.dir/src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp.o] Error 1
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/6.pbr__2.2.1.ibl_specular.dir/all' failed
make[1]: *** [CMakeFiles/6.pbr__2.2.1.ibl_specular.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Discussion on matrix-matrix multiplication in the Transformations tutorial may be simplified

I think it's possible to greatly simplify the discussion on matrix-matrix multiplication by showing how it's similar to transforming a vector. Specifically, given an NxN matrix and an NxM matrix, the second matrix can be treated as a set of M column vectors, and multiplying the two matrices transforms these M vectors in the same way as if those vectors were transformed individually. (The same applies to any two matrices that can be multiplied, with the difference that each output column vector will have the same size as the number of rows in the first matrix.) Reading the page at < https://github.com/ssloy/tinyrenderer/wiki/Lesson-4:-Perspective-projection > led me to that helpful insight.

Moreover:

  • This insight reveals that multiple vectors can be transformed at once using a single matrix operation. For example, it's possible to rotate four 3D points (in 4D homogeneous coordinates), or do any other matrix transformation with them, using a single matrix operation involving two 4x4 matrices.
  • It may be more helpful to discuss matrix-vector multiplication and transformations first and only afterwards discuss matrix-matrix multiplication.
  • Much of the discussion should be limited to the most common matrix dimensions in 3D computer graphics, which seem to be 3x3, 4x4, 3x1, and 4x1 [rows x columns]. (Using 2x2 matrices can also simplify the discussion as well.)
  • Consider discussing how the dot product is involved in matrix-vector multiplication.

Model.cpp incorrect c_string comparison

Me again! 😝

In the loadMaterialTextures(...) function, where you check if the texture has already been loaded:

if(textures_loaded[j].path == str)
            {
                textures.push_back(textures_loaded[j]);

                skip = true; 

                break;
            }

The if-check needs to be changed to:

if(std::strcmp(textures_loaded[j].path, str) == 0)
            {
                textures.push_back(textures_loaded[j]);

                skip = true; 

                break;
            }

The strcmp function lexicographically compares null-terminated byte strings and returns 0 if equal, otherwise 1. Simply checking for equality (using ==) doesn't work. This bug appears to only rear its head with complex models that share textures (because the nanosuit is simple, that's probably why no one has caught it yet).

I was tearing my hair out trying to figure out why the "Crytek Sponza" model was eating up 3GB of memory and generating 400 GL textures. This was why because the equality operator was generating undefined behaviour😛 Now it creates 24 textures and uses 600MB memory!

http://en.cppreference.com/w/cpp/string/byte/strcmp

If you don't have the time, I can make a quick fork and submit a PR within a day or so.

Ubuntu 14.04 make error

andyzhao@ANDYZHAO_PRECISION_5510 ~/LearnOpenGL> make
[ 1%] Building C object CMakeFiles/GLAD.dir/src/glad.c.o
Linking C static library libGLAD.a
[ 1%] Built target GLAD
[ 2%] Building CXX object CMakeFiles/STB_IMAGE.dir/src/stb_image.cpp.o
Linking CXX static library libSTB_IMAGE.a
[ 2%] Built target STB_IMAGE
[ 3%] Building CXX object CMakeFiles/1.getting_started__1.1.hello_window.dir/src/1.getting_started/1.1.hello_window/hello_window.cpp.o
Linking CXX executable bin/1.getting_started/1.getting_started__1.1.hello_window
/usr/bin/ld: libGLAD.a(glad.c.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libdl.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [bin/1.getting_started/1.getting_started__1.1.hello_window] Error 1
make[1]: *** [CMakeFiles/1.getting_started__1.1.hello_window.dir/all] Error 2
make: *** [all] Error 2

Breakout code?

Hello, first of all thanks for the great tutorial! But could it be that the breakout code is missing from this repository?

error in run example

Hi,

when I try to run any example I have the following errors:

ERROR::SHADER::FILE_NOT_SUCCESFULLY_READ
ERROR::PROGRAM_LINKING_ERROR of type: PROGRAM
ERROR: Compiled vertex shader was corrupt.
ERROR: Compiled fragment shader was corrupt.

My steps have been:

  1. mkdir build
  2. cmake ..
  3. make -j8

Key callbacks can be replaced with glfwGetKey()

Hi, Joey. I found that you use a key callback to handle key input in the LearnOpenGL tutorial. But GLFW also provides the glfwGetKey() function to query if a key is down. Also in the Camera tutorial, the keys array is not required if you use glfwGetKey() (because GLFW already stores it for you).

For example, the following function:

void do_movement()
{
  GLfloat cameraSpeed = 0.01f;
  if(keys[GLFW_KEY_W])
  	cameraPos += cameraSpeed * cameraFront;
  if(keys[GLFW_KEY_S])
  	cameraPos -= cameraSpeed * cameraFront;
  if(keys[GLFW_KEY_A])
  	cameraPos -= glm::normalize(glm::cross(cameraFront, cameraUp)) * cameraSpeed;
  if(keys[GLFW_KEY_D])
  	cameraPos += glm::normalize(glm::cross(cameraFront, cameraUp)) * cameraSpeed;
}

Can be replaced with:

void do_movement()
{
// 'window' is the GLFW window handle
  GLfloat cameraSpeed = 0.01f;
  if(glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
  	cameraPos += cameraSpeed * cameraFront;
  if(glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
  	cameraPos -= cameraSpeed * cameraFront;
  if(glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)
  	cameraPos -= glm::normalize(glm::cross(cameraFront, cameraUp)) * cameraSpeed;
  if(glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)
  	cameraPos += glm::normalize(glm::cross(cameraFront, cameraUp)) * cameraSpeed;
}

Increase pre-filtered cubemap size for IBL examples

The pre-filtered cubemap should get a slight size bump. The 128x128 dimension makes up for some ugly artifacts and steps on metallic objects if you get closer to them.

Since generating the pre-filtered cubemap is pretty fast, bumping resolution up to the same size as the environment map it's based on should be fine. At least on my GTX 980 generation doesn't take much longer.

2017-04-08 18_30_05-learnopengl

why aiTextureType doesn't match your texture name

In model.h, here has:
this->loadMaterialTextures(material, aiTextureType_HEIGHT, "texture_normal");
and also
this->loadMaterialTextures(material, aiTextureType_AMBIENT, "texture_height");

why do you give "texture_normal" name to aiTextureType_HEIGHT?
It should be aiTextureType_NORMALS, right?

Regarding assimp animations...

Hi Joey, i would like to know if you Will make a assimp animations tutorial because i am really in distress about integrating it myself, because i don't know where to start from your assimp static models scripts :( i have tried everything i Can think of, but to no success :( thanks in advance. David.

Could not find X11 on macOS Sierra

When I try to build the project with CMake, I get the following errors:

CMake Error at /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/FindX11.cmake:429 (message):
Could not find X11
Call Stack (most recent call first):
CMakeLists.txt:51 (find_package)

-- Configuring incomplete, errors occurred!

It seems like X11 is no longer included with Mac(https://support.apple.com/en-us/HT201341).
So please help me with this problem.Thank you.

OS X command line hints (CMakeLists.txt for OS X not working)

brew install all dependencies via brew - for SOIL:

brew tap Nyoho/libsoil
brew install libsoil

OS X 10.10.5
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0

Also add glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); in each source

clang++ -std=c++11 -g -Wall -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework Carbon -lGLEW -lSOIL textures_combined.cpp -o textures_combined

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.