mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 03:44:54 -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 java.io.IOException;
|
||||||
|
|
||||||
|
import static org.lwjgl.opengl.ARBShaderObjects.*;
|
||||||
import static org.lwjgl.system.MemoryUtil.NULL;
|
import static org.lwjgl.system.MemoryUtil.NULL;
|
||||||
|
|
||||||
|
|
||||||
public class ShaderUtil {
|
public class ShaderUtil {
|
||||||
public static int createShader(String shaderPath, int shaderType) throws ShaderLoadingException, IOException {
|
public static int createShader(String shaderPath, int shaderType) throws ShaderLoadingException, IOException {
|
||||||
int shaderId = ARBShaderObjects.glCreateShaderObjectARB(shaderType);
|
int shaderId = glCreateShaderObjectARB(shaderType);
|
||||||
|
|
||||||
if (shaderId == NULL) {
|
if (shaderId == NULL) {
|
||||||
throw new ShaderLoadingException();
|
throw new ShaderLoadingException();
|
||||||
}
|
}
|
||||||
|
|
||||||
ARBShaderObjects.glShaderSourceARB(shaderId, Util.readAssetResource("/rendering/shader/" + shaderPath));
|
glShaderSourceARB(shaderId, Util.readAssetResource("rendering/shader/" + shaderPath));
|
||||||
ARBShaderObjects.glCompileShaderARB(shaderId);
|
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));
|
throw new ShaderLoadingException(OpenGLUtil.getLogInfo(shaderId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user