/*
* Copyright 2015 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.terasology.engine.subsystem.lwjgl;
import org.terasology.rendering.assets.texture.Texture;
import static org.lwjgl.opengl.GL11.GL_CLAMP;
import static org.lwjgl.opengl.GL11.GL_LINEAR;
import static org.lwjgl.opengl.GL11.GL_LINEAR_MIPMAP_LINEAR;
import static org.lwjgl.opengl.GL11.GL_NEAREST;
import static org.lwjgl.opengl.GL11.GL_NEAREST_MIPMAP_NEAREST;
import static org.lwjgl.opengl.GL11.GL_REPEAT;
/**
*/
public final class LwjglGraphicsUtil {
private LwjglGraphicsUtil() {
}
public static int getGLMode(Texture.WrapMode mode) {
switch (mode) {
case CLAMP:
return GL_CLAMP;
case REPEAT:
return GL_REPEAT;
default:
throw new RuntimeException("Unsupported WrapMode '" + mode + "'");
}
}
public static int getGlMinFilter(Texture.FilterMode mode) {
switch (mode) {
case LINEAR:
return GL_LINEAR_MIPMAP_LINEAR;
case NEAREST:
return GL_NEAREST_MIPMAP_NEAREST;
default:
throw new RuntimeException("Unsupported FilterMode '" + mode + "'");
}
}
public static int getGlMagFilter(Texture.FilterMode filterMode2) {
switch (filterMode2) {
case LINEAR:
return GL_LINEAR;
case NEAREST:
return GL_NEAREST;
default:
throw new RuntimeException("Unsupported FilterMode '" + filterMode2 + "'");
}
}
}