Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Search
Login
Register
www.jpct.net
»
jPCT - a 3d engine for Java
»
Support
»
Sky
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Sky (Read 4950 times)
Melssj5
double
Posts: 724
Sky
«
on:
April 11, 2006, 05:02:27 am »
How to add a sky instead of that black enviroment that jpct has by default?
Logged
Nada por ahora
Mr.Marbles
int
Posts: 81
Sky
«
Reply #1 on:
April 11, 2006, 03:00:54 pm »
I've used the technique described in the following
post
and it works well. If you just want to use a solid color for the background then you can replace the buffer.clear() with buffer.clear(Color).
Logged
pitt
byte
Posts: 13
Sky
«
Reply #2 on:
April 17, 2006, 02:00:42 pm »
use the technic called 'skybox'.
Some free sky textures.
http://www.octanedigitalstudios.com/page4.html
http://www.scentednectar.com/skyboxes/
Source code
float size=4000;
String[] name={"top","front","left","right","back"};
for (int i=0;i<name.length;i++)
{
InputStream in=new FileInputStream(name
+".jpg");
BufferedImage b=null;
try
{
b=ImageIO.read(in);
} catch (Exception e) {}
Texture pic=new Texture(b,false);
pic.enableGLClamping();
TextureManager.getInstance().addTexture(name
,pic);
}
Object3D[] o=new Object3D[name.length];
//top
Object3D obj=Primitives.getPlane(1,size*2);
obj.rotateZ((float)Math.PI/2);
obj.rotateX((float)Math.PI/2);
obj.translate(0,size,0);
o[0]=obj;
//front
obj=Primitives.getPlane(1,size*2);
obj.translate(0,0,size);
obj.rotateZ((float)Math.PI);
o[1]=obj;
//left
obj=Primitives.getPlane(1,size*2);
obj.translate(size,0,0);
obj.rotateZ((float)Math.PI);
obj.rotateY((float)Math.PI/2);
o[2]=obj;
//right
obj=Primitives.getPlane(1,size*2);
obj.translate(-size,0,0);
obj.rotateZ((float)Math.PI);
obj.rotateY((float)-Math.PI/2);
o[3]=obj;
//back
obj=Primitives.getPlane(1,size*2);
obj.translate(0,0,-size);
obj.rotateZ((float)Math.PI);
obj.rotateY((float)Math.PI);
o[4]=obj;
for (int i=0;i<name.length;i++)
{
o
.setTexture(name
);
o
.setLighting(Object3D.LIGHTING_NO_LIGHTS);
o
.build();
world.addObject(o
);
}
Logged
Remo
int
Posts: 64
Sky
«
Reply #3 on:
April 18, 2006, 09:13:39 am »
You can also use a more simple method like raft did here :
http://www.jpct.net/forum/viewtopic.php?p=1854#1854
Logged
Melssj5
double
Posts: 724
Sky
«
Reply #4 on:
April 18, 2006, 06:52:49 pm »
Well, i set my map inside an empty sphere, and I gave the sphere a texture of a sky
Logged
Nada por ahora
Print
Pages: [
1
]
Go Up
« previous
next »
www.jpct.net
»
jPCT - a 3d engine for Java
»
Support
»
Sky