17 minutes ago, JWColeman said:
Yep,
Now, how to use it, is a whole other discussion
I'm sure openGL has a device debug layer as well, its possible it could be throwing some warnings at you because of this.
I searched and they say you can't debug shaders natively. They have also Nvdia Inslight gor visual studio but i have amd and i cant use that debugger. I will see This gDebugger and i will come back later to post re results
3 minutes ago, JWColeman said:
Also, it may be that if you're pushing an RGBA through to your device but only sending it data for an RGB, it could be that each frame your RGB is getting shifted by sizeof(A)...
I'm really no expert on the rendering pipeline but these are oddities that I'm aware can occur when data is not pairing up just right.
what do you mean by that? Can you understand if I;m doing it in the code below? What is what you're saying and where i might be doing that?
Texture::Texture(std::string path, int unit)
{
//Try to load the image.
unsigned char *data = stbi_load(path.c_str(), &m_width, &m_height, &m_channels, 0);
//Image loaded successfully.
if (data)
{
//Generate the texture and bind it.
GLCall(glGenTextures(1, &m_id));
GLCall(glActiveTexture(GL_TEXTURE0 + unit));
GLCall(glBindTexture(GL_TEXTURE_2D, m_id));
//Not Transparent texture.
if (m_channels == 3)
{
GLCall(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_width, m_height, 0, GL_RGB, GL_UNSIGNED_BYTE, data));
}
//Transparent texture.
else if (m_channels == 4)
{
GLCall(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data));
}
//This image is not supported.
else
{
std::string err = "The Image: " + path;
err += " , is using " + m_channels;
err += " channels which are not supported.";
throw VampEngine::EngineError(err);
}
//Texture Filters.
GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT));
GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT));
GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST));
GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
//Generate mipmaps.
GLCall(glGenerateMipmap(GL_TEXTURE_2D));
}
//Loading Failed.
else
throw VampEngine::EngineError("There was an error loading image \
(Myabe the image format is not supported): " + path);
//Unbind the texture.
GLCall(glBindTexture(GL_TEXTURE_2D, 0));
//Free the image data.
stbi_image_free(data);
}