more accurate opengl error tracking
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-08-28 16:09:53 -04:00
parent f244bb8357
commit 05c51896e0
4 changed files with 21 additions and 7 deletions

8
Jenkinsfile vendored
View File

@ -45,7 +45,13 @@ pipeline {
timeout: 25
]
) {
sh 'mvn test -P integration'
script {
try {
sh 'mvn test -P integration'
} catch(err) {
sh 'mvn test -P integration -DmaxLogs'
}
}
}
}
post {

View File

@ -13,6 +13,7 @@ import org.lwjgl.opengl.GL31;
import electrosphere.engine.Globals;
import electrosphere.entity.types.camera.CameraEntityUtils;
import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.OpenGLState;
import electrosphere.renderer.shader.ShaderProgram;
/**
@ -154,19 +155,22 @@ public class LightManager {
* Call in each mesh / per each shader
* @param shaderIndex
*/
public void bindBuffer(int shaderIndex){
public void bindBuffer(OpenGLState openGLState){
//get position of lights object in shader
int bufferIndex = GL31.glGetUniformBlockIndex(shaderIndex, "Lights");
int bufferIndex = GL31.glGetUniformBlockIndex(openGLState.getActiveShader().getShaderId(), "Lights");
Globals.renderingEngine.checkError();
if(bufferIndex == ShaderProgram.INVALID_UNIFORM_NAME){
LoggerInterface.loggerRenderer.INFO("Tried to buffer light manager to shader that does not have it active.");
} else {
//bind that position to the slot '2'
GL31.glUniformBlockBinding(shaderIndex, bufferIndex, BIND_POINT);
GL31.glUniformBlockBinding(openGLState.getActiveShader().getShaderId(), bufferIndex, BIND_POINT);
Globals.renderingEngine.checkError();
//bind our buffer to slot '2' as well
GL31.glBindBufferBase(GL_UNIFORM_BUFFER, BIND_POINT, uboIndex);
Globals.renderingEngine.checkError();
}
//alternatively if want to use range, do glBindBufferRange(GL_UNIFORM_BUFFER, 2, uboExampleBlock, 0, 152);
Globals.renderingEngine.checkError();
// Globals.renderingEngine.checkError();
}
/**

View File

@ -87,20 +87,24 @@ public class Material {
Texture diffuseTexture = Globals.assetManager.fetchTexture(diffuse);
if(diffuseTexture != null){
diffuseTexture.bind(openGLState,0);
Globals.renderingEngine.checkError();
openGLState.getActiveShader().setUniform(openGLState, "material.diffuse", 0);
Globals.renderingEngine.checkError();
}
}
if(specular != null){
Texture specularTexture = Globals.assetManager.fetchTexture(specular);
if(specularTexture != null){
specularTexture.bind(openGLState,1);
Globals.renderingEngine.checkError();
openGLState.getActiveShader().setUniform(openGLState, "material.specular", 1);
Globals.renderingEngine.checkError();
}
}
} else {
openGLState.glBindTextureUnit(GL_TEXTURE0, texturePointer, GL_TEXTURE_2D);
Globals.renderingEngine.checkError();
}
Globals.renderingEngine.checkError();
}
public void apply_material(OpenGLState openGLState, int diffuse_channel, int specular_channel){
Texture diffuseTexture = Globals.assetManager.fetchTexture(diffuse);

View File

@ -372,7 +372,7 @@ public class Mesh {
//don't buffer as the light manager hasn't initialized
} else {
LightManager lightManager = Globals.renderingEngine.getLightManager();
lightManager.bindBuffer(openGLState.getActiveShader().getShaderId());
lightManager.bindBuffer(openGLState);
}
Globals.renderingEngine.checkError();
}