Hello I'm having an issue where for some reason it only renders to a small center portion of the screen, as you see in the screenshot (I changed the glClearColor for both buffers so you can easilly see)
Render func:
void GAMELAUNCHER::Render()
{
glBindFramebuffer(GL_FRAMEBUFFER, backend.frameBuffer);
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
backend.SetupPipelineForRender();
gameState->Render(backend.pipeline);
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
backend.FinishRender();
}
And Breaking those functions apart
void BACKENDSYSTEM::SetupPipelineForRender()
{
pipeline.Perspective(fov, (float)screenWidth / (float)screenHeight, 0.1f, 10000.0f);
pipeline.MatrixMode(VIEW_MATRIX);
pipeline.LoadIdentity();
}
void BACKENDSYSTEM::FinishRender()
{
glViewport(0, 0, screenWidth, screenHeight);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDisable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT);
pipeline.LoadIdentity();
pipeline.Ortho(-1, 1, -1, 1, -1, 1);
basicShader->Bind();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture);
glUniform1i(glGetUniformLocation(basicShader->GetProgramID(), "texture"), 0);
pipeline.CalcMatrices(basicShader->GetProgramID());
quad.Render();
basicShader->Unbind();
SDL_GL_SwapWindow(window);
}
Not sure why it's just a small window.
Also, everything is reversed in the scene for some reason. the translate's work correctly, -1 x goes left, +1 x goes right, However Positive rotation around the Y axis results in the model rotating anti-clockwise. the model you see should be holding the club in the other hand. Would this be a fault in any of the rendering code I've shown?
Thanks in advance.
-- ALSO ANOTHER PROBLEM
Whenever I do:
glEnable(GL_BLEND);
FragColor = vec4(texture2D(texture, TexCoord0).xyz, 1.0);
---- EDIT ---- Fixed the main problems I had posted, but this new one had taken me hours and I found no results on google.
I have 2 shaders
tileShader = new SHADER("Shaders/StandardShader.vs", "Shaders/TileShader.fs");
skinShader = new SHADER("Shaders/SkinningShader.vs", "Shaders/ShadingShader.fs");
and they each have 2 textures like so:
uniform sampler2D texture0;
uniform sampler2D texture1;
and then I do this:
glUniform1i(glGetUniformLocation(tileShader->GetProgramID(), "texture0"), 0);
glUniform1i(glGetUniformLocation(tileShader->GetProgramID(), "texture1"), 1);
glUniform1i(glGetUniformLocation(skinShader->GetProgramID(), "texture0"), 0);
glUniform1i(glGetUniformLocation(skinShader->GetProgramID(), "texture1"), 1);
In the shaders they do some stuff with the two textures mixing them together, however one of these shaders will only render ONE texture in place of both, depending on whichever I do the "new SHADER" on first(last works properly, first just has 1 texture, or is just sometimes completely black)
And I have no idea what the hell is causing this. I know my binding is fine, as swapping their "new SHADER" lines after each other makes them swap, one working and one not.
Any help is greatly appreciated.