use of jhelp.util.gui.JHelpImage in project narchy by automenta.
the class Texture method reduce.
/**
* Try to reduce texture in memory, <br>
* The texture will take less memory, be will be less defined also
*/
public void reduce() {
synchronized (Texture.LOCK) {
int w = this.width >> 1;
int h = this.height >> 1;
if (w == 0) {
if (h == 0) {
return;
}
w = 1;
}
if (h == 0) {
h = 1;
}
final JHelpImage image = this.toJHelpImage(w, h);
this.setImage(image);
}
}
use of jhelp.util.gui.JHelpImage in project narchy by automenta.
the class JHelpSceneRenderer method screenShot.
/**
* Make a screen shot.<br>
* This method can make time to exit, so it is good idea to call it in a thread.
*
* @return The screen shot
*/
public JHelpImage screenShot() {
// Wait for the render is ready
while (this.ready == false) {
try {
Thread.sleep(1);
} catch (final InterruptedException e) {
}
}
// Initialize the screen shot
this.screenShot = new JHelpImage(this.width, this.height);
this.makeAScreenShot = true;
// Wait for the screen shot is done
do {
try {
Thread.sleep(10);
} catch (final InterruptedException e) {
}
} while (this.makeAScreenShot == true);
// Return the screen shot
return this.screenShot;
}
use of jhelp.util.gui.JHelpImage in project narchy by automenta.
the class JHelpSceneRenderer method display.
/**
* Draw the OpenGL.<br>
* It is call by JOGL when OpenGL need to be refresh
*
* @param drawable
* Drawable context
* @see javax.media.opengl.GLEventListener#display(javax.media.opengl.GLAutoDrawable)
*/
@Override
public void display(final GLAutoDrawable drawable) {
System.out.println("display: " + drawable);
this.ready = false;
// Get OpenGL and GLU context
final GL2 gl = drawable.getGL().getGL2();
final GLU glu = new GLUgl2();
if (this.texturesToRemove.isEmpty() == false) {
this.texturesToRemove.outQueue().removeFromMemory(gl);
}
// If a new scene wait, change the scene
if (this.newScene != null) {
this.scene = this.newScene;
this.newScene = null;
}
// Update played animations
this.playAnimations(gl);
// Initialize for screen shot
if ((this.screenShot == null) || (this.screenShot.getWidth() != this.width) || (this.screenShot.getHeight() != this.height)) {
this.screenShot = null;
this.screenShot = new JHelpImage(this.width, this.height);
}
// Refresh window materials
for (final WindowMaterial windowMaterial : this.windowMaterials) {
windowMaterial.refreshIfNeed();
}
// Get actual camera
final Camera camera = this.scene.getCamera();
// Render picking mode
if (this.detectionActivate == true) {
if (this.pickUVnode != null) {
this.renderPickUV(gl, glu, camera);
} else {
this.renderPicking(gl, glu, camera);
}
}
// Render the lights
this.lights.render(gl);
// Render the scene
this.render(gl, glu, camera);
// Take the snapshot
this.makeSnapShot(gl, true);
// Print FPS
this.showFPS(gl, glu);
// Update FPS
this.updateFPS();
// Make ready for the next loop
gl.glEnable(GL2.GL_DEPTH_TEST);
drawable.swapBuffers();
this.ready = true;
synchronized (this.LOCK) {
this.LOCK.notify();
}
}
use of jhelp.util.gui.JHelpImage in project narchy by automenta.
the class JHelpFrame3D method runScreenShot.
/**
* The screen shot
*/
void runScreenShot() {
final JHelpImage screenShot = this.sceneRenderer.screenShot();
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.setLayout(new BorderLayout());
// frame.add(new LabelJHelpImage(screenShot), BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
Aggregations