[DEV] commit all with new insland

This commit is contained in:
Edouard DUPIN 2022-03-23 13:37:47 +01:00
parent 548188c24a
commit 20887460f1
2 changed files with 18 additions and 6 deletions

View File

@ -26,7 +26,6 @@ import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.etk.math.Vector3i; import org.atriasoft.etk.math.Vector3i;
import org.atriasoft.etk.math.Vector4f; import org.atriasoft.etk.math.Vector4f;
import org.atriasoft.gale.internal.Log; import org.atriasoft.gale.internal.Log;
import org.lwjgl.BufferUtils; import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12; import org.lwjgl.opengl.GL12;
@ -35,14 +34,14 @@ import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL20; import org.lwjgl.opengl.GL20;
public class OpenGL { public class OpenGL {
public static enum ClearFlag { public enum ClearFlag {
clearFlag_colorBuffer, // !< Indicates the buffers currently enabled for color writing. clearFlag_colorBuffer, // !< Indicates the buffers currently enabled for color writing.
clearFlag_depthBuffer, // !< Indicates the depth buffer. clearFlag_depthBuffer, // !< Indicates the depth buffer.
clearFlag_stencilBuffer // !< Indicates the stencil buffer. clearFlag_stencilBuffer // !< Indicates the stencil buffer.
} }
// We map all the flag, but not all is supported by all platform... // We map all the flag, but not all is supported by all platform...
public static enum Flag { public enum Flag {
flag_blend, // !< If enabled, blend the computed fragment color values with the values in the color buffers. See glBlendFunc. flag_blend, // !< If enabled, blend the computed fragment color values with the values in the color buffers. See glBlendFunc.
flag_clipDistanceI, // !< If enabled, clip geometry against user-defined half space i. flag_clipDistanceI, // !< If enabled, clip geometry against user-defined half space i.
flag_colorLogigOP, // !< If enabled, apply the currently selected logical operation to the computed flag_colorLogigOP, // !< If enabled, apply the currently selected logical operation to the computed
@ -135,7 +134,7 @@ public class OpenGL {
} }
/* Shader wrapping : */ /* Shader wrapping : */
public static enum ShaderType { public enum ShaderType {
VERTEX, FRAGMENT VERTEX, FRAGMENT
} }
@ -738,6 +737,7 @@ public class OpenGL {
public static void programLoadUniformColor(final int location, final Color value) { public static void programLoadUniformColor(final int location, final Color value) {
GL20.glUniform4f(location, value.r(), value.g(), value.b(), value.a()); GL20.glUniform4f(location, value.r(), value.g(), value.b(), value.a());
} }
public static void programLoadUniformColorRGB(final int location, final Color value) { public static void programLoadUniformColorRGB(final int location, final Color value) {
GL20.glUniform3f(location, value.r(), value.g(), value.b()); GL20.glUniform3f(location, value.r(), value.g(), value.b());
} }
@ -1004,6 +1004,18 @@ public class OpenGL {
OpenGL.checkGlError("glViewport"); OpenGL.checkGlError("glViewport");
} }
public static void setViewPort(final Vector3f start, final Vector3f stop) {
// Log.info("setViewport " + start + " " + stop);
GL11.glViewport((int) start.x(), (int) start.y(), (int) stop.x(), (int) stop.y());
OpenGL.checkGlError("glViewport");
}
public static void setViewPort(final Vector3i start, final Vector3i stop) {
// Log.info("setViewport " + start + " " + stop);
GL11.glViewport(start.x(), start.y(), stop.x(), stop.y());
OpenGL.checkGlError("glViewport");
}
private static int shaderCreate(final ShaderType type) { private static int shaderCreate(final ShaderType type) {
int shaderId = 0; int shaderId = 0;
if (type == ShaderType.VERTEX) { if (type == ShaderType.VERTEX) {