mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 19:05:02 -04:00
rendering: fix shader loading
This commit is contained in:
parent
448e83e39d
commit
34c0f5aa31
@ -8,21 +8,22 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.lwjgl.opengl.ARBShaderObjects.*;
|
||||
import static org.lwjgl.system.MemoryUtil.NULL;
|
||||
|
||||
|
||||
public class ShaderUtil {
|
||||
public static int createShader(String shaderPath, int shaderType) throws ShaderLoadingException, IOException {
|
||||
int shaderId = ARBShaderObjects.glCreateShaderObjectARB(shaderType);
|
||||
int shaderId = glCreateShaderObjectARB(shaderType);
|
||||
|
||||
if (shaderId == NULL) {
|
||||
throw new ShaderLoadingException();
|
||||
}
|
||||
|
||||
ARBShaderObjects.glShaderSourceARB(shaderId, Util.readAssetResource("/rendering/shader/" + shaderPath));
|
||||
ARBShaderObjects.glCompileShaderARB(shaderId);
|
||||
glShaderSourceARB(shaderId, Util.readAssetResource("rendering/shader/" + shaderPath));
|
||||
glCompileShaderARB(shaderId);
|
||||
|
||||
if (ARBShaderObjects.glGetObjectParameteriARB(shaderId, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE) {
|
||||
if (glGetObjectParameteriARB(shaderId, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE) {
|
||||
throw new ShaderLoadingException(OpenGLUtil.getLogInfo(shaderId));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user