Membuat Java 3D “Animasi Manusia”


Setelah beberapa waktu lalu saya menuliskan cara mengintal nbm (program yang mendukung java 3D). nah, ternyata di netbeans saya gag bisa. jadi sekarang saya coba menawarkan solusi lain, yaitu menggunakan Java3D. Ini dijamin berhasil deh, karena sayapun berhasil . heheehhehehe…

Download Dibawah ini ya……

 

 

 

Ok, kalau udah di instal bolehdeh program ini di pelajari

package java3d;

import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GraphicsConfiguration;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.text.NumberFormat;

import javax.media.j3d.AmbientLight;
import javax.media.j3d.Appearance;
import javax.media.j3d.Background;
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Canvas3D;
import javax.media.j3d.DirectionalLight;
import javax.media.j3d.ImageComponent;
import javax.media.j3d.ImageComponent2D;
import javax.media.j3d.Material;
import javax.media.j3d.Screen3D;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.media.j3d.View;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.vecmath.AxisAngle4f;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;
import javax.vecmath.Point3f;
import javax.vecmath.Vector3f;

import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGEncodeParam;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.behaviors.mouse.MouseRotate;
import com.sun.j3d.utils.geometry.Cylinder;
import com.sun.j3d.utils.geometry.Sphere;
import com.sun.j3d.utils.universe.SimpleUniverse;

