Пример #1
0
 private void render() {
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   engine.Render();
   int error = glGetError();
   if (error != GL_NO_ERROR) System.out.println("Error: " + GLUtil.getErrorString(error));
   glfwSwapBuffers(window);
 }
Пример #2
0
  public void render() {
    renderer.prepare();
    renderer.render(model);
    // above must go before glfwSwapBuffers

    glfwSwapBuffers(window);

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  }
Пример #3
0
  private void loop() {
    GL.createCapabilities();
    System.out.println("OPENGL VERSION " + glGetString(GL_VERSION));
    glClearColor(0, 0, 0, 0);
    glEnable(GL_TEXTURE_2D);
    glDisable(GL_DEPTH_TEST);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, WORLD_X, WORLD_Y, 0, -1, 1);

    while (!glfwWindowShouldClose(winID)) {
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
      drawMe();
      glfwSwapBuffers(winID);
      glfwPollEvents();
    }
  }
Пример #4
0
  private void renderGL() {
    glClear(GL_COLOR_BUFFER_BIT);

    // draw slices

    if (!syncGLtoCL) {
      glWaitSync(glFenceFromCLEvent, 0, 0);
      glDeleteSync(glFenceFromCLEvent);
      glFenceFromCLEvent = NULL;

      int errcode = clReleaseEvent(clEvent);
      clEvent = NULL;
      checkCLError(errcode);
    }

    glBindTexture(GL_TEXTURE_2D, glTexture);
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
  }
Пример #5
0
  private void loop() {
    // This line is critical for LWJGL's interoperation with GLFW's
    // OpenGL context, or any context that is managed externally.
    // LWJGL detects the context that is current in the current thread,
    // creates the ContextCapabilities instance and makes the OpenGL
    // bindings available for use.
    GLContext.createFromCurrent();

    // Set the clear color
    glClearColor(1.0f, 0.0f, 0.0f, 0.0f);

    // Run the rendering loop until the user has attempted to close
    // the window or has pressed the ESCAPE key.
    while (glfwWindowShouldClose(window) == GL_FALSE) {
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear the framebuffer

      glfwSwapBuffers(window); // swap the color buffers

      // Poll for window events. The key callback above will only be
      // invoked during this call.
      glfwPollEvents();
    }
  }
Пример #6
0
 // Clears the window.
 public void clear() {
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 }
Пример #7
0
  private void render() {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear the framebuffer

    glfwSwapBuffers(window); // swap the color buffers
  }