chore: sync workspace state
This commit is contained in:
@@ -42,8 +42,10 @@ bool OpenGLTexture::Initialize(OpenGLTextureType type, int width, int height, in
|
||||
}
|
||||
} else if (type == OpenGLTextureType::Texture1D) {
|
||||
glTexImage1D(GL_TEXTURE_1D, 0, internalFormat, width, 0, glFormat, glType, data);
|
||||
} else if (type == OpenGLTextureType::Texture3D) {
|
||||
glTexImage3D(GL_TEXTURE_3D, 0, internalFormat, width, height, depth, 0, glFormat, glType, data);
|
||||
} else if (type == OpenGLTextureType::Texture3D ||
|
||||
type == OpenGLTextureType::Texture2DArray ||
|
||||
type == OpenGLTextureType::TextureCubeArray) {
|
||||
glTexImage3D(target, 0, internalFormat, width, height, depth, 0, glFormat, glType, data);
|
||||
} else {
|
||||
glTexImage2D(target, 0, internalFormat, width, height, 0, glFormat, glType, data);
|
||||
}
|
||||
@@ -54,8 +56,17 @@ bool OpenGLTexture::Initialize(OpenGLTextureType type, int width, int height, in
|
||||
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
}
|
||||
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
const GLint wrapMode = (type == OpenGLTextureType::TextureCube || type == OpenGLTextureType::TextureCubeArray)
|
||||
? GL_CLAMP_TO_EDGE
|
||||
: GL_REPEAT;
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_S, wrapMode);
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_T, wrapMode);
|
||||
if (type == OpenGLTextureType::Texture3D ||
|
||||
type == OpenGLTextureType::Texture2DArray ||
|
||||
type == OpenGLTextureType::TextureCube ||
|
||||
type == OpenGLTextureType::TextureCubeArray) {
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_R, wrapMode);
|
||||
}
|
||||
|
||||
glBindTexture(target, 0);
|
||||
return true;
|
||||
@@ -177,7 +188,11 @@ void OpenGLTexture::SetWrapping(int wrapS, int wrapT, int wrapR) {
|
||||
glBindTexture(target, m_texture);
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_S, wrapS);
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_T, wrapT);
|
||||
if (wrapR >= 0 && (m_type == OpenGLTextureType::Texture3D || m_type == OpenGLTextureType::TextureCube)) {
|
||||
if (wrapR >= 0 &&
|
||||
(m_type == OpenGLTextureType::Texture3D ||
|
||||
m_type == OpenGLTextureType::Texture2DArray ||
|
||||
m_type == OpenGLTextureType::TextureCube ||
|
||||
m_type == OpenGLTextureType::TextureCubeArray)) {
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_R, wrapR);
|
||||
}
|
||||
glBindTexture(target, 0);
|
||||
|
||||
Reference in New Issue
Block a user