org.lwjglb.engine.Window.isResized()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(11.5k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中org.lwjglb.engine.Window.isResized()方法的一些代码示例,展示了Window.isResized()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.isResized()方法的具体详情如下:
包路径:org.lwjglb.engine.Window
类名称:Window
方法名:isResized

Window.isResized介绍

暂无

代码示例

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
  public void render(Window window) {
    if ( window.isResized() ) {
      glViewport(0, 0, window.getWidth(), window.getHeight());
      window.setResized(false);
    }

    window.setClearColor(color, color, color, 0.0f);
    renderer.clear();
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Camera camera, GameItem[] gameItems,
    SceneLight sceneLight, IHud hud) {
  clear();
  if ( window.isResized() ) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  renderScene(window, camera, gameItems, sceneLight);
  renderHud(window, hud);
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Camera camera, GameItem[] gameItems,
    SceneLight sceneLight, IHud hud) {
  clear();
  if ( window.isResized() ) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  renderScene(window, camera, gameItems, sceneLight);
  renderHud(window, hud);
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Camera camera, GameItem[] gameItems,
    SceneLight sceneLight, IHud hud) {
  clear();
  if ( window.isResized() ) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  renderScene(window, camera, gameItems, sceneLight);
  renderHud(window, hud);
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Camera camera, Scene scene, IHud hud) {
  clear();
  if ( window.isResized() ) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  renderScene(window, camera, scene);
  
  renderSkyBox(window, camera, scene);
  renderHud(window, hud);
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Camera camera, Scene scene, IHud hud) {
  clear();
  if (window.isResized()) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  // Update projection and view atrices once per render cycle
  transformation.updateProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
  transformation.updateViewMatrix(camera);
  renderScene(window, camera, scene);
  renderSkyBox(window, camera, scene);
  renderHud(window, hud);
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Camera camera, Scene scene, IHud hud) {
  clear();
  if (window.isResized()) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  // Update projection and view atrices once per render cycle
  transformation.updateProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
  transformation.updateViewMatrix(camera);
  renderScene(window, camera, scene);
  renderSkyBox(window, camera, scene);
  renderHud(window, hud);
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Camera camera, Scene scene, IHud hud) {
  clear();
  if (window.isResized()) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  // Update projection and view atrices once per render cycle
  transformation.updateProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
  transformation.updateViewMatrix(camera);
  renderScene(window, camera, scene);
  renderSkyBox(window, camera, scene);
  renderHud(window, hud);
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Camera camera, Scene scene, IHud hud) {
  clear();
  if (window.isResized()) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  // Update projection and view atrices once per render cycle
  transformation.updateProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
  transformation.updateViewMatrix(camera);
  renderScene(window, camera, scene);
  renderSkyBox(window, camera, scene);
  renderHud(window, hud);
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Camera camera, Scene scene, IHud hud) {
  clear();
  if (window.isResized()) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  // Update projection and view atrices once per render cycle
  transformation.updateProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
  transformation.updateViewMatrix(camera);
  renderScene(window, camera, scene);
  renderSkyBox(window, camera, scene);
  renderHud(window, hud);
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window) {
  clear();
  if (window.isResized()) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  shaderProgram.bind();
  // Bind to the VAO
  glBindVertexArray(vaoId);
  glEnableVertexAttribArray(0);
  // Draw the vertices
  glDrawArrays(GL_TRIANGLES, 0, 3);
  // Restore state
  glDisableVertexAttribArray(0);
  glBindVertexArray(0);
  shaderProgram.unbind();
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Mesh mesh) {
  clear();
  if (window.isResized()) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  shaderProgram.bind();
  // Draw the mesh
  glBindVertexArray(mesh.getVaoId());
  glEnableVertexAttribArray(0);
  glDrawElements(GL_TRIANGLES, mesh.getVertexCount(), GL_UNSIGNED_INT, 0);
  // Restore state
  glDisableVertexAttribArray(0);
  glBindVertexArray(0);
  shaderProgram.unbind();
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Mesh mesh) {
  clear();
  if ( window.isResized() ) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  shaderProgram.bind();
  // Draw the mesh
  glBindVertexArray(mesh.getVaoId());
  glEnableVertexAttribArray(0);
  glEnableVertexAttribArray(1);
  glDrawElements(GL_TRIANGLES, mesh.getVertexCount(), GL_UNSIGNED_INT, 0);
  // Restore state
  glDisableVertexAttribArray(0);
  glDisableVertexAttribArray(1);
  glBindVertexArray(0);
  shaderProgram.unbind();
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Mesh mesh) {
  clear();
  if ( window.isResized() ) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  shaderProgram.bind();
  shaderProgram.setUniform("projectionMatrix", projectionMatrix);
  // Draw the mesh
  glBindVertexArray(mesh.getVaoId());
  glEnableVertexAttribArray(0);
  glEnableVertexAttribArray(1);
  glDrawElements(GL_TRIANGLES, mesh.getVertexCount(), GL_UNSIGNED_INT, 0);
  // Restore state
  glDisableVertexAttribArray(0);
  glDisableVertexAttribArray(1);
  glBindVertexArray(0);
  shaderProgram.unbind();
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Camera camera, GameItem[] gameItems) {
  clear();
  
  if ( window.isResized() ) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  shaderProgram.bind();
  
  // Update projection Matrix
  Matrix4f projectionMatrix = transformation.getProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
  shaderProgram.setUniform("projectionMatrix", projectionMatrix);
  // Update view Matrix
  Matrix4f viewMatrix = transformation.getViewMatrix(camera);
  
  shaderProgram.setUniform("texture_sampler", 0);
  // Render each gameItem
  for(GameItem gameItem : gameItems) {
    // Set model view matrix for this item
    Matrix4f modelViewMatrix = transformation.getModelViewMatrix(gameItem, viewMatrix);
    shaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
    // Render the mes for this game item
    gameItem.getMesh().render();
  }
  shaderProgram.unbind();
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, GameItem[] gameItems) {
  clear();
  if ( window.isResized() ) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  shaderProgram.bind();
  
  // Update projection Matrix
  Matrix4f projectionMatrix = transformation.getProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
  shaderProgram.setUniform("projectionMatrix", projectionMatrix);
  
  // Render each gameItem
  for(GameItem gameItem : gameItems) {
    // Set world matrix for this item
    Matrix4f worldMatrix = transformation.getWorldMatrix(
        gameItem.getPosition(),
        gameItem.getRotation(),
        gameItem.getScale());
    shaderProgram.setUniform("worldMatrix", worldMatrix);
    // Render the mes for this game item
    gameItem.getMesh().render();
  }
  shaderProgram.unbind();
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, GameItem[] gameItems) {
  clear();
  if ( window.isResized() ) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  shaderProgram.bind();
  
  // Update projection Matrix
  Matrix4f projectionMatrix = transformation.getProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
  shaderProgram.setUniform("projectionMatrix", projectionMatrix);
  
  // Render each gameItem
  for(GameItem gameItem : gameItems) {
    // Set world matrix for this item
    Matrix4f worldMatrix = transformation.getWorldMatrix(
        gameItem.getPosition(),
        gameItem.getRotation(),
        gameItem.getScale());
    shaderProgram.setUniform("worldMatrix", worldMatrix);
    // Render the mes for this game item
    gameItem.getMesh().render();
  }
  shaderProgram.unbind();
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, GameItem[] gameItems) {
  clear();
  if ( window.isResized() ) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  shaderProgram.bind();
  
  // Update projection Matrix
  Matrix4f projectionMatrix = transformation.getProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
  shaderProgram.setUniform("projectionMatrix", projectionMatrix);
  
  shaderProgram.setUniform("texture_sampler", 0);
  // Render each gameItem
  for(GameItem gameItem : gameItems) {
    // Set world matrix for this item
    Matrix4f worldMatrix = transformation.getWorldMatrix(
        gameItem.getPosition(),
        gameItem.getRotation(),
        gameItem.getScale());
    shaderProgram.setUniform("worldMatrix", worldMatrix);
    // Render the mes for this game item
    gameItem.getMesh().render();
  }
  shaderProgram.unbind();
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Camera camera, GameItem[] gameItems, Vector3f ambientLight,
    PointLight[] pointLightList, SpotLight[] spotLightList, DirectionalLight directionalLight) {
  clear();
  if ( window.isResized() ) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  shaderProgram.bind();
  // Update projection Matrix
  Matrix4f projectionMatrix = transformation.getProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
  shaderProgram.setUniform("projectionMatrix", projectionMatrix);
  // Update view Matrix
  Matrix4f viewMatrix = transformation.getViewMatrix(camera);
  // Update Light Uniforms
  renderLights(viewMatrix, ambientLight, pointLightList, spotLightList, directionalLight);
  shaderProgram.setUniform("texture_sampler", 0);
  // Render each gameItem
  for (GameItem gameItem : gameItems) {
    Mesh mesh = gameItem.getMesh();
    // Set model view matrix for this item
    Matrix4f modelViewMatrix = transformation.getModelViewMatrix(gameItem, viewMatrix);
    shaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
    // Render the mesh for this game item
    shaderProgram.setUniform("material", mesh.getMaterial());
    mesh.render();
  }
  shaderProgram.unbind();
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void render(Window window, Camera camera, GameItem[] gameItems) {
  clear();
  if ( window.isResized() ) {
    glViewport(0, 0, window.getWidth(), window.getHeight());
    window.setResized(false);
  }
  shaderProgram.bind();
  
  // Update projection Matrix
  Matrix4f projectionMatrix = transformation.getProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
  shaderProgram.setUniform("projectionMatrix", projectionMatrix);
  // Update view Matrix
  Matrix4f viewMatrix = transformation.getViewMatrix(camera);
  
  shaderProgram.setUniform("texture_sampler", 0);
  // Render each gameItem
  for(GameItem gameItem : gameItems) {
    Mesh mesh = gameItem.getMesh();
    // Set model view matrix for this item
    Matrix4f modelViewMatrix = transformation.getModelViewMatrix(gameItem, viewMatrix);
    shaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
    // Render the mesh for this game item
    shaderProgram.setUniform("colour", mesh.getColour());
    shaderProgram.setUniform("useColour", mesh.isTextured() ? 0 : 1);
    mesh.render();
  }
  shaderProgram.unbind();
}

相关文章