OpenGL/C++ 3D Tutorial 14 - Textures 01

preview_player
Показать описание
Support:
- Udemy courses coming soon!

Links:

-C++ Tutorials:
-SFML:
-SFML Sidescroller:
-SFML Open World RPG:
-SFML Simple Games and Apps:
-SFML Games in ONE VIDEO:
-Livestreams:

#gamedeveloper #2dGames #programming
Рекомендации по теме
Комментарии
Автор

very cool totorial I found thats its possible to toggle between texture and color using a keybinding like this
#version 440
in vec3 vs_position;
in vec3 vs_color;
in vec2 vs_texcoord;
out vec4 fs_color;
uniform sampler2D texture0;
uniform vec4 additioncolour;
uniform bool usetexture;
void main(){
if(usetexture){
fs_color = texture(texture0, vs_texcoord) * vec4(vs_color, 1.f) * additioncolour;
}else{
fs_color = vec4(vs_color, 1.f) * additioncolour;
}
}


where usetexture is just a bool in main

glUniform1i(glGetUniformLocation(core_program, "usetexture"), usetexture);

TerminalHeatSink
Автор

the best tutorial on youtube about loading texture i think, informative explaination plus codes.thanks bro.

lanchanoinguyen
Автор

If one decides to use 24-bit bmps for their image data as opposed to PNGs, I noticed (to my surprise) that the pixel data in 24-bit bmps is actually stored upside down in memory. In that case, flipping the Y for openGL isn't necessary, which is kind of cool. (Not that flipping the Y is a big deal anyway, but yeah). Also, apparently 24-bit bmp stores in BGR and not RGB, which also came as a surprise to me, I can't imagine why it's like that, but anyway that param (GLenum format) in glTexImage2D() must be GL_BGR.

CardinalDXMP
Автор

Excellent video and tutorial. Sometimes I think that it would be good for viewers if you show your face for few seconds in the beginning or at the end....People will appreciate this in my opinion!

hssharma
Автор

I have same error which you have on 18.59. And making glm::vec2(1.0f, 1.0f) hasn't worked

ibrahimyavuz
Автор

Thank you.I use std_image because i can't use SOIL but i think is good

DRAGON_FullPower
Автор

the texture doesnot show on the rectangle on xcode and i donot know what is the problem

nadaelaraby
Автор

Idk why, but there is no blending or opacity, I know I enabled everything I needed to, does anyone have a fix for this?(fixed*)

featherless
Автор

when i try to run my code, it doesn't work. I compiled SOIL2 for mingw (followed all the instructions, only i compiled for mingw) and did all the code stuff. Then i compiled the project without errors.


When i type in cmd "main.exe" it tells me that it could not load the texture.


I checked the directory of pusheen and it matched the one in the code.
My "glTexParameteri" is also in the correct capitalization
Is there something wrong with the pusheen thingy? Or is it just me not knowing that theres something really small that is breaking the whole thing?

Kino-Imsureq
Автор

Hi, may I ask you for help? Thanks in advance. I already doublechecked everything rewatching the video and the code, but I cannot find the error. What I’ve written seems equal to yours in every single comma, space or CRLF, but maybe you had the same error in your career and you already know how to fix it. Thanks again.

TreniFS_
Автор

Is there a reason to place & before a variable? Like how you did with " &image_width "

kngsavage
Автор

Where is the code located on your github?

mattpis
Автор

To those who tried to load jpg write GL_RGB instead of GL_RGBA

almightyatom