添加范例图片
This commit is contained in:
parent
b0028f41ba
commit
1918ec2949
@ -52,7 +52,7 @@ namespace hgl
|
||||
|
||||
if(!file.is_open())
|
||||
{
|
||||
std::cerr<<"[ERROR] open file<"<<filename<<"> failed."<<std::endl;
|
||||
std::cerr<<"[ERROR] open file<"<<filename.c_str()<<"> failed."<<std::endl;
|
||||
return(false);
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ namespace hgl
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr<<"[ERROR] Image format error,filename: "<<filename<<std::endl;
|
||||
std::cerr<<"[ERROR] Image format error,filename: "<<filename.c_str()<<std::endl;
|
||||
delete[] data;
|
||||
return(false);
|
||||
}
|
||||
@ -105,7 +105,7 @@ namespace hgl
|
||||
glTextureParameteri(tex_id,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
|
||||
glTextureParameteri(tex_id,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
|
||||
|
||||
std::cout<<"load image file<"<<filename<<">:<"<<header->width<<"x"<<header->height<<"> to texture ok"<<std::endl;
|
||||
std::cout<<"load image file<"<<filename.c_str()<<">:<"<<header->width<<"x"<<header->height<<"> to texture ok"<<std::endl;
|
||||
|
||||
delete[] data;
|
||||
return(true);
|
||||
|
@ -41,14 +41,14 @@ void main()
|
||||
constexpr char fragment_shader[]=R"(
|
||||
#version 330 core
|
||||
|
||||
uniform sampler2D TextureLuna;
|
||||
uniform sampler2D TextureLena;
|
||||
|
||||
in vec2 FragmentTexCoord;
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor=texture(TextureLuna,FragmentTexCoord);
|
||||
FragColor=texture(TextureLena,FragmentTexCoord);
|
||||
})";
|
||||
|
||||
Shader shader;
|
||||
@ -119,10 +119,10 @@ void InitVertexBuffer()
|
||||
|
||||
bool InitTexture()
|
||||
{
|
||||
if(!LoadTGATexture("luna.tga",texture_id))
|
||||
if(!LoadTGATexture("lena.tga",texture_id))
|
||||
return(false);
|
||||
|
||||
int texture_location=shader.GetUniformLocation("TextureLuna");
|
||||
int texture_location=shader.GetUniformLocation("TextureLena");
|
||||
|
||||
glBindTextureUnit(0,texture_id);
|
||||
|
||||
|
BIN
res/image/lena.tga
Normal file
BIN
res/image/lena.tga
Normal file
Binary file not shown.
After Width: | Height: | Size: 768 KiB |
Loading…
x
Reference in New Issue
Block a user