opengl error work
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2025-05-14 23:03:16 -04:00
parent 2cefc2e228
commit 56068b4bbb
5 changed files with 17 additions and 17 deletions

View File

@ -1788,6 +1788,7 @@ Inventory state in non-creatures actually saves/loads to/from disk
Fix virtual scrollable mouse alignment for events Fix virtual scrollable mouse alignment for events
Remove warnings for fast loading Remove warnings for fast loading
Work on debugging framebuffers Work on debugging framebuffers
Work to unify opengl error reporting

View File

@ -6,8 +6,6 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import electrosphere.client.block.BlockChunkData;
import electrosphere.client.block.cells.BlockTextureAtlas;
import electrosphere.controls.cursor.CursorState; import electrosphere.controls.cursor.CursorState;
import electrosphere.data.block.BlockType; import electrosphere.data.block.BlockType;
import electrosphere.data.common.CommonEntityType; import electrosphere.data.common.CommonEntityType;
@ -17,7 +15,6 @@ import electrosphere.data.graphics.NonproceduralModel;
import electrosphere.data.voxel.VoxelType; import electrosphere.data.voxel.VoxelType;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.assetmanager.AssetDataStrings; import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.logger.LoggerInterface;
import electrosphere.renderer.RenderUtils; import electrosphere.renderer.RenderUtils;
/** /**
@ -179,9 +176,6 @@ public class Item extends CommonEntityType {
//set uniforms for the model //set uniforms for the model
Map<String,Map<String,Object>> meshUniformMap = new HashMap<String,Map<String,Object>>(); Map<String,Map<String,Object>> meshUniformMap = new HashMap<String,Map<String,Object>>();
Map<String,Object> uniforms = new HashMap<String,Object>(); Map<String,Object> uniforms = new HashMap<String,Object>();
if(Globals.blockTextureAtlas.getVoxelTypeOffset(blockType.getId()) == BlockTextureAtlas.MISSING && blockType.getId() != BlockChunkData.BLOCK_TYPE_EMPTY){
LoggerInterface.loggerEngine.WARNING("Block type " + blockType.getId() + " missing in BlockTextureAtlas");
}
uniforms.put("blockAtlasIndex",Globals.blockTextureAtlas.getVoxelTypeOffset(blockType.getId())); uniforms.put("blockAtlasIndex",Globals.blockTextureAtlas.getVoxelTypeOffset(blockType.getId()));
meshUniformMap.put(RenderUtils.MESH_NAME_BLOCK_SINGLE,uniforms); meshUniformMap.put(RenderUtils.MESH_NAME_BLOCK_SINGLE,uniforms);
modelData.setUniforms(meshUniformMap); modelData.setUniforms(meshUniformMap);

View File

@ -321,8 +321,6 @@ public class Mesh {
if(currentUniformRaw instanceof Matrix4d){ if(currentUniformRaw instanceof Matrix4d){
Matrix4d currentUniform = (Matrix4d)currentUniformRaw; Matrix4d currentUniform = (Matrix4d)currentUniformRaw;
openGLState.getActiveShader().setUniform(openGLState, key, currentUniform); openGLState.getActiveShader().setUniform(openGLState, key, currentUniform);
// GL40.glUniformMatrix4dv(glGetUniformLocation(openGLState.getActiveShader().getId(), key), false, currentUniform.get(new double[16]));
Globals.renderingEngine.checkError();
} }
if(currentUniformRaw instanceof Vector3d){ if(currentUniformRaw instanceof Vector3d){
throw new Error("Unsupported data type!"); throw new Error("Unsupported data type!");
@ -330,20 +328,14 @@ public class Mesh {
if(currentUniformRaw instanceof Vector3f){ if(currentUniformRaw instanceof Vector3f){
Vector3f currentUniform = (Vector3f)currentUniformRaw; Vector3f currentUniform = (Vector3f)currentUniformRaw;
openGLState.getActiveShader().setUniform(openGLState, key, currentUniform); openGLState.getActiveShader().setUniform(openGLState, key, currentUniform);
// glUniform3fv(glGetUniformLocation(openGLState.getActiveShader().getId(), key), currentUniform.get(BufferUtils.createFloatBuffer(3)));
Globals.renderingEngine.checkError();
} }
if(currentUniformRaw instanceof Vector4f){ if(currentUniformRaw instanceof Vector4f){
Vector4f currentUniform = (Vector4f)currentUniformRaw; Vector4f currentUniform = (Vector4f)currentUniformRaw;
openGLState.getActiveShader().setUniform(openGLState, key, currentUniform); openGLState.getActiveShader().setUniform(openGLState, key, currentUniform);
// glUniform3fv(glGetUniformLocation(openGLState.getActiveShader().getId(), key), currentUniform.get(BufferUtils.createFloatBuffer(3)));
Globals.renderingEngine.checkError();
} }
if(currentUniformRaw instanceof Integer){ if(currentUniformRaw instanceof Integer){
int currentUniform = (Integer)currentUniformRaw; int currentUniform = (Integer)currentUniformRaw;
openGLState.getActiveShader().setUniform(openGLState, key, currentUniform); openGLState.getActiveShader().setUniform(openGLState, key, currentUniform);
// glUniform1i(glGetUniformLocation(openGLState.getActiveShader().getId(), key), currentUniform);
Globals.renderingEngine.checkError();
} }
} }
} }

View File

@ -106,7 +106,7 @@ public class ComputeShader implements Shader {
// //
//get uniform location //get uniform location
int uniformLocation = GL40.glGetUniformLocation(this.getId(), uniformName); int uniformLocation = this.getUniformLocation(uniformName);
int glErrorCode = Globals.renderingEngine.getError(); int glErrorCode = Globals.renderingEngine.getError();
if(glErrorCode != 0){ if(glErrorCode != 0){
LoggerInterface.loggerRenderer.DEBUG_LOOP(RenderingEngine.getErrorInEnglish(glErrorCode)); LoggerInterface.loggerRenderer.DEBUG_LOOP(RenderingEngine.getErrorInEnglish(glErrorCode));
@ -122,6 +122,17 @@ public class ComputeShader implements Shader {
} }
} }
/**
* Gets the location of a given uniform
* @param uniformName The name of the uniform
* @return The location of the uniform
*/
public int getUniformLocation(String uniformName){
int rVal = GL40.glGetUniformLocation(this.getId(), uniformName);
Globals.renderingEngine.checkError();
return rVal;
}
@Override @Override

View File

@ -509,7 +509,7 @@ public class VisualShader implements Shader {
// //
//get uniform location //get uniform location
int uniformLocation = GL40.glGetUniformLocation(this.getId(), uniformName); int uniformLocation = this.getUniformLocation(uniformName);
int glErrorCode = Globals.renderingEngine.getError(); int glErrorCode = Globals.renderingEngine.getError();
if(glErrorCode != 0){ if(glErrorCode != 0){
LoggerInterface.loggerRenderer.DEBUG_LOOP(RenderingEngine.getErrorInEnglish(glErrorCode)); LoggerInterface.loggerRenderer.DEBUG_LOOP(RenderingEngine.getErrorInEnglish(glErrorCode));
@ -531,7 +531,9 @@ public class VisualShader implements Shader {
* @return The location of the uniform * @return The location of the uniform
*/ */
public int getUniformLocation(String uniformName){ public int getUniformLocation(String uniformName){
return GL40.glGetUniformLocation(this.getId(), uniformName); int rVal = GL40.glGetUniformLocation(this.getId(), uniformName);
Globals.renderingEngine.checkError();
return rVal;
} }