Skip to content

Commit

Permalink
Change GL_TRUE/GL_FALSE to GLFW_TRUE/GLFW_FALSE, part of Issue #2
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverTiger committed Oct 16, 2015
1 parent b5ec0c2 commit 9abbab7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/silvertiger/tutorial/lwjgl/Introduction.java
Expand Up @@ -60,7 +60,7 @@ public class Introduction {
@Override
public void invoke(long window, int key, int scancode, int action, int mods) {
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) {
glfwSetWindowShouldClose(window, GL_TRUE);
glfwSetWindowShouldClose(window, GLFW_TRUE);
}
}
};
Expand All @@ -78,7 +78,7 @@ public static void main(String[] args) {
glfwSetErrorCallback(errorCallback);

/* Initialize GLFW */
if (glfwInit() != GL_TRUE) {
if (glfwInit() != GLFW_TRUE) {
throw new IllegalStateException("Unable to initialize GLFW");
}

Expand Down Expand Up @@ -111,7 +111,7 @@ public static void main(String[] args) {
IntBuffer height = BufferUtils.createIntBuffer(1);

/* Loop until window gets closed */
while (glfwWindowShouldClose(window) != GL_TRUE) {
while (glfwWindowShouldClose(window) != GLFW_TRUE) {
float ratio;

/* Get width and height to calcualte the ratio */
Expand Down
4 changes: 2 additions & 2 deletions src/silvertiger/tutorial/lwjgl/core/Game.java
Expand Up @@ -36,10 +36,10 @@
import silvertiger.tutorial.lwjgl.graphic.Renderer;
import silvertiger.tutorial.lwjgl.graphic.Window;

import static org.lwjgl.glfw.GLFW.GLFW_TRUE;
import static org.lwjgl.glfw.GLFW.glfwInit;
import static org.lwjgl.glfw.GLFW.glfwSetErrorCallback;
import static org.lwjgl.glfw.GLFW.glfwTerminate;
import static org.lwjgl.opengl.GL11.GL_TRUE;

/**
* The game class just initializes the game and starts the game loop. After
Expand Down Expand Up @@ -124,7 +124,7 @@ public void init() {
glfwSetErrorCallback(errorCallback);

/* Initialize GLFW */
if (glfwInit() != GL_TRUE) {
if (glfwInit() != GLFW_TRUE) {
throw new IllegalStateException("Unable to initialize GLFW!");
}

Expand Down
12 changes: 5 additions & 7 deletions src/silvertiger/tutorial/lwjgl/graphic/Window.java
Expand Up @@ -29,8 +29,6 @@
import org.lwjgl.opengl.GLCapabilities;

import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.GL_FALSE;
import static org.lwjgl.opengl.GL11.GL_TRUE;
import static org.lwjgl.system.MemoryUtil.NULL;

/**
Expand Down Expand Up @@ -69,7 +67,7 @@ public Window(int width, int height, CharSequence title, boolean vsync) {

/* Creating a temporary window for getting the available OpenGL version */
glfwDefaultWindowHints();
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
long temp = glfwCreateWindow(1, 1, "", NULL, NULL);
glfwMakeContextCurrent(temp);
GL.createCapabilities();
Expand All @@ -83,7 +81,7 @@ public Window(int width, int height, CharSequence title, boolean vsync) {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
} else if (caps.OpenGL21) {
/* Hints for legacy OpenGL 2.1 */
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
Expand All @@ -92,7 +90,7 @@ public Window(int width, int height, CharSequence title, boolean vsync) {
throw new RuntimeException("Neither OpenGL 3.2 nor OpenGL 2.1 is "
+ "supported, you may want to update your graphics driver.");
}
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);

/* Create window with specified OpenGL context */
id = glfwCreateWindow(width, height, title, NULL, NULL);
Expand Down Expand Up @@ -122,7 +120,7 @@ public Window(int width, int height, CharSequence title, boolean vsync) {
@Override
public void invoke(long window, int key, int scancode, int action, int mods) {
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) {
glfwSetWindowShouldClose(window, GL_TRUE);
glfwSetWindowShouldClose(window, GLFW_TRUE);
}
}
};
Expand All @@ -135,7 +133,7 @@ public void invoke(long window, int key, int scancode, int action, int mods) {
* @return true if the window should close, else false
*/
public boolean isClosing() {
return glfwWindowShouldClose(id) == GL_TRUE;
return glfwWindowShouldClose(id) == GLFW_TRUE;
}

/**
Expand Down

0 comments on commit 9abbab7

Please sign in to comment.