728x90
반응형
bool Texture::Load(const std::string& fileName)
{
/*
int channels = 0;
unsigned char* image = SOIL_load_image(fileName.c_str(),&mWidth, &mHeight, &channels, SOIL_LOAD_AUTO);
위 코드 미실행 시 mWidth, mHeight의 값을 별도로 채워줘야 그림이 그려짐
*/
mWidth = 10;
mHeight = 10;
/*
if (image == nullptr)
{
SDL_Log("SOIL failed to load image %s: %s", fileName.c_str(), SOIL_last_result());
return false;
}
int format = GL_RGB;
if (channels == 4)
{
format = GL_RGBA;
}
glGenTextures(1, &mTextureID);
glBindTexture(GL_TEXTURE_2D, mTextureID);
*/
/*
//여기를 숨기면 검정색 사각형 나옴 (Sprite.frag를 사용할 때)
//현재 바인딩된 텍스처 객체 (mTextureID)가 텍스처 이미지 (image)를 가짐
//원본 이미지 데이터를 텍스처 오브젝트에 복사
glTexImage2D(GL_TEXTURE_2D, 0, format, mWidth, mHeight, 0, format, GL_UNSIGNED_BYTE, image);
SOIL_free_image_data(image);
// Enable bilinear filtering
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
*/
return true;
}
728x90
반응형
'코드 > C++' 카테고리의 다른 글
What does the GL_ARRAY_BUFFER target mean in glBindBuffer? (0) | 2023.08.31 |
---|---|
how can Balmer find (0) | 2023.08.17 |
OpenGL 환경설정 (0) | 2023.07.24 |
서브시스템 (0) | 2023.07.09 |
128TB를 16진수로 변환 (0) | 2023.07.07 |
댓글