List of usage examples for org.lwjgl.opengl GL11 GL_BYTE
int GL_BYTE
To view the source code for org.lwjgl.opengl GL11 GL_BYTE.
Click Source Link
From source file:org.terasology.logic.manager.PostProcessingRenderer.java
License:Apache License
private void updateExposure() { if (Config.getInstance().isEyeAdaption()) { ByteBuffer pixels = BufferUtils.createByteBuffer(4); FBO scene = PostProcessingRenderer.getInstance().getFBO("scene1"); scene.bind();/*from ww w . j a va2s . co m*/ glReadPixels(0, 0, 1, 1, GL12.GL_BGRA, GL11.GL_BYTE, pixels); scene.unbind(); _sceneLuminance = 0.2126f * pixels.get(2) / 255.f + 0.7152f * pixels.get(1) / 255.f + 0.0722f * pixels.get(0) / 255.f; float targetExposure = MAX_EXPOSURE; if (_sceneLuminance > 0) { targetExposure = TARGET_LUMINANCE / _sceneLuminance; } float maxExposure = MAX_EXPOSURE; if (CoreRegistry.get(WorldRenderer.class).getSkysphere().getDaylight() == 0.0) { maxExposure = MAX_EXPOSURE_NIGHT; } if (targetExposure > maxExposure) { targetExposure = maxExposure; } else if (targetExposure < MIN_EXPOSURE) { targetExposure = MIN_EXPOSURE; } _exposure = (float) TeraMath.lerp(_exposure, targetExposure, ADJUSTMENT_SPEED); } else { if (CoreRegistry.get(WorldRenderer.class).getSkysphere().getDaylight() == 0.0) { _exposure = MAX_EXPOSURE_NIGHT; } else { _exposure = DEFAULT_EXPOSURE; } } }
From source file:shadowmage.meim.client.gui.GuiModelEditor.java
License:Open Source License
protected void doSelection() { int posX = Mouse.getX(); int posY = Mouse.getY(); GL11.glDisable(GL11.GL_TEXTURE_2D);// w w w.j a v a 2 s. co m GL11.glClearColor(1.f, 1.f, 1.f, 1.f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GuiModelEditor.model.renderForSelection(); byte[] pixelColorsb = new byte[3]; ByteBuffer pixelColors = ByteBuffer.allocateDirect(3); GL11.glReadPixels(posX, posY, 1, 1, GL11.GL_RGB, GL11.GL_BYTE, pixelColors); for (int i = 0; i < 3; i++) { pixelColorsb[i] = pixelColors.get(i); } int r = pixelColorsb[0]; int g = pixelColorsb[1]; int b = pixelColorsb[2]; GL11.glEnable(GL11.GL_TEXTURE_2D); AWLog.logDebug("colors clicked on: " + r + "," + g + "," + b); int color = (r << 16) | (g << 8) | b; AWLog.logDebug("color out: " + color); GL11.glClearColor(.2f, .2f, .2f, 1.f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); Primitive p = model.getPrimitive(color); if (p == null) { this.setSelectedPiece(null); this.setSelectedPrimitive(null); } else { this.setSelectedPrimitive(p); } }