/**
*
* @author R92M
*/
public class TBGrafkom extends Applet implements ChangeListener, ActionListener{
SimpleUniverse ManAnGinaMahmud;
boolean isApplication;
Canvas3D canvas;
OffScreenCanvas3D offScreenCanvas;
View lihat;

// Deklarasi Nama Animasi
TransformGroup Badan;
TransformGroup BahuKanan;
TransformGroup SikuKanan;
TransformGroup BahuKiri;
TransformGroup SikuKiri;
TransformGroup PahaKanan;
TransformGroup BetisKanan;
TransformGroup PahaKiri;
TransformGroup BetisKiri;
TransformGroup Kepala;

// Atur Putar
int PutarBahuKanan = 0;
AxisAngle4f BahuKananAA = new AxisAngle4f(0.0f, 0.0f, -1.0f, 0.0f);
JSlider BahuKananSlider;
JLabel BahuKananSliderLabel;

int PutarSikuKanan = 0;
AxisAngle4f SikuKananAA = new AxisAngle4f(0.0f, 0.0f, -1.0f, 0.0f);
JSlider SikuKananSlider;
JLabel SikuKananSliderLabel;

int PutarBahuKiri = 0;
AxisAngle4f BahuKiriAA = new AxisAngle4f(0.0f, 0.0f, 1.0f, 0.0f);
JSlider BahuKiriSlider;
JLabel BahuKiriSliderLabel;

int PutarSikuKiri = 0;
AxisAngle4f SikuKiriAA = new AxisAngle4f(0.0f, 0.0f, 1.0f, 0.0f);
JSlider SikuKiriSlider;
JLabel SikuKiriSliderLabel;

int PutarPahaKanan = 0;
AxisAngle4f PahaKananAA = new AxisAngle4f(0.0f, 0.0f, -1.0f, 0.0f);
JSlider PahaKananSlider;
JLabel PahaKananSliderLabel;

int PutarBetisKanan = 0;
AxisAngle4f BetisKananAA = new AxisAngle4f(0.0f, 0.0f, 1.0f, 0.0f);
JSlider BetisKananSlider;
JLabel BetisKananSliderLabel;

int PutarPahaKiri = 0;
AxisAngle4f PahaKiriAA = new AxisAngle4f(0.0f, 0.0f, 1.0f, 0.0f);
JSlider PahaKiriSlider;
JLabel PahaKiriSliderLabel;

int PutarBetisKiri = 0;
AxisAngle4f BetisKiriAA = new AxisAngle4f(0.0f, 0.0f, -1.0f, 0.0f);
JSlider BetisKiriSlider;
JLabel BetisKiriSliderLabel;

String FileKepala;

int FileSeq = 0;
float SkalaLayar = 1.5f;

//Unsur GUI
JTabbedPane tabbedPane;

//Temporari
Transform3D Trans = new Transform3D();
Vector3f Vector = new Vector3f();
Cylinder Silinder;
Sphere lingkaran;
TransformGroup TG;

// Membuat Warna
Color3f Red = new Color3f(1.0f, 0.0f, 0.0f);
Color3f black = new Color3f(0.0f, 0.5f, 0.0f);
Color3f white = new Color3f(0.0f, 0.0f, 0.0f);

// Konstan
Point3f man = new Point3f();
Vector3f an = new Vector3f(0.0f, 1.0f, 0.0f);

// NumberFormat
NumberFormat nf;

// Inti Program
void GambarOrang() {
Badan = new TransformGroup();

// center
Vector.set(0.0f, -1.5f, 0.0f);
Trans.set(Vector);
Badan.setTransform(Trans);

// Mix Warna
Material material = new Material(Red, black, Red, white, 64);
Appearance appearance = new Appearance();
appearance.setMaterial(material);

// Mencetak Tempat
TG = new TransformGroup();

// Mencetak Bentuk
Vector.set(0.0f, 2.0f, 0.0f);
Trans.set(Vector);
TG.setTransform(Trans);
Silinder = new Cylinder(0.75f, 2.0f, appearance);
TG.addChild(Silinder);

// Menambahkan Bentuk Di Badan
Badan.addChild(TG);

// Membuat Bahu Kanan
BahuKanan = new TransformGroup();
BahuKanan.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
BahuKanan.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Vector.set(-0.95f, 2.9f, -0.2f);
Trans.set(Vector);
BahuKanan.setTransform(Trans);
lingkaran = new Sphere(0.22f, appearance);
BahuKanan.addChild(lingkaran);
TG = new TransformGroup();
Vector.set(0.0f, -0.5f, 0.0f);
Trans.set(Vector);
TG.setTransform(Trans);
Silinder = new Cylinder(0.2f, 1.0f, appearance);
TG.addChild(Silinder);
BahuKanan.addChild( TG);
Badan.addChild(BahuKanan);

// membuat siku Kanan
SikuKanan = new TransformGroup();
SikuKanan.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
SikuKanan.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Vector.set(0.0f, -1.054f, 0.0f);
Trans.set(Vector);
SikuKanan.setTransform(Trans);lingkaran = new Sphere(0.22f, appearance);
SikuKanan.addChild(lingkaran);TG = new TransformGroup();
Vector.set(0.0f, -0.5f, 0.0f);
Trans.set(Vector);
TG.setTransform(Trans);
Silinder = new Cylinder(0.2f, 1.0f, appearance);
TG.addChild(Silinder);
SikuKanan.addChild(TG);
BahuKanan.addChild(SikuKanan);

// Membuat Bahu KIri
BahuKiri = new TransformGroup();
BahuKiri.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
BahuKiri.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Vector.set(0.95f, 2.9f, -0.2f);
Trans.set(Vector);
BahuKiri.setTransform(Trans);
lingkaran = new Sphere(0.22f, appearance);
BahuKiri.addChild(lingkaran);
TG = new TransformGroup();
Vector.set(0.0f, -0.5f, 0.0f);
Trans.set(Vector);
TG.setTransform(Trans);
Silinder = new Cylinder(0.2f, 1.0f, appearance);
TG.addChild(Silinder);
BahuKiri.addChild(TG);
Badan.addChild(BahuKiri);

// Membuat Siku KIri
SikuKiri = new TransformGroup();
SikuKiri.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
SikuKiri.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Vector.set(0.0f, -1.054f, 0.0f);
Trans.set(Vector);
SikuKiri.setTransform(Trans);
lingkaran = new Sphere(0.22f, appearance);
SikuKiri.addChild(lingkaran);
TG = new TransformGroup();
Vector.set(0.0f, -0.5f, 0.0f);
Trans.set(Vector);
TG.setTransform(Trans);
Silinder = new Cylinder(0.2f, 1.0f, appearance);
TG.addChild(Silinder);
SikuKiri.addChild(TG);
BahuKiri.addChild(SikuKiri);

// Membuat Paha Kanan
PahaKanan = new TransformGroup();
PahaKanan.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
PahaKanan.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Vector.set(-0.45f, 0.9f, 0.2f);
Trans.set(Vector);
PahaKanan.setTransform(Trans);
lingkaran = new Sphere(0.22f, appearance);
PahaKanan.addChild(lingkaran);
TG = new TransformGroup();
Vector.set(0.0f, -0.5f, 0.0f);
Trans.set(Vector);
TG.setTransform(Trans);
Silinder = new Cylinder(0.2f, 1.0f, appearance);
TG.addChild(Silinder);
PahaKanan.addChild( TG);
Badan.addChild(PahaKanan);

// Membuat Betis Kanan
BetisKanan = new TransformGroup();
BetisKanan.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
BetisKanan.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Vector.set(0.0f, -1.054f, 0.0f);
Trans.set(Vector);
BetisKanan.setTransform(Trans);lingkaran = new Sphere(0.22f, appearance);
BetisKanan.addChild(lingkaran);TG = new TransformGroup();
Vector.set(0.0f, -0.5f, 0.0f);
Trans.set(Vector);
TG.setTransform(Trans);
Silinder = new Cylinder(0.2f, 1.0f, appearance);
TG.addChild(Silinder);
BetisKanan.addChild(TG);
PahaKanan.addChild(BetisKanan);

// Membuat Paha Kiri
PahaKiri = new TransformGroup();
PahaKiri.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
PahaKiri.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Vector.set(0.45f, 0.9f, 0.2f);
Trans.set(Vector);
PahaKiri.setTransform(Trans);
lingkaran = new Sphere(0.22f, appearance);
PahaKiri.addChild(lingkaran);
TG = new TransformGroup();
Vector.set(0.0f, -0.5f, 0.0f);
Trans.set(Vector);
TG.setTransform(Trans);
Silinder = new Cylinder(0.2f, 1.0f, appearance);
TG.addChild(Silinder);
PahaKiri.addChild(TG);
Badan.addChild(PahaKiri);

// Membuat Betis Kiri
BetisKiri = new TransformGroup();
BetisKiri.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
BetisKiri.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Vector.set(0.0f, -1.054f, 0.0f);
Trans.set(Vector);
BetisKiri.setTransform(Trans);
lingkaran = new Sphere(0.22f, appearance);
BetisKiri.addChild(lingkaran);
TG = new TransformGroup();
Vector.set(0.0f, -0.5f, 0.0f);
Trans.set(Vector);
TG.setTransform(Trans);
Silinder = new Cylinder(0.2f, 1.0f, appearance);
TG.addChild(Silinder);
BetisKiri.addChild(TG);
PahaKiri.addChild(BetisKiri);

// Membuat Badan
Kepala = new TransformGroup();
Vector.set(0.0f, 3.632f, 0.0f);
Trans.set(Vector);
Kepala.setTransform(Trans);
lingkaran = new Sphere(0.5f, appearance);
Kepala.addChild(lingkaran);
Badan.addChild(Kepala);
}

public void actionPerformed(ActionEvent e) {
Point loc = canvas.getLocationOnScreen();
offScreenCanvas.setOffScreenLocation(loc);
Dimension dim = canvas.getSize();
dim.width *= SkalaLayar;
dim.height *= SkalaLayar;
nf.setMinimumIntegerDigits(3);
offScreenCanvas.snapImageFile(FileKepala + nf.format(FileSeq++), dim.width,dim.height);
nf.setMinimumIntegerDigits(0);
}

public void setPutarBahuKanan(int rotasi) {
PutarBahuKanan = rotasi;
BahuKananAA.angle = (float) Math.toRadians(PutarBahuKanan);
BahuKanan.getTransform(Trans);
Trans.setRotation(BahuKananAA);
BahuKanan.setTransform(Trans);
}

public void setPutarSikuKanan(int rotasi) {
PutarSikuKanan = rotasi;
SikuKananAA.angle = (float) Math.toRadians(PutarSikuKanan);
SikuKanan.getTransform(Trans);
Trans.setRotation(SikuKananAA);
SikuKanan.setTransform(Trans);
}

public void setPutarBahuKiri(int rotasi) {
PutarBahuKiri = rotasi;
BahuKiriAA.angle = (float) Math.toRadians(PutarBahuKiri);
BahuKiri.getTransform(Trans);
Trans.setRotation(BahuKiriAA);
BahuKiri.setTransform(Trans);
}

public void setPutarSikuKiri(int rotasi) {
PutarSikuKiri = rotasi;
SikuKiriAA.angle = (float) Math.toRadians(PutarSikuKiri);
SikuKiri.getTransform(Trans);
Trans.setRotation(SikuKiriAA);
SikuKiri.setTransform(Trans);
}

public void setPutarPahaKanan(int rotasi){
PutarPahaKanan = rotasi;
PahaKananAA.angle = (float) Math.toRadians(PutarPahaKanan);
PahaKanan.getTransform(Trans);
Trans.setRotation(PahaKananAA);
PahaKanan.setTransform(Trans);
}

public void setPutarBetisKanan(int rotasi){
PutarBetisKanan = rotasi;
BetisKananAA.angle = (float) Math.toRadians(PutarBetisKanan);
BetisKanan.getTransform(Trans);
Trans.setRotation(BetisKananAA);
BetisKanan.setTransform(Trans);
}

public void setPutarPahaKiri(int rotasi){
PutarPahaKiri = rotasi;
PahaKiriAA.angle = (float) Math.toRadians(PutarPahaKiri);
PahaKiri.getTransform(Trans);
Trans.setRotation(PahaKiriAA);
PahaKiri.setTransform(Trans);
}

public void setPutarBetisKiri(int rotasi){
PutarBetisKiri = rotasi;
BetisKiriAA.angle = (float) Math.toRadians(PutarBetisKiri);
BetisKiri.getTransform(Trans);
Trans.setRotation(BetisKiriAA);
BetisKiri.setTransform(Trans);
}

public void stateChanged(ChangeEvent e) {
JSlider source = (JSlider) e.getSource();
int value = source.getValue();
if (source == BahuKananSlider) {
setPutarBahuKanan(value);
BahuKananSliderLabel.setText(Integer.toString(value));
}
else if (source == SikuKananSlider) {
setPutarSikuKanan(value);
SikuKananSliderLabel.setText(Integer.toString(value));
}
else if (source == BahuKiriSlider) {
setPutarBahuKiri(value);
BahuKiriSliderLabel.setText(Integer.toString(value));
}
else if (source == SikuKiriSlider) {
setPutarSikuKiri(value);
SikuKiriSliderLabel.setText(Integer.toString(value));
}
else if (source == PahaKananSlider){
setPutarPahaKanan(value);
PahaKananSliderLabel.setText(Integer.toString(value));
}
else if (source == BetisKananSlider){
setPutarPahaKanan(value);
BetisKananSliderLabel.setText(Integer.toString(value));
}
else if (source == PahaKiriSlider){
setPutarPahaKanan(value);
PahaKiriSliderLabel.setText(Integer.toString(value));
}
else if (source == BetisKiriSlider){
setPutarPahaKanan(value);
BetisKiriSliderLabel.setText(Integer.toString(value));
}
}

BranchGroup createSceneGraph() {
// Membuat Putaran
BranchGroup objRoot = new BranchGroup();

// Membuat TransformGroup
TransformGroup objScale = new TransformGroup();
Transform3D scaleTrans = new Transform3D();
scaleTrans.set(1 / 3.5f);
objScale.setTransform(scaleTrans);
objRoot.addChild(objScale);

// Membuat TransformGroup dan initialize
TransformGroup objTrans = new TransformGroup();
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
objScale.addChild(objTrans);

// Menambahkan Method Gambar Orang
GambarOrang();
objTrans.addChild(Badan);

BoundingSphere bounds = new BoundingSphere(new Point3d(), 100.0);

Background bg = new Background(new Color3f(1.0f, 1.0f, 1.0f));
bg.setApplicationBounds(bounds);
objTrans.addChild(bg);

// Mengatur Mouse
MouseRotate mr = new MouseRotate();
mr.setTransformGroup(objTrans);
mr.setSchedulingBounds(bounds);
mr.setFactor(0.007);
objTrans.addChild(mr);

// Mengatur Terang
Color3f ambientColor = new Color3f(0.1f, 0.1f, 0.1f);
AmbientLight ambientLightNode = new AmbientLight(ambientColor);
ambientLightNode.setInfluencingBounds(bounds);
objRoot.addChild(ambientLightNode);
Color3f light1Color = new Color3f(1.0f, 1.0f, 1.0f);
Vector3f light1Direction = new Vector3f(0.0f, -0.2f, -1.0f);

DirectionalLight light1 = new DirectionalLight(light1Color,
light1Direction);
light1.setInfluencingBounds(bounds);
objRoot.addChild(light1);

return objRoot;
}

public TBGrafkom() {
this(false, 1.0f);
}

public TBGrafkom(boolean isApplication, float initOffScreenScale) {
this.isApplication = isApplication;
this.SkalaLayar = initOffScreenScale;
}

public void init() {
nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(3);

setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();

canvas = new Canvas3D(config);

add(“Center”, canvas);

ManAnGinaMahmud = new SimpleUniverse(canvas);

if (isApplication) {
offScreenCanvas = new OffScreenCanvas3D(config, true);
Screen3D sOn = canvas.getScreen3D();
Screen3D sOff = offScreenCanvas.getScreen3D();
Dimension dim = sOn.getSize();
dim.width *= SkalaLayar;
dim.height *= SkalaLayar;
sOff.setSize(dim);
sOff.setPhysicalScreenWidth(sOn.getPhysicalScreenWidth()* SkalaLayar);
sOff.setPhysicalScreenHeight(sOn.getPhysicalScreenHeight()* SkalaLayar);

ManAnGinaMahmud.getViewer().getView().addCanvas3D(offScreenCanvas);
}

BranchGroup scene = createSceneGraph();
ManAnGinaMahmud.getViewingPlatform().setNominalViewingTransform();
ManAnGinaMahmud.addBranchGraph(scene);
lihat = ManAnGinaMahmud.getViewer().getView();
add(“East”, guiPanel());
}

// Membuat Panel
JPanel guiPanel() {
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(0, 1));

// putar Bahu Kanan
panel.add(new JLabel(“Putar Bahu Kanan”));
BahuKananSlider = new JSlider(JSlider.HORIZONTAL, 0, 240, PutarBahuKanan);
BahuKananSlider.addChangeListener(this);
BahuKananSliderLabel = new JLabel(Integer.toString(PutarBahuKanan));
panel.add(BahuKananSlider);
panel.add(BahuKananSliderLabel);

// Putar Siku Kanan
panel.add(new JLabel(“Putar Siku Kanan”));
SikuKananSlider = new JSlider(JSlider.HORIZONTAL, 0, 140, PutarSikuKanan);
SikuKananSlider.addChangeListener(this);
SikuKananSliderLabel = new JLabel(Integer.toString(PutarSikuKanan));
panel.add(SikuKananSlider);
panel.add(SikuKananSliderLabel);

// Putar Bahu Kiri
panel.add(new JLabel(“Putar Bahu Kiri”));
BahuKiriSlider = new JSlider(JSlider.HORIZONTAL, 0, 240, PutarBahuKiri);
BahuKiriSlider.addChangeListener(this);
BahuKiriSliderLabel = new JLabel(Integer.toString(PutarBahuKiri));
panel.add(BahuKiriSlider);
panel.add(BahuKiriSliderLabel);

// Putar Siku Kiri
panel.add(new JLabel(“Putar Siku Kiri”));
SikuKiriSlider = new JSlider(JSlider.HORIZONTAL, 0, 140, PutarSikuKiri);
SikuKiriSlider.addChangeListener(this);
SikuKiriSliderLabel = new JLabel(Integer.toString(PutarSikuKiri));
panel.add(SikuKiriSlider);
panel.add(SikuKiriSliderLabel);

//Putar Paha Kanan
panel.add(new JLabel(“Putar Paha Kanan”));
PahaKananSlider = new JSlider(JSlider.HORIZONTAL, 0, 60, PutarPahaKanan);
PahaKananSlider.addChangeListener(this);
PahaKananSliderLabel = new JLabel(Integer.toString(PutarPahaKanan));
panel.add(PahaKananSlider);
panel.add(PahaKananSliderLabel);

//Putar Betis Kanan
panel.add(new JLabel(“Putar Betis Kanan”));
BetisKananSlider = new JSlider(JSlider.HORIZONTAL, 0, 60, PutarBetisKanan);
BetisKananSlider.addChangeListener(this);
BetisKananSliderLabel = new JLabel(Integer.toString(PutarBetisKanan));
panel.add(BetisKananSlider);
panel.add(BetisKananSliderLabel);

//Putar Paha Kiri
panel.add(new JLabel(“Putar Paha Kiri”));
PahaKiriSlider = new JSlider(JSlider.HORIZONTAL, 0, 60, PutarPahaKiri);
PahaKiriSlider.addChangeListener(this);
PahaKiriSliderLabel = new JLabel(Integer.toString(PutarPahaKiri));
panel.add(PahaKiriSlider);
panel.add(PahaKiriSliderLabel);

//Putar Betis Kiri
panel.add(new JLabel(“Putar Betis Kiri”));
BetisKiriSlider = new JSlider(JSlider.HORIZONTAL, 0, 60, PutarBetisKiri);
BetisKiriSlider.addChangeListener(this);
BetisKiriSliderLabel = new JLabel(Integer.toString(PutarBetisKiri));
panel.add(BetisKiriSlider);
panel.add(BetisKiriSliderLabel);
return panel;
}

public void destroy() {
ManAnGinaMahmud.removeAllLocales();
}

public static void main(String[] args) {
float initOffScreenScale = 2.5f;
for (int i = 0; i < args.length; i++) {
if (args[i].equals(“-s”)) {
if (args.length >= (i + 1)) {
initOffScreenScale = Float.parseFloat(args[i + 1]);
i++;
}
}
}
new MainFrame(new TBGrafkom(true, initOffScreenScale), 1000, 650);
}
}

class OffScreenCanvas3D extends Canvas3D {

OffScreenCanvas3D(GraphicsConfiguration graphicsConfiguration,
boolean offScreen) {

super(graphicsConfiguration, offScreen);
}

private BufferedImage doRender(int width, int height) {

BufferedImage bImage = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);

ImageComponent2D buffer = new ImageComponent2D(
ImageComponent.FORMAT_RGB, bImage);

setOffScreenBuffer(buffer);
renderOffScreenBuffer();
waitForOffScreenRendering();
bImage = getOffScreenBuffer().getImage();
return bImage;
}

void snapImageFile(String filename, int width, int height) {
BufferedImage bImage = doRender(width, height);

try {
FileOutputStream fos = new FileOutputStream(filename + “.jpg”);
BufferedOutputStream bos = new BufferedOutputStream(fos);

JPEGImageEncoder jie = JPEGCodec.createJPEGEncoder(bos);
JPEGEncodeParam param = jie.getDefaultJPEGEncodeParam(bImage);
param.setQuality(1.0f, true);
jie.setJPEGEncodeParam(param);
jie.encode(bImage);

bos.flush();
fos.close();
} catch (Exception e) {
System.out.println(e);
}
}
}

Ini Hasil Programnya ya…

Beli T-Shirt, Raglan dan Kids T-Shirt Original Ocean Seven

  1. T-Shirt, Raglan dan Kids T-Shirt Anime, Manga, Gamers dan Cartoon World (OceanSeven)
  2. T-Shirt, Raglan dan Kids T-Shirt Footbal Series (OceanSeven)
  3. T-Shirt, Raglan dan Kids T-Shirt Music Series (OceanSeven)
  4. T-Shirt, Raglan dan Kids T-Shirt OceanSeven – Custom dan Basic Tees (OceanSeven)
  5. T-Shirt, Raglan dan Kids T-Shirt OceanSeven -Kids Collections (OceanSeven)
  6. T-Shirt, Raglan dan Kids T-Shirt OceanSeven -Signature Serues (OceanSeven)
  7. T-Shirt, Raglan dan Kids T-Shirt  Social Media dan Photography (OceanSeven)
  8. T-Shirt, Raglan dan Kids T-Shirt Sport, Automotive dan Adventure (OceanSeven)
  9. T-Shirt, Raglan dan Kids T-Shirt Superheroes dan Movies (OceanSeven)

Satu pemikiran pada “Membuat Java 3D “Animasi Manusia”

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s