We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Badal Gupta • 2 years ago

I am getting the following errors when I put the files together. Anybody knows how to resolve these?

https://uploads.disquscdn.c...

Kimeg • 2 years ago

https://uploads.disquscdn.c...

Sorry to upload an image having Korean language in it, but it seems I have similar issue when trying to run the program. This could be due to the incompatibility of the current VS version, but we have to wait and see.

KindoSaur Productions • 2 years ago

If you are getting 2 unresolved external errors pointing at "resource_manager.obj" at line 1.

https://uploads.disquscdn.c...

You need to write #define STB_IMAGE_IMPLEMENTATION above the #include <stb_image.h> inside of the resource_mananger.cpp

https://uploads.disquscdn.c...

Trevor A. Viken • 8 years ago

Found a small error in the shader.h code. '#define GLEW_STATIC' is not declared anywhere. Assuming that most of us are still using the static version of glew, this will cause some linking errors.

JoeyDeVries • 8 years ago

Yeah it is definitely good practice to define it before each GLEW include and it seems I failed to adhere to this good practice ;)
It worked within my project as I made sure to define GLEW_STATIC at the initial GLEW include at the main program file (before I include any custom OpenGL class), which you can also see here.

Lucas Ruff • 2 years ago

Just making sure I'm not crazy, the only reason we need the resource manager in main.cpp is to call the clear function while shutting down? I would think it makes more since to only include it in game.cpp and call ResourceManager::Clear() in the game destructor

Fik-shun • 3 years ago

Do add this in your resource_manager.cpp before #include <stb_image.h>:

#define STB_IMAGE_IMPLEMENTATION

Also make sure you've download stb_image.h from https://github.com/nothings...

jg • 2 years ago

Or make an stb_image.cpp file and put:
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
this avoids accidently defining the implementation multiple times.

Halden • 3 years ago

Does this tutorial no longer use GLEW?

shiva rao • 3 years ago

No it uses GLAD

VCoder12345 • 3 years ago

And I just want to say that these tutorials are absolutely amazing! Thank you so much!

VCoder12345 • 3 years ago

Why do you use a key-array and not just the glfwGetKey function? Is it better to use callbacks or to use polling?

moreflow • 3 years ago

I can see just only empty when I clicked code links.
Could you check these if all links are available?

JoeyDeVries • 3 years ago

Oeh, thanks for letting me know; we recently made some changes to git repo folder structure which broke the code paths for the 2D game. It's fixed now, thanks!

keeee • 4 years ago

One thing I don't understand: why are we using face-culling? I thought it was an optimization for 3D apps only.

JoeyDeVries • 4 years ago

You're right, there's no need for face culling at all. I've removed the mention of it and removed it from the source code. Thanks for letting me know!

(I'll delete this comment thread in a bit to avoid confusion for future readers).

Bale • 4 years ago

I thought it was because both faces of the quad will be drawn by default, and we are only interested about the one facing the player.

H. Tugkan Kibar • 4 years ago

If you are on OSX and have issues that is because for OpenGL 3.2 and forward, GLFW only supports forward compatible opengl profiles. You need to add this;

glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

One thing to note here, that might be helpful is the following function as that will allow you to listen to GLFW errors.
glfwSetErrorCallback(error_callback);
void error_callback(int error, const char* description)
{
std::cerr << "GLFW Error: " << description << std::endl;
}

Robin Fritz • 4 years ago

Hi there, thank you for these amazing tutorials!

I've found an issue with the example code you've given here at the end.
Since this example was implemented with glew, there's the part missing where all GLAD functions are loaded, thus resulting in a segfault 11.

If anyone is seeing this issue, add
"if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
{
std::cout << "Failed to initialize GLAD" << std::endl;
return -1;
}"
to your code above the glViewport() call.

Ádám Hunyadi • 6 years ago

My openGL version does not have an implementation of a geometry shader... For some reason my code seems to use version 3_0_0 (even though 4_5_0 should be available).

Kotauskas • 5 years ago

You can use OpenGL Extensions Viewer to check available OpenGL versions. The easiest solution to your problem is to update your GPU driver.

Ajit Bhat • 6 years ago

where would you find the shader.vs and shader.frag files?

paambtomaquet • 8 years ago

Hey there! First of all thanks, your tutorials are very well explained and I'm learning a lot. But I'm having a problem with your shader class, I've been researching and I found a possible solution but after all an error still there.

The "solution" is defining (#define GLM_FORCE_PURE) in my header file, but one of the errors (line 35) is there all the time.

Sarper • 8 years ago

I had the same problem with the original source. The problem is, the "Set..." member functions using the glm types are trying to copy the parameters to unaligned locations. The solution is to pass a constant reference to the existing aligned data.

Example:
void SetMatrix4(const GLchar* name, const glm::mat4 &matrix, GLboolean useShader = false);

So "glm::mat4 matrix" parameter becomes "const glm::mat4 &matrix". Change all your glm type using Set member functions to use constant references.

Source and more info: http://stackoverflow.com/qu...

JoeyDeVries • 8 years ago

Thanks Sarper, I'll update the shader code somewhere today.

paambtomaquet • 8 years ago

I just found the same post a few minutes ago! It works fine for me!
Thanks for the explanation :)

JoeyDeVries • 8 years ago

Weird, I have never seen that error before so can't really help you there. Looks to be something of a type mismatch.

Sarper • 8 years ago

Your version of key_callback function contains a usage of a KeysProccessed array, which the Game class doesn't contain, could you please share the full source code of this project? I guess it's not in the repository. Thanks!

JoeyDeVries • 8 years ago

Oops you're right, I only discuss the KeysProcessed array in the Render Text tutorial; I removed it from the source code; thanks for letting me know!

Also, about the repository: once I'm finished with the Advanced Lighting tutorials I'll also try to include the full source code of Breakout in the repository.

Mika • 9 years ago

The header and code files shown for the game class seems to be the wrong version?
It seems like all functionallity is already added instead of just the things mentioned in this part.

JoeyDeVries • 9 years ago

Oops you're right, that's a bit of a mistake :p I'll fix it tonight, thanks!