List of usage examples for org.lwjgl.opengl GL createCapabilities
public static GLCapabilities createCapabilities()
From source file:org.lwjgl.demo.opengl.raytracing.Demo33.java
License:Open Source License
private void init() throws IOException { glfwSetErrorCallback(errCallback = new GLFWErrorCallback() { private GLFWErrorCallback delegate = GLFWErrorCallback.createPrint(System.err); @Override/*from ww w.j av a 2 s. co m*/ public void invoke(int error, long description) { if (error == GLFW_VERSION_UNAVAILABLE) System.err.println("This demo requires OpenGL 3.3 or higher."); delegate.invoke(error, description); } @Override public void free() { delegate.free(); } }); if (!glfwInit()) throw new IllegalStateException("Unable to initialize GLFW"); glfwDefaultWindowHints(); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); window = glfwCreateWindow(width, height, "Raytracing Demo (fragment shader)", NULL, NULL); if (window == NULL) { throw new AssertionError("Failed to create the GLFW window"); } System.out.println("Press keypad '+' or 'page up' to increase the number of bounces."); System.out.println("Press keypad '-' or 'page down' to decrease the number of bounces."); glfwSetKeyCallback(window, keyCallback = new GLFWKeyCallback() { @Override public void invoke(long window, int key, int scancode, int action, int mods) { if (action != GLFW_RELEASE) { return; } if (key == GLFW_KEY_ESCAPE) { glfwSetWindowShouldClose(window, true); } else if (key == GLFW_KEY_KP_ADD || key == GLFW_KEY_PAGE_UP) { int newBounceCount = Math.min(4, Demo33.this.bounceCount + 1); if (newBounceCount != Demo33.this.bounceCount) { Demo33.this.bounceCount = newBounceCount; System.out.println("Ray bounce count is now: " + Demo33.this.bounceCount); Demo33.this.frameNumber = 0; } } else if (key == GLFW_KEY_KP_SUBTRACT || key == GLFW_KEY_PAGE_DOWN) { int newBounceCount = Math.max(1, Demo33.this.bounceCount - 1); if (newBounceCount != Demo33.this.bounceCount) { Demo33.this.bounceCount = newBounceCount; System.out.println("Ray bounce count is now: " + Demo33.this.bounceCount); Demo33.this.frameNumber = 0; } } } }); glfwSetFramebufferSizeCallback(window, fbCallback = new GLFWFramebufferSizeCallback() { @Override public void invoke(long window, int width, int height) { if (width > 0 && height > 0 && (Demo33.this.width != width || Demo33.this.height != height)) { Demo33.this.width = width; Demo33.this.height = height; Demo33.this.resetFramebuffer = true; Demo33.this.frameNumber = 0; } } }); glfwSetCursorPosCallback(window, cpCallback = new GLFWCursorPosCallback() { @Override public void invoke(long window, double x, double y) { Demo33.this.mouseX = (float) x; if (mouseDown) { Demo33.this.frameNumber = 0; } } }); glfwSetMouseButtonCallback(window, mbCallback = new GLFWMouseButtonCallback() { @Override public void invoke(long window, int button, int action, int mods) { if (action == GLFW_PRESS) { Demo33.this.mouseDownX = Demo33.this.mouseX; Demo33.this.mouseDown = true; } else if (action == GLFW_RELEASE) { Demo33.this.mouseDown = false; Demo33.this.rotationAboutY = Demo33.this.currRotationAboutY; } } }); GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); glfwSetWindowPos(window, (vidmode.width() - width) / 2, (vidmode.height() - height) / 2); glfwMakeContextCurrent(window); glfwSwapInterval(0); glfwShowWindow(window); IntBuffer framebufferSize = BufferUtils.createIntBuffer(2); nglfwGetFramebufferSize(window, memAddress(framebufferSize), memAddress(framebufferSize) + 4); width = framebufferSize.get(0); height = framebufferSize.get(1); GL.createCapabilities(); debugProc = GLUtil.setupDebugMessageCallback(); /* Create all needed GL resources */ createFramebufferTexture(); createSampler(); createFrameBufferObject(); quadFullScreenVao(); createRayTracingProgram(); initRayTracingProgram(); createQuadProgram(); initQuadProgram(); firstTime = System.nanoTime(); }
From source file:org.lwjgl.demo.opengl.raytracing.Demo33Ubo.java
License:Open Source License
private void init() throws IOException { glfwSetErrorCallback(errCallback = new GLFWErrorCallback() { private GLFWErrorCallback delegate = GLFWErrorCallback.createPrint(System.err); @Override/*ww w .j av a 2s . c o m*/ public void invoke(int error, long description) { if (error == GLFW_VERSION_UNAVAILABLE) System.err.println("This demo requires OpenGL 3.3 or higher."); delegate.invoke(error, description); } @Override public void free() { delegate.free(); } }); if (!glfwInit()) throw new IllegalStateException("Unable to initialize GLFW"); glfwDefaultWindowHints(); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); window = glfwCreateWindow(width, height, "Raytracing Demo (fragment shader)", NULL, NULL); if (window == NULL) { throw new AssertionError("Failed to create the GLFW window"); } System.out.println("Press keypad '+' or 'page up' to increase the number of bounces."); System.out.println("Press keypad '-' or 'page down' to decrease the number of bounces."); glfwSetKeyCallback(window, keyCallback = new GLFWKeyCallback() { @Override public void invoke(long window, int key, int scancode, int action, int mods) { if (action != GLFW_RELEASE) { return; } if (key == GLFW_KEY_ESCAPE) { glfwSetWindowShouldClose(window, true); } else if (key == GLFW_KEY_KP_ADD || key == GLFW_KEY_PAGE_UP) { int newBounceCount = Math.min(4, Demo33Ubo.this.bounceCount + 1); if (newBounceCount != Demo33Ubo.this.bounceCount) { Demo33Ubo.this.bounceCount = newBounceCount; System.out.println("Ray bounce count is now: " + Demo33Ubo.this.bounceCount); Demo33Ubo.this.frameNumber = 0; } } else if (key == GLFW_KEY_KP_SUBTRACT || key == GLFW_KEY_PAGE_DOWN) { int newBounceCount = Math.max(1, Demo33Ubo.this.bounceCount - 1); if (newBounceCount != Demo33Ubo.this.bounceCount) { Demo33Ubo.this.bounceCount = newBounceCount; System.out.println("Ray bounce count is now: " + Demo33Ubo.this.bounceCount); Demo33Ubo.this.frameNumber = 0; } } } }); glfwSetFramebufferSizeCallback(window, fbCallback = new GLFWFramebufferSizeCallback() { @Override public void invoke(long window, int width, int height) { if (width > 0 && height > 0 && (Demo33Ubo.this.width != width || Demo33Ubo.this.height != height)) { Demo33Ubo.this.width = width; Demo33Ubo.this.height = height; Demo33Ubo.this.resetFramebuffer = true; Demo33Ubo.this.frameNumber = 0; } } }); glfwSetCursorPosCallback(window, cpCallback = new GLFWCursorPosCallback() { @Override public void invoke(long window, double x, double y) { Demo33Ubo.this.mouseX = (float) x; if (mouseDown) { Demo33Ubo.this.frameNumber = 0; } } }); glfwSetMouseButtonCallback(window, mbCallback = new GLFWMouseButtonCallback() { @Override public void invoke(long window, int button, int action, int mods) { if (action == GLFW_PRESS) { Demo33Ubo.this.mouseDownX = Demo33Ubo.this.mouseX; Demo33Ubo.this.mouseDown = true; } else if (action == GLFW_RELEASE) { Demo33Ubo.this.mouseDown = false; Demo33Ubo.this.rotationAboutY = Demo33Ubo.this.currRotationAboutY; } } }); GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); glfwSetWindowPos(window, (vidmode.width() - width) / 2, (vidmode.height() - height) / 2); glfwMakeContextCurrent(window); glfwSwapInterval(0); glfwShowWindow(window); IntBuffer framebufferSize = BufferUtils.createIntBuffer(2); nglfwGetFramebufferSize(window, memAddress(framebufferSize), memAddress(framebufferSize) + 4); width = framebufferSize.get(0); height = framebufferSize.get(1); GL.createCapabilities(); debugProc = GLUtil.setupDebugMessageCallback(); /* Create all needed GL resources */ createFramebufferTexture(); createSampler(); createFrameBufferObject(); createCameraSettingsUbo(); quadFullScreenVao(); createRayTracingProgram(); initRayTracingProgram(); createQuadProgram(); initQuadProgram(); firstTime = System.nanoTime(); }
From source file:org.lwjgl.demo.opengl.raytracing.DemoSsbo.java
License:Open Source License
private void init() throws IOException { glfwSetErrorCallback(errCallback = new GLFWErrorCallback() { private GLFWErrorCallback delegate = GLFWErrorCallback.createPrint(System.err); @Override//from ww w. j av a2 s.c o m public void invoke(int error, long description) { if (error == GLFW_VERSION_UNAVAILABLE) System.err.println( "This demo requires OpenGL 4.3 or higher. The Demo33 version works on OpenGL 3.3 or higher."); delegate.invoke(error, description); } @Override public void free() { delegate.free(); } }); if (!glfwInit()) throw new IllegalStateException("Unable to initialize GLFW"); glfwDefaultWindowHints(); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); window = glfwCreateWindow(width, height, "Raytracing Demo (compute shader)", NULL, NULL); if (window == NULL) { throw new AssertionError("Failed to create the GLFW window"); } glfwSetKeyCallback(window, keyCallback = new GLFWKeyCallback() { @Override public void invoke(long window, int key, int scancode, int action, int mods) { if (action != GLFW_RELEASE) return; if (key == GLFW_KEY_ESCAPE) glfwSetWindowShouldClose(window, true); } }); glfwSetFramebufferSizeCallback(window, fbCallback = new GLFWFramebufferSizeCallback() { @Override public void invoke(long window, int width, int height) { if (width > 0 && height > 0 && (DemoSsbo.this.width != width || DemoSsbo.this.height != height)) { DemoSsbo.this.width = width; DemoSsbo.this.height = height; DemoSsbo.this.resetFramebuffer = true; } } }); glfwSetCursorPosCallback(window, cpCallback = new GLFWCursorPosCallback() { @Override public void invoke(long window, double x, double y) { DemoSsbo.this.mouseX = (float) x; } }); glfwSetMouseButtonCallback(window, mbCallback = new GLFWMouseButtonCallback() { @Override public void invoke(long window, int button, int action, int mods) { if (action == GLFW_PRESS) { DemoSsbo.this.mouseDownX = DemoSsbo.this.mouseX; DemoSsbo.this.mouseDown = true; } else if (action == GLFW_RELEASE) { DemoSsbo.this.mouseDown = false; DemoSsbo.this.rotationAboutY = DemoSsbo.this.currRotationAboutY; } } }); GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); glfwSetWindowPos(window, (vidmode.width() - width) / 2, (vidmode.height() - height) / 2); glfwMakeContextCurrent(window); glfwSwapInterval(0); glfwShowWindow(window); IntBuffer framebufferSize = BufferUtils.createIntBuffer(2); nglfwGetFramebufferSize(window, memAddress(framebufferSize), memAddress(framebufferSize) + 4); width = framebufferSize.get(0); height = framebufferSize.get(1); GL.createCapabilities(); debugProc = GLUtil.setupDebugMessageCallback(); /* Create all needed GL resources */ createFramebufferTexture(); createSampler(); quadFullScreenVao(); createComputeProgram(); initComputeProgram(); createQuadProgram(); initQuadProgram(); createSceneSSBO(); createFramebufferBuffer(); }
From source file:org.lwjgl.demo.opengl.raytracing.DemoSsboTrianglesStacklessKdTree.java
License:Open Source License
void init() throws IOException { glfwSetErrorCallback(errCallback = new GLFWErrorCallback() { GLFWErrorCallback delegate = GLFWErrorCallback.createPrint(System.err); @Override//from w w w . j a v a 2 s. c o m public void invoke(int error, long description) { if (error == GLFW_VERSION_UNAVAILABLE) System.err.println("This demo requires OpenGL 4.3 or higher."); delegate.invoke(error, description); } @Override public void free() { delegate.free(); } }); if (!glfwInit()) throw new IllegalStateException("Unable to initialize GLFW"); glfwDefaultWindowHints(); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); window = glfwCreateWindow(width, height, "Raytracing Demo (triangle mesh, stackless kd-tree)", NULL, NULL); if (window == NULL) { throw new AssertionError("Failed to create the GLFW window"); } System.out.println("Hold down any mouse button and drag to rotate."); System.out.println("Press 'D' to toggle debug view."); glfwSetKeyCallback(window, keyCallback = new GLFWKeyCallback() { @Override public void invoke(long window, int key, int scancode, int action, int mods) { if (action == GLFW_PRESS) return; if (key == GLFW_KEY_ESCAPE) { glfwSetWindowShouldClose(window, true); } else if (key == GLFW_KEY_D) { debug = !debug; } } }); glfwSetFramebufferSizeCallback(window, fbCallback = new GLFWFramebufferSizeCallback() { @Override public void invoke(long window, int width, int height) { if (width > 0 && height > 0 && (DemoSsboTrianglesStacklessKdTree.this.width != width || DemoSsboTrianglesStacklessKdTree.this.height != height)) { DemoSsboTrianglesStacklessKdTree.this.width = width; DemoSsboTrianglesStacklessKdTree.this.height = height; DemoSsboTrianglesStacklessKdTree.this.resetFramebuffer = true; } } }); glfwSetCursorPosCallback(window, cpCallback = new GLFWCursorPosCallback() { @Override public void invoke(long window, double x, double y) { DemoSsboTrianglesStacklessKdTree.this.mouseX = (float) x; } }); glfwSetMouseButtonCallback(window, mbCallback = new GLFWMouseButtonCallback() { @Override public void invoke(long window, int button, int action, int mods) { if (action == GLFW_PRESS) { DemoSsboTrianglesStacklessKdTree.this.mouseDownX = DemoSsboTrianglesStacklessKdTree.this.mouseX; DemoSsboTrianglesStacklessKdTree.this.mouseDown = true; } else if (action == GLFW_RELEASE) { DemoSsboTrianglesStacklessKdTree.this.mouseDown = false; DemoSsboTrianglesStacklessKdTree.this.rotationAboutY = DemoSsboTrianglesStacklessKdTree.this.currRotationAboutY; } } }); GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); glfwSetWindowPos(window, (vidmode.width() - width) / 2, (vidmode.height() - height) / 2); glfwMakeContextCurrent(window); glfwSwapInterval(0); glfwShowWindow(window); IntBuffer framebufferSize = BufferUtils.createIntBuffer(2); nglfwGetFramebufferSize(window, memAddress(framebufferSize), memAddress(framebufferSize) + 4); width = framebufferSize.get(0); height = framebufferSize.get(1); caps = GL.createCapabilities(); debugProc = GLUtil.setupDebugMessageCallback(); /* Load OBJ model */ WavefrontMeshLoader loader = new WavefrontMeshLoader(); mesh = loader.loadMesh("org/lwjgl/demo/opengl/models/lwjgl3.obj.zip"); /* Create all needed GL resources */ createRaytracingTexture(); createSampler(); createSceneSSBO(); createComputeProgram(); initComputeProgram(); if (!caps.GL_NV_draw_texture) { createFullScreenVao(); createQuadProgram(); } }
From source file:org.lwjgl.demo.opengl.raytracing.HybridDemo.java
License:Open Source License
private void init() throws IOException { glfwSetErrorCallback(errCallback = new GLFWErrorCallback() { private GLFWErrorCallback delegate = GLFWErrorCallback.createPrint(System.err); @Override/*from w ww .j av a 2 s. com*/ public void invoke(int error, long description) { if (error == GLFW_VERSION_UNAVAILABLE) System.err.println("This demo requires OpenGL 4.3 or higher."); delegate.invoke(error, description); } @Override public void free() { delegate.free(); } }); if (!glfwInit()) throw new IllegalStateException("Unable to initialize GLFW"); glfwDefaultWindowHints(); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); window = glfwCreateWindow(width, height, "Raytracing Demo (compute shader + raster)", NULL, NULL); if (window == NULL) { throw new AssertionError("Failed to create the GLFW window"); } System.out.println("Press keypad '+' or 'page up' to increase the number of bounces."); System.out.println("Press keypad '-' or 'page down' to decrease the number of bounces."); glfwSetKeyCallback(window, keyCallback = new GLFWKeyCallback() { @Override public void invoke(long window, int key, int scancode, int action, int mods) { if (action != GLFW_RELEASE) return; if (key == GLFW_KEY_ESCAPE) { glfwSetWindowShouldClose(window, true); } else if (key == GLFW_KEY_KP_ADD || key == GLFW_KEY_PAGE_UP) { int newBounceCount = Math.min(4, HybridDemo.this.bounceCount + 1); if (newBounceCount != HybridDemo.this.bounceCount) { HybridDemo.this.bounceCount = newBounceCount; System.out.println("Ray bounce count is now: " + HybridDemo.this.bounceCount); HybridDemo.this.frameNumber = 0; } } else if (key == GLFW_KEY_KP_SUBTRACT || key == GLFW_KEY_PAGE_DOWN) { int newBounceCount = Math.max(1, HybridDemo.this.bounceCount - 1); if (newBounceCount != HybridDemo.this.bounceCount) { HybridDemo.this.bounceCount = newBounceCount; System.out.println("Ray bounce count is now: " + HybridDemo.this.bounceCount); HybridDemo.this.frameNumber = 0; } } } }); glfwSetFramebufferSizeCallback(window, fbCallback = new GLFWFramebufferSizeCallback() { @Override public void invoke(long window, int width, int height) { if (width > 0 && height > 0 && (HybridDemo.this.width != width || HybridDemo.this.height != height)) { HybridDemo.this.width = width; HybridDemo.this.height = height; HybridDemo.this.resetFramebuffer = true; HybridDemo.this.frameNumber = 0; } } }); glfwSetCursorPosCallback(window, cpCallback = new GLFWCursorPosCallback() { @Override public void invoke(long window, double x, double y) { HybridDemo.this.mouseX = (float) x; if (mouseDown) { HybridDemo.this.frameNumber = 0; } } }); glfwSetMouseButtonCallback(window, mbCallback = new GLFWMouseButtonCallback() { @Override public void invoke(long window, int button, int action, int mods) { if (action == GLFW_PRESS) { HybridDemo.this.mouseDownX = HybridDemo.this.mouseX; HybridDemo.this.mouseDown = true; } else if (action == GLFW_RELEASE) { HybridDemo.this.mouseDown = false; HybridDemo.this.rotationAboutY = HybridDemo.this.currRotationAboutY; } } }); GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); glfwSetWindowPos(window, (vidmode.width() - width) / 2, (vidmode.height() - height) / 2); glfwMakeContextCurrent(window); glfwSwapInterval(0); glfwShowWindow(window); IntBuffer framebufferSize = BufferUtils.createIntBuffer(2); nglfwGetFramebufferSize(window, memAddress(framebufferSize), memAddress(framebufferSize) + 4); width = framebufferSize.get(0); height = framebufferSize.get(1); GL.createCapabilities(); debugProc = GLUtil.setupDebugMessageCallback(); /* Create all needed GL resources */ createRaytracingTexture(); createSampler(); createRasterizerTextures(); createRasterFrameBufferObject(); createFullScreenVao(); createSceneVao(); createRasterProgram(); initRasterProgram(); createComputeProgram(); initComputeProgram(); createQuadProgram(); initQuadProgram(); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); firstTime = System.nanoTime(); }
From source file:org.lwjgl.demo.opengl.raytracing.HybridDemoSsbo.java
License:Open Source License
private void init() throws IOException { glfwSetErrorCallback(errCallback = new GLFWErrorCallback() { private GLFWErrorCallback delegate = GLFWErrorCallback.createPrint(System.err); @Override// w ww . ja va 2 s .c o m public void invoke(int error, long description) { if (error == GLFW_VERSION_UNAVAILABLE) System.err.println("This demo requires OpenGL 4.3 or higher."); delegate.invoke(error, description); } @Override public void free() { delegate.free(); } }); if (!glfwInit()) throw new IllegalStateException("Unable to initialize GLFW"); glfwDefaultWindowHints(); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); window = glfwCreateWindow(width, height, "Raytracing Demo (compute shader (with SSBO) + raster)", NULL, NULL); if (window == NULL) { throw new AssertionError("Failed to create the GLFW window"); } System.out.println("Press keypad '+' or 'page up' to increase the number of bounces."); System.out.println("Press keypad '-' or 'page down' to decrease the number of bounces."); glfwSetKeyCallback(window, keyCallback = new GLFWKeyCallback() { @Override public void invoke(long window, int key, int scancode, int action, int mods) { if (action != GLFW_RELEASE) return; if (key == GLFW_KEY_ESCAPE) { glfwSetWindowShouldClose(window, true); } else if (key == GLFW_KEY_KP_ADD || key == GLFW_KEY_PAGE_UP) { int newBounceCount = Math.min(4, HybridDemoSsbo.this.bounceCount + 1); if (newBounceCount != HybridDemoSsbo.this.bounceCount) { HybridDemoSsbo.this.bounceCount = newBounceCount; System.out.println("Ray bounce count is now: " + HybridDemoSsbo.this.bounceCount); HybridDemoSsbo.this.frameNumber = 0; } } else if (key == GLFW_KEY_KP_SUBTRACT || key == GLFW_KEY_PAGE_DOWN) { int newBounceCount = Math.max(1, HybridDemoSsbo.this.bounceCount - 1); if (newBounceCount != HybridDemoSsbo.this.bounceCount) { HybridDemoSsbo.this.bounceCount = newBounceCount; System.out.println("Ray bounce count is now: " + HybridDemoSsbo.this.bounceCount); HybridDemoSsbo.this.frameNumber = 0; } } } }); glfwSetFramebufferSizeCallback(window, fbCallback = new GLFWFramebufferSizeCallback() { @Override public void invoke(long window, int width, int height) { if (width > 0 && height > 0 && (HybridDemoSsbo.this.width != width || HybridDemoSsbo.this.height != height)) { HybridDemoSsbo.this.width = width; HybridDemoSsbo.this.height = height; HybridDemoSsbo.this.resetFramebuffer = true; HybridDemoSsbo.this.frameNumber = 0; } } }); glfwSetCursorPosCallback(window, cpCallback = new GLFWCursorPosCallback() { @Override public void invoke(long window, double x, double y) { HybridDemoSsbo.this.mouseX = (float) x; if (mouseDown) { HybridDemoSsbo.this.frameNumber = 0; } } }); glfwSetMouseButtonCallback(window, mbCallback = new GLFWMouseButtonCallback() { @Override public void invoke(long window, int button, int action, int mods) { if (action == GLFW_PRESS) { HybridDemoSsbo.this.mouseDownX = HybridDemoSsbo.this.mouseX; HybridDemoSsbo.this.mouseDown = true; } else if (action == GLFW_RELEASE) { HybridDemoSsbo.this.mouseDown = false; HybridDemoSsbo.this.rotationAboutY = HybridDemoSsbo.this.currRotationAboutY; } } }); GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); glfwSetWindowPos(window, (vidmode.width() - width) / 2, (vidmode.height() - height) / 2); glfwMakeContextCurrent(window); glfwSwapInterval(0); glfwShowWindow(window); IntBuffer framebufferSize = BufferUtils.createIntBuffer(2); nglfwGetFramebufferSize(window, memAddress(framebufferSize), memAddress(framebufferSize) + 4); width = framebufferSize.get(0); height = framebufferSize.get(1); GL.createCapabilities(); debugProc = GLUtil.setupDebugMessageCallback(); /* Create all needed GL resources */ createRaytracingTexture(); createSampler(); createRasterizerTextures(); createRasterFrameBufferObject(); createSceneSSBO(); createFullScreenVao(); createSceneVao(); createRasterProgram(); initRasterProgram(); createComputeProgram(); initComputeProgram(); createQuadProgram(); initQuadProgram(); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); firstTime = System.nanoTime(); }
From source file:org.lwjgl.demo.opengl.raytracing.HybridDemoSsboInstancing.java
License:Open Source License
private void init() throws IOException { glfwSetErrorCallback(errCallback = new GLFWErrorCallback() { private GLFWErrorCallback delegate = GLFWErrorCallback.createPrint(System.err); @Override// w w w . jav a 2 s . c om public void invoke(int error, long description) { if (error == GLFW_VERSION_UNAVAILABLE) System.err.println("This demo requires OpenGL 4.3 or higher."); delegate.invoke(error, description); } @Override public void free() { delegate.free(); } }); if (!glfwInit()) throw new IllegalStateException("Unable to initialize GLFW"); glfwDefaultWindowHints(); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); window = glfwCreateWindow(width, height, "Raytracing Demo - compute shader (with SSBO) + raster (with instancing)", NULL, NULL); if (window == NULL) { throw new AssertionError("Failed to create the GLFW window"); } System.out.println("Press keypad '+' or 'page up' to increase the number of bounces."); System.out.println("Press keypad '-' or 'page down' to decrease the number of bounces."); glfwSetKeyCallback(window, keyCallback = new GLFWKeyCallback() { @Override public void invoke(long window, int key, int scancode, int action, int mods) { if (action != GLFW_RELEASE) return; if (key == GLFW_KEY_ESCAPE) { glfwSetWindowShouldClose(window, true); } else if (key == GLFW_KEY_KP_ADD || key == GLFW_KEY_PAGE_UP) { int newBounceCount = Math.min(4, HybridDemoSsboInstancing.this.bounceCount + 1); if (newBounceCount != HybridDemoSsboInstancing.this.bounceCount) { HybridDemoSsboInstancing.this.bounceCount = newBounceCount; System.out.println("Ray bounce count is now: " + HybridDemoSsboInstancing.this.bounceCount); HybridDemoSsboInstancing.this.frameNumber = 0; } } else if (key == GLFW_KEY_KP_SUBTRACT || key == GLFW_KEY_PAGE_DOWN) { int newBounceCount = Math.max(1, HybridDemoSsboInstancing.this.bounceCount - 1); if (newBounceCount != HybridDemoSsboInstancing.this.bounceCount) { HybridDemoSsboInstancing.this.bounceCount = newBounceCount; System.out.println("Ray bounce count is now: " + HybridDemoSsboInstancing.this.bounceCount); HybridDemoSsboInstancing.this.frameNumber = 0; } } } }); glfwSetFramebufferSizeCallback(window, fbCallback = new GLFWFramebufferSizeCallback() { @Override public void invoke(long window, int width, int height) { if (width > 0 && height > 0 && (HybridDemoSsboInstancing.this.width != width || HybridDemoSsboInstancing.this.height != height)) { HybridDemoSsboInstancing.this.width = width; HybridDemoSsboInstancing.this.height = height; HybridDemoSsboInstancing.this.resetFramebuffer = true; HybridDemoSsboInstancing.this.frameNumber = 0; } } }); glfwSetCursorPosCallback(window, cpCallback = new GLFWCursorPosCallback() { @Override public void invoke(long window, double x, double y) { HybridDemoSsboInstancing.this.mouseX = (float) x; if (mouseDown) { HybridDemoSsboInstancing.this.frameNumber = 0; } } }); glfwSetMouseButtonCallback(window, mbCallback = new GLFWMouseButtonCallback() { @Override public void invoke(long window, int button, int action, int mods) { if (action == GLFW_PRESS) { HybridDemoSsboInstancing.this.mouseDownX = HybridDemoSsboInstancing.this.mouseX; HybridDemoSsboInstancing.this.mouseDown = true; } else if (action == GLFW_RELEASE) { HybridDemoSsboInstancing.this.mouseDown = false; HybridDemoSsboInstancing.this.rotationAboutY = HybridDemoSsboInstancing.this.currRotationAboutY; } } }); GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); glfwSetWindowPos(window, (vidmode.width() - width) / 2, (vidmode.height() - height) / 2); glfwMakeContextCurrent(window); glfwSwapInterval(0); glfwShowWindow(window); IntBuffer framebufferSize = BufferUtils.createIntBuffer(2); nglfwGetFramebufferSize(window, memAddress(framebufferSize), memAddress(framebufferSize) + 4); width = framebufferSize.get(0); height = framebufferSize.get(1); GL.createCapabilities(); debugProc = GLUtil.setupDebugMessageCallback(); /* Create all needed GL resources */ createRaytracingTexture(); createSampler(); createRasterizerTextures(); createRasterFrameBufferObject(); createSceneSSBO(); createFullScreenVao(); createSceneVao(); createRasterProgram(); initRasterProgram(); createComputeProgram(); initComputeProgram(); createQuadProgram(); initQuadProgram(); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); firstTime = System.nanoTime(); }
From source file:org.lwjgl.demo.opengl.raytracing.HybridDemoSsboInstancing45.java
License:Open Source License
private void init() throws IOException { glfwSetErrorCallback(errCallback = new GLFWErrorCallback() { private GLFWErrorCallback delegate = GLFWErrorCallback.createPrint(System.err); @Override/*from ww w .ja v a 2 s . c om*/ public void invoke(int error, long description) { if (error == GLFW_VERSION_UNAVAILABLE) System.err.println("This demo requires OpenGL 4.5 or higher."); delegate.invoke(error, description); } @Override public void free() { delegate.free(); } }); if (!glfwInit()) throw new IllegalStateException("Unable to initialize GLFW"); glfwDefaultWindowHints(); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); window = glfwCreateWindow(width, height, "Raytracing Demo - compute shader (with SSBO) + raster (with instancing)", NULL, NULL); if (window == NULL) { throw new AssertionError("Failed to create the GLFW window"); } System.out.println("Press keypad '+' or 'page up' to increase the number of bounces."); System.out.println("Press keypad '-' or 'page down' to decrease the number of bounces."); glfwSetKeyCallback(window, keyCallback = new GLFWKeyCallback() { @Override public void invoke(long window, int key, int scancode, int action, int mods) { if (action != GLFW_RELEASE) return; if (key == GLFW_KEY_ESCAPE) { glfwSetWindowShouldClose(window, true); } else if (key == GLFW_KEY_KP_ADD || key == GLFW_KEY_PAGE_UP) { int newBounceCount = Math.min(4, HybridDemoSsboInstancing45.this.bounceCount + 1); if (newBounceCount != HybridDemoSsboInstancing45.this.bounceCount) { HybridDemoSsboInstancing45.this.bounceCount = newBounceCount; System.out .println("Ray bounce count is now: " + HybridDemoSsboInstancing45.this.bounceCount); HybridDemoSsboInstancing45.this.frameNumber = 0; } } else if (key == GLFW_KEY_KP_SUBTRACT || key == GLFW_KEY_PAGE_DOWN) { int newBounceCount = Math.max(1, HybridDemoSsboInstancing45.this.bounceCount - 1); if (newBounceCount != HybridDemoSsboInstancing45.this.bounceCount) { HybridDemoSsboInstancing45.this.bounceCount = newBounceCount; System.out .println("Ray bounce count is now: " + HybridDemoSsboInstancing45.this.bounceCount); HybridDemoSsboInstancing45.this.frameNumber = 0; } } } }); glfwSetFramebufferSizeCallback(window, fbCallback = new GLFWFramebufferSizeCallback() { @Override public void invoke(long window, int width, int height) { if (width > 0 && height > 0 && (HybridDemoSsboInstancing45.this.width != width || HybridDemoSsboInstancing45.this.height != height)) { HybridDemoSsboInstancing45.this.width = width; HybridDemoSsboInstancing45.this.height = height; HybridDemoSsboInstancing45.this.resetFramebuffer = true; HybridDemoSsboInstancing45.this.frameNumber = 0; } } }); glfwSetCursorPosCallback(window, cpCallback = new GLFWCursorPosCallback() { @Override public void invoke(long window, double x, double y) { HybridDemoSsboInstancing45.this.mouseX = (float) x; if (mouseDown) { HybridDemoSsboInstancing45.this.frameNumber = 0; } } }); glfwSetMouseButtonCallback(window, mbCallback = new GLFWMouseButtonCallback() { @Override public void invoke(long window, int button, int action, int mods) { if (action == GLFW_PRESS) { HybridDemoSsboInstancing45.this.mouseDownX = HybridDemoSsboInstancing45.this.mouseX; HybridDemoSsboInstancing45.this.mouseDown = true; } else if (action == GLFW_RELEASE) { HybridDemoSsboInstancing45.this.mouseDown = false; HybridDemoSsboInstancing45.this.rotationAboutY = HybridDemoSsboInstancing45.this.currRotationAboutY; } } }); GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); glfwSetWindowPos(window, (vidmode.width() - width) / 2, (vidmode.height() - height) / 2); glfwMakeContextCurrent(window); glfwSwapInterval(0); glfwShowWindow(window); IntBuffer framebufferSize = BufferUtils.createIntBuffer(2); nglfwGetFramebufferSize(window, memAddress(framebufferSize), memAddress(framebufferSize) + 4); width = framebufferSize.get(0); height = framebufferSize.get(1); GL.createCapabilities(); debugProc = GLUtil.setupDebugMessageCallback(); /* Create all needed GL resources */ createRaytracingTexture(); createSampler(); createRasterizerTextures(); createRasterFrameBufferObject(); createSceneSSBO(); createFullScreenVao(); createSceneVao(); createRasterProgram(); initRasterProgram(); createComputeProgram(); initComputeProgram(); createQuadProgram(); initQuadProgram(); createUbo(); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); firstTime = System.nanoTime(); }
From source file:org.lwjgl.demo.opengl.raytracing.HybridDemoSsboTriangles.java
License:Open Source License
private void init() throws IOException { glfwSetErrorCallback(errCallback = new GLFWErrorCallback() { private GLFWErrorCallback delegate = GLFWErrorCallback.createPrint(System.err); @Override//from w w w . j a v a 2 s. c om public void invoke(int error, long description) { if (error == GLFW_VERSION_UNAVAILABLE) System.err.println("This demo requires OpenGL 4.3 or higher."); delegate.invoke(error, description); } @Override public void free() { delegate.free(); } }); if (!glfwInit()) throw new IllegalStateException("Unable to initialize GLFW"); glfwDefaultWindowHints(); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); window = glfwCreateWindow(width, height, "Raytracing Demo (triangle mesh)", NULL, NULL); if (window == NULL) { throw new AssertionError("Failed to create the GLFW window"); } System.out.println("Hold down any mouse button and drag to rotate."); System.out.println("Press arrow down/up to decrease/increase the light's radius."); glfwSetKeyCallback(window, keyCallback = new GLFWKeyCallback() { @Override public void invoke(long window, int key, int scancode, int action, int mods) { if (action == GLFW_PRESS) return; if (key == GLFW_KEY_ESCAPE) { glfwSetWindowShouldClose(window, true); } else if (key == GLFW_KEY_DOWN) { int newRadius = lightRadius - 1; if (newRadius >= 0) { lightRadius = newRadius; frameNumber = 0; System.out.println("Light radius: " + lightRadius * 0.1f); } } else if (key == GLFW_KEY_UP) { int newRadius = lightRadius + 1; if (newRadius <= 30) { lightRadius = newRadius; frameNumber = 0; System.out.println("Light radius: " + lightRadius * 0.1f); } } } }); glfwSetFramebufferSizeCallback(window, fbCallback = new GLFWFramebufferSizeCallback() { @Override public void invoke(long window, int width, int height) { if (width > 0 && height > 0 && (HybridDemoSsboTriangles.this.width != width || HybridDemoSsboTriangles.this.height != height)) { HybridDemoSsboTriangles.this.width = width; HybridDemoSsboTriangles.this.height = height; HybridDemoSsboTriangles.this.resetFramebuffer = true; HybridDemoSsboTriangles.this.frameNumber = 0; } } }); glfwSetCursorPosCallback(window, cpCallback = new GLFWCursorPosCallback() { @Override public void invoke(long window, double x, double y) { HybridDemoSsboTriangles.this.mouseX = (float) x; if (mouseDown) { HybridDemoSsboTriangles.this.frameNumber = 0; } } }); glfwSetMouseButtonCallback(window, mbCallback = new GLFWMouseButtonCallback() { @Override public void invoke(long window, int button, int action, int mods) { if (action == GLFW_PRESS) { HybridDemoSsboTriangles.this.mouseDownX = HybridDemoSsboTriangles.this.mouseX; HybridDemoSsboTriangles.this.mouseDown = true; } else if (action == GLFW_RELEASE) { HybridDemoSsboTriangles.this.mouseDown = false; HybridDemoSsboTriangles.this.rotationAboutY = HybridDemoSsboTriangles.this.currRotationAboutY; } } }); GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); glfwSetWindowPos(window, (vidmode.width() - width) / 2, (vidmode.height() - height) / 2); glfwMakeContextCurrent(window); glfwSwapInterval(0); glfwShowWindow(window); IntBuffer framebufferSize = BufferUtils.createIntBuffer(2); nglfwGetFramebufferSize(window, memAddress(framebufferSize), memAddress(framebufferSize) + 4); width = framebufferSize.get(0); height = framebufferSize.get(1); caps = GL.createCapabilities(); debugProc = GLUtil.setupDebugMessageCallback(); /* Load OBJ model */ WavefrontMeshLoader loader = new WavefrontMeshLoader(); mesh = loader.loadMesh("org/lwjgl/demo/opengl/models/lwjgl3.obj.zip"); /* Create all needed GL resources */ createRaytracingTexture(); createSampler(); createRasterizerTextures(); createRasterFrameBufferObject(); createSceneSSBO(); createSceneVao(); createRasterProgram(); initRasterProgram(); createComputeProgram(); initComputeProgram(); if (!caps.GL_NV_draw_texture) { createFullScreenVao(); createQuadProgram(); initQuadProgram(); } glEnable(GL_CULL_FACE); firstTime = System.nanoTime(); }
From source file:org.lwjgl.demo.opengl.raytracing.PhotonMappingBindlessDemo.java
License:Open Source License
private void init() throws IOException { glfwSetErrorCallback(errCallback = new GLFWErrorCallback() { private GLFWErrorCallback delegate = GLFWErrorCallback.createPrint(System.err); @Override/*from www . j av a 2 s.co m*/ public void invoke(int error, long description) { if (error == GLFW_VERSION_UNAVAILABLE) System.err.println("This demo requires OpenGL 4.3 or higher."); delegate.invoke(error, description); } @Override public void free() { delegate.free(); } }); if (!glfwInit()) throw new IllegalStateException("Unable to initialize GLFW"); glfwDefaultWindowHints(); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE); window = glfwCreateWindow(width, height, "Photon Mapping Demo - bindless", NULL, NULL); if (window == NULL) { throw new AssertionError("Failed to create the GLFW window"); } System.out.println("Press 'r' to clear the photon map."); System.out.println("Press arrow 'up' to increase photon map resolution."); System.out.println("Press arrow 'down' to decrease the photon map resolution."); System.out.println("Press arrow 'right' to increase number of photons per frame."); System.out.println("Press arrow 'left' to decrease number of photons per frame."); glfwSetKeyCallback(window, keyCallback = new GLFWKeyCallback() { @Override public void invoke(long window, int key, int scancode, int action, int mods) { if (action != GLFW_RELEASE) return; if (key == GLFW_KEY_ESCAPE) { glfwSetWindowShouldClose(window, true); } else if (key == GLFW_KEY_R) { PhotonMappingBindlessDemo.this.clearPhotonMapTexture = true; } else if (key == GLFW_KEY_UP) { PhotonMappingBindlessDemo.this.texelsPerUnit *= 2; PhotonMappingBindlessDemo.this.texelsPerUnit = Math .min(PhotonMappingBindlessDemo.this.texelsPerUnit, MAX_TEXELS_PER_UNIT); PhotonMappingBindlessDemo.this.recreatePhotonMapTextures = true; System.out.println("Photon map resolution (texels per unit): " + PhotonMappingBindlessDemo.this.texelsPerUnit); } else if (key == GLFW_KEY_DOWN) { PhotonMappingBindlessDemo.this.texelsPerUnit /= 2; PhotonMappingBindlessDemo.this.texelsPerUnit = Math .max(PhotonMappingBindlessDemo.this.texelsPerUnit, 4); PhotonMappingBindlessDemo.this.recreatePhotonMapTextures = true; System.out.println("Photon map resolution (texels per unit): " + PhotonMappingBindlessDemo.this.texelsPerUnit); } else if (key == GLFW_KEY_RIGHT) { PhotonMappingBindlessDemo.this.photonsPerFrame *= 2; PhotonMappingBindlessDemo.this.photonsPerFrame = Math .min(PhotonMappingBindlessDemo.this.photonsPerFrame, MAX_PHOTONS_PER_FRAME); System.out.println("Photons per frame: " + PhotonMappingBindlessDemo.this.photonsPerFrame); } else if (key == GLFW_KEY_LEFT) { PhotonMappingBindlessDemo.this.photonsPerFrame /= 2; PhotonMappingBindlessDemo.this.photonsPerFrame = Math.max( PhotonMappingBindlessDemo.this.photonsPerFrame, Math.max(workGroupSizeX, workGroupSizeY)); System.out.println("Photons per frame: " + PhotonMappingBindlessDemo.this.photonsPerFrame); } } }); glfwSetFramebufferSizeCallback(window, fbCallback = new GLFWFramebufferSizeCallback() { @Override public void invoke(long window, int width, int height) { if (width > 0 && height > 0 && (PhotonMappingBindlessDemo.this.width != width || PhotonMappingBindlessDemo.this.height != height)) { PhotonMappingBindlessDemo.this.width = width; PhotonMappingBindlessDemo.this.height = height; PhotonMappingBindlessDemo.this.resetFramebuffer = true; } } }); glfwSetCursorPosCallback(window, cpCallback = new GLFWCursorPosCallback() { @Override public void invoke(long window, double x, double y) { PhotonMappingBindlessDemo.this.mouseX = (float) x; } }); glfwSetMouseButtonCallback(window, mbCallback = new GLFWMouseButtonCallback() { @Override public void invoke(long window, int button, int action, int mods) { if (action == GLFW_PRESS) { PhotonMappingBindlessDemo.this.mouseDownX = PhotonMappingBindlessDemo.this.mouseX; PhotonMappingBindlessDemo.this.mouseDown = true; } else if (action == GLFW_RELEASE) { PhotonMappingBindlessDemo.this.mouseDown = false; PhotonMappingBindlessDemo.this.rotationAboutY = PhotonMappingBindlessDemo.this.currRotationAboutY; } } }); GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); glfwSetWindowPos(window, (vidmode.width() - width) / 2, (vidmode.height() - height) / 2); glfwMakeContextCurrent(window); glfwSwapInterval(0); glfwShowWindow(window); IntBuffer framebufferSize = BufferUtils.createIntBuffer(2); nglfwGetFramebufferSize(window, memAddress(framebufferSize), memAddress(framebufferSize) + 4); width = framebufferSize.get(0); height = framebufferSize.get(1); caps = GL.createCapabilities(); if (!caps.GL_ARB_bindless_texture) throw new RuntimeException("This demo requires the ARB_bindless_texture extension."); /* Create all needed GL resources */ createSampler(); createImageHandlesUbo(); createSamplerHandlesUbo(); createPhotonMapTextures(); createPhotonTraceProgram(); initPhotonTraceProgram(); createRasterProgram(); initRasterProgram(); createSceneSSBO(); createSceneVao(); /* Set some state */ glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); firstTime = System.nanoTime(); }