implemented quad

This commit is contained in:
devZoGok
2021-10-18 19:03:11 +03:00
parent 628c3a6d68
commit 0083f9e5b8
29 changed files with 9032 additions and 6 deletions
+28
View File
@@ -0,0 +1,28 @@
#define STB_IMAGE_IMPLEMENTATION
#include"stb_image.h"
#include<glad.h>
#include<glfw3.h>
#include"texture.h"
using namespace std;
namespace vb01{
Texture::Texture(string path){
glGenTextures(1,&texture);
glBindTexture(GL_TEXTURE_2D,texture);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
data=stbi_load(path.c_str(),&width,&height,&numChannels,0);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,width,height,0,GL_RGB,GL_UNSIGNED_BYTE,data);
//glGenerateMipmap(GL_TEXTURE_2D);
stbi_image_free(data);
}
void Texture::select(){
glBindTexture(GL_TEXTURE_2D,texture);
}
}