List of usage examples for org.lwjgl.opengl GL11 GL_TRUE
int GL_TRUE
To view the source code for org.lwjgl.opengl GL11 GL_TRUE.
Click Source Link
From source file:opengl.test.object.object.java
protected final void link() { GL20.glLinkProgram(programID);/*from ww w. j a va 2s . c o m*/ if (GL20.glGetProgrami(programID, GL20.GL_LINK_STATUS) != GL11.GL_TRUE) { throw new RuntimeException("Khong the link program"); } }
From source file:opengl.test.object.tree.testobject.leaf.java
private void vertexShader(String file) { this.vertexID = GL20.glCreateShader(GL20.GL_VERTEX_SHADER); GL20.glShaderSource(this.vertexID, leaf.sourceLoader(file)); GL20.glCompileShader(this.vertexID); if (GL20.glGetShaderi(this.vertexID, GL20.GL_COMPILE_STATUS) != GL11.GL_TRUE) { throw new RuntimeException("Khong the compile vertexShader"); }//from w ww . ja va 2s. c om GL20.glAttachShader(this.programID, this.vertexID); }
From source file:opengl.test.object.tree.testobject.leaf.java
private void fragmentShader(String file) { this.fragmentID = GL20.glCreateShader(GL20.GL_FRAGMENT_SHADER); GL20.glShaderSource(this.fragmentID, leaf.sourceLoader(file)); GL20.glCompileShader(this.fragmentID); if (GL20.glGetShaderi(this.fragmentID, GL20.GL_COMPILE_STATUS) != GL11.GL_TRUE) { throw new RuntimeException("Khong the compile fragmentShader"); }/* ww w .j av a 2 s .c o m*/ GL20.glAttachShader(this.programID, this.fragmentID); }
From source file:opengl.test.object.tree.testobject.leaf.java
private void link() { GL20.glLinkProgram(programID);/*from ww w . j av a 2 s . c o m*/ if (GL20.glGetProgrami(programID, GL20.GL_LINK_STATUS) != GL11.GL_TRUE) { throw new RuntimeException("Khong the link program"); } }
From source file:opengl.test.object.tree.testobject.traicay.java
private void vertexShader(String file) { this.vertexID = GL20.glCreateShader(GL20.GL_VERTEX_SHADER); GL20.glShaderSource(this.vertexID, traicay.sourceLoader(file)); GL20.glCompileShader(this.vertexID); if (GL20.glGetShaderi(this.vertexID, GL20.GL_COMPILE_STATUS) != GL11.GL_TRUE) { throw new RuntimeException("Khong the compile vertexShader"); }/*from ww w . jav a 2 s .c o m*/ GL20.glAttachShader(this.programID, this.vertexID); }
From source file:opengl.test.object.tree.testobject.traicay.java
private void fragmentShader(String file) { this.fragmentID = GL20.glCreateShader(GL20.GL_FRAGMENT_SHADER); GL20.glShaderSource(this.fragmentID, traicay.sourceLoader(file)); GL20.glCompileShader(this.fragmentID); if (GL20.glGetShaderi(this.fragmentID, GL20.GL_COMPILE_STATUS) != GL11.GL_TRUE) { throw new RuntimeException("Khong the compile fragmentShader"); }//from ww w. j av a2s . co m GL20.glAttachShader(this.programID, this.fragmentID); }
From source file:opengl.test.object.tree.testobject.trunk.java
private void vertexShader(String file) { this.vertexID = GL20.glCreateShader(GL20.GL_VERTEX_SHADER); GL20.glShaderSource(this.vertexID, trunk.sourceLoader(file)); GL20.glCompileShader(this.vertexID); if (GL20.glGetShaderi(this.vertexID, GL20.GL_COMPILE_STATUS) != GL11.GL_TRUE) { throw new RuntimeException("Khong the compile vertexShader"); }//from w ww.ja va 2 s .c om GL20.glAttachShader(this.programID, this.vertexID); }
From source file:opengl.test.object.tree.testobject.trunk.java
private void fragmentShader(String file) { this.fragmentID = GL20.glCreateShader(GL20.GL_FRAGMENT_SHADER); GL20.glShaderSource(this.fragmentID, trunk.sourceLoader(file)); GL20.glCompileShader(this.fragmentID); if (GL20.glGetShaderi(this.fragmentID, GL20.GL_COMPILE_STATUS) != GL11.GL_TRUE) { throw new RuntimeException("Khong the compile fragmentShader"); }//w w w .j a v a 2s . c om GL20.glAttachShader(this.programID, this.fragmentID); }
From source file:opengl.test.OpenGL.java
public OpenGL() { GLFW.glfwSetErrorCallback(errorCallback); if (GLFW.glfwInit() != GLFW.GLFW_TRUE) { throw new RuntimeException("Khong the khoi tao glfw"); }/*from www. ja v a2s . com*/ GLFW.glfwDefaultWindowHints(); GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MAJOR, 3);// su dung opengl phien ban 3.2 --> GLSL phien bn 1.50 GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MINOR, 2); GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_PROFILE, GLFW.GLFW_OPENGL_CORE_PROFILE); GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_FORWARD_COMPAT, GLFW.GLFW_TRUE); this.windowID = GLFW.glfwCreateWindow(this.width, this.height, this.title, MemoryUtil.NULL, MemoryUtil.NULL); if (this.windowID == MemoryUtil.NULL) { throw new RuntimeException("Khong the tao window"); } GLFW.glfwMakeContextCurrent(windowID); GL.createCapabilities(); GLFW.glfwSwapInterval(1); this.keyCallback = new GLFWKeyCallback() { @Override public void invoke(long arg0, int arg1, int arg2, int arg3, int arg4) { if (arg1 == GLFW.GLFW_KEY_ESCAPE && arg3 != GLFW.GLFW_RELEASE) { GLFW.glfwSetWindowShouldClose(windowID, GL11.GL_TRUE); } OpenGL.this.keyCallback(arg0, arg1, arg2, arg3, arg4); } }; this.windowSizeCallback = new GLFWWindowSizeCallback() { @Override public void invoke(long arg0, int arg1, int arg2) { GL11.glViewport(0, 0, arg1, arg2);// view port 0,0 goc tre, arg1, arg2 goc duoi cung ! } }; this.cursorPosCallback = new GLFWCursorPosCallback() { @Override public void invoke(long arg0, double arg1, double arg2) { OpenGL.this.cursorCallback(arg0, arg1, arg2); } }; GLFW.glfwSetWindowSizeCallback(windowID, windowSizeCallback); GLFW.glfwSetKeyCallback(windowID, keyCallback); GLFW.glfwSetCursorPosCallback(windowID, cursorPosCallback); try { this.init(); this.loop(); } catch (InterruptedException ex) { throw new RuntimeException("Loop !!!1"); } }
From source file:org.diorite.impl.client.Main.java
License:Open Source License
private void init() { // Setup an error callback. The default implementation // will print the error message in System.err. glfwSetErrorCallback(this.errorCallback = errorCallbackPrint(System.err)); // Initialize GLFW. Most GLFW functions will not work before doing this. if (glfwInit() != GL11.GL_TRUE) { throw new IllegalStateException("Unable to initialize GLFW"); }/*from w w w. j a v a 2 s . c o m*/ // Configure our window glfwDefaultWindowHints(); // optional, the current window hints are already the default glfwWindowHint(GLFW_VISIBLE, GL_FALSE); // the window will stay hidden after creation glfwWindowHint(GLFW_RESIZABLE, GL_TRUE); // the window will be resizable // Create the window this.window = glfwCreateWindow(this.width, this.height, "DioritOS", NULL, NULL); if (this.window == NULL) { throw new RuntimeException("Failed to create the GLFW window"); } this.resizeCallback = GLFWWindowSizeCallback(this::handleResize); // Setup a key callback. It will be called every time a key is pressed, repeated or released. glfwSetKeyCallback(this.window, this.keyCallback = new MyGLFWResizeKeyCallback()); // Get the resolution of the primary monitor final ByteBuffer vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); // Center our window glfwSetWindowPos(this.window, (GLFWvidmode.width(vidmode) - this.width) / 2, (GLFWvidmode.height(vidmode) - this.height) / 2); // Make the OpenGL context current glfwMakeContextCurrent(this.window); // Enable v-sync glfwSwapInterval(1); // Make the window visible glfwShowWindow(this.window); glfwSetWindowSizeCallback(this.window, this.resizeCallback); }