Best opengl tutorials, I hope your channel grows
Finally something for opengl that is up to date and nothings is a great repo great video man
For those who didn't get a square after changing vertices and draw elements line, make sure you changed the VAO1.linkattrib() lines to: VAO1.LinkAttrib(VBO1, 0, 3, GL_FLOAT, 8 * sizeof(float), (void*)0); VAO1.LinkAttrib(VBO1, 1, 3, GL_FLOAT, 8 * sizeof(float), (void*)(3 * sizeof(float))); VAO1.LinkAttrib(VBO1, 2, 2, GL_FLOAT, 8 * sizeof(float), (void*)(6 * sizeof(float)));
If you're having a problem where the .txt file isn't turning into a proper .h file (it'll say something about not being able to find it when you try to compile). In the top left of the file explorer there are 4 tabs 'File' 'Home' 'Share' and 'View', click 'View' and make sure the check box named 'File name extenstions' is checked and then try naming it again.
after this tutorial, I shall make my first 2d opengl game : )
This is still the best OpenGL tutorial out there by far. If you assume upper left corner is UV origin with positive U going to the right and positive V pointing down (like most other texture/image software) there is no need to flip image on load. Also be aware of your windings of vertices. CCW is default front face. CW is used in the tutorial. which isn't a problem until you use back face culling. You can define which is front or back but CCW is default front. This winding and UV direction stuff will help latter as it will allow you to make sense mathematically of the right hand rule and the vectors of normal mapping. It's not a bad idea to use a test image with a grid and some text in it so it will be obvious if you have mirrored or stretched the image in some way by wrong UV coords. Especially on 3D models.. Blender has a great test pattern texture for this.
Amazing! If you want use the .jpg extension for your texture image you must change the GL_RGBA to GL_RGB, cause the A is to Alpha channel. Great video!
It's very important to give the same names in inputs(in) and output(out) between vertex and fragment shader, otherwise opengl could never know how to link them.
if someone has problems with loading the texture like me, change the line "unsigned char* bytes = stbi_load(image, &widthImg, &heightImg, &numColCh, 0);" last value to "STBI_rgb_alpha". it worked for me
Hint: you can use the last parameter of stbi_load to force the number of channels independently of the format (as long as the numbers make sense, I guess). 0 means "auto detect" from format. This is useful if you want to have all your textures as PNGs (avoiding the dicey JPEG lossy compression...). When you want to ignore the alpha channel you can just set it to 3.
Hi Victor! I have followed everything correctly up until you include the stb header file into stb.cpp. Visual studio is giving me an error when I try to include stb_image.h (#include <stb/stb_image.h>) Visual studio is saying that it is unable to open source file. Any ideas would be very helpful, thank you!
Victor eluded to this in the video, but for this to run correctly, you're texture size HAS to be a power of two. You will get a run-time error if it isn't. I had one that was 516x516. It was seg faulting, and I was scratching my head until I tried cropping the image to 512x512 based on his tip. Then it worked perfectly. So, I'd say it is more than a suggestion, it is a must.
I've got a problem - i cant get the texture to appear, just a black square with the dark blue backround - i have the texture in textures resource files folder and in the same place as the vs file itself as well, its a png file 1024x1024 size, colors were set to RGBA and the name is correct as well, i tried different images and still the same result
I keep getting a "cannot find or open nvoglv64.pdb" error in VS2022. I hadn't had this error before this tutorial, and seems to be related to the stb library. However, I also recently upgraded my graphics card and forgot to uninstall drivers before hand, but I'm trying to avoid that as much as possible because it has a chance to cause system damage (when using DDU). I also posted this on your discord just in case =) Thanks for the help and I'm glad to say I've had no other errors besides this one that I couldn't fix, major props!
Amazing video man, I have two questions: 1: Are you going to go over how to keep the scale of objects (like the triangle, or in this case popcat), independent of the window size? As in, not stretching out across the window? 2: Do you have some kind of roadmap or list of topics that you are going to go through? I'd love to know what you have in store for the future of this series. Keep up the good work!
Very good tutorial, however for me it isn't working! I don't get any errors, however instead of displaying the texture it just displays a black square. I have compared my code to yours in the github, and it all seems the same. Can anyone help?
I get an access violation (idk if it is called this way but translated) exception thrown when i call the "glTexImage2D(texType, 0, GL_RGBA, widthImg, heightImg, 0, format, pixelType, bytes);" in the Texture.cpp file in the constructor. When I change in the Main.cpp the call of the constructot from "GL_RGBA" to "GL_RGB" as the type, the error disappears, but instead of the image I can only see a black square :(
was rendering weird until i fixed one of the lines unsigned char* bytes = stbi_load("yourimage.jpg", &widthImg, &heightImg, &numColCh, 0); to this unsigned char* bytes = stbi_load("yourimage.jpg", &widthImg, &heightImg, &numColCh, STBI_rgb_alpha); works great now and renders .png and .jpg files.
@SuperLongfield