mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-14 05:12:25 +08:00
Added some object labels in opengl so they're reflected on RenderDoc while on debug
Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
parent
69657a0014
commit
261bc696df
3
main.cpp
3
main.cpp
@ -132,6 +132,9 @@ void initGLFW ()
|
||||
glfwWindowHint (GLFW_SAMPLES, 4);
|
||||
glfwWindowHint (GLFW_CONTEXT_VERSION_MAJOR, 2);
|
||||
glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 1);
|
||||
|
||||
if (DEBUG)
|
||||
glfwWindowHint (GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
|
||||
}
|
||||
|
||||
void addPkg (CCombinedContainer* containers, const std::string& path, std::string pkgfile)
|
||||
|
@ -13,7 +13,12 @@ ITexture* CContainer::readTexture (std::string filename)
|
||||
|
||||
void* textureContents = this->readFile (filename, nullptr);
|
||||
|
||||
return new CTexture (textureContents);
|
||||
ITexture* result = new CTexture (textureContents);
|
||||
|
||||
if (DEBUG)
|
||||
glObjectLabel (GL_TEXTURE, result->getTextureID (), -1, filename.c_str ());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string CContainer::readVertexShader (const std::string& filename)
|
||||
|
@ -26,6 +26,10 @@ CFBO::CFBO (
|
||||
glBindTexture (GL_TEXTURE_2D, this->m_texture);
|
||||
// give OpenGL an empty image
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, textureWidth, textureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
// label stuff for debugging
|
||||
if (DEBUG)
|
||||
glObjectLabel (GL_TEXTURE, this->m_texture, -1, this->m_name.c_str ());
|
||||
|
||||
// set filtering parameters, otherwise the texture is not rendered
|
||||
if (flags & TextureFlags::ClampUVs)
|
||||
{
|
||||
|
@ -242,6 +242,14 @@ void CPass::render (CFBO* drawTo, ITexture* input, GLuint position, GLuint texco
|
||||
glEnableVertexAttribArray ((*cur)->id);
|
||||
glBindBuffer (GL_ARRAY_BUFFER, *(*cur)->value);
|
||||
glVertexAttribPointer ((*cur)->id, (*cur)->elements, (*cur)->type, GL_FALSE, 0, nullptr);
|
||||
|
||||
if (DEBUG)
|
||||
glObjectLabel (GL_BUFFER, *(*cur)->value, -1, (
|
||||
"Image " + std::to_string (this->getMaterial ()->getImage ()->getId ()) +
|
||||
" Pass " + this->m_pass->getShader() +
|
||||
" " + (*cur)->name
|
||||
).c_str ()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -391,6 +399,13 @@ void CPass::setupShaders ()
|
||||
throw std::runtime_error (message);
|
||||
}
|
||||
|
||||
if (DEBUG)
|
||||
{
|
||||
glObjectLabel (GL_PROGRAM, this->m_programID, -1, this->m_pass->getShader ().c_str ());
|
||||
glObjectLabel (GL_SHADER, vertexShaderID, -1, (this->m_pass->getShader () + ".vert").c_str ());
|
||||
glObjectLabel (GL_SHADER, fragmentShaderID, -1, (this->m_pass->getShader () + ".frag").c_str ());
|
||||
}
|
||||
|
||||
// after being liked shaders can be dettached and deleted
|
||||
glDetachShader (this->m_programID, vertexShaderID);
|
||||
glDetachShader (this->m_programID, fragmentShaderID);
|
||||
|
Loading…
Reference in New Issue
Block a user