Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.jogamp.opengl.GL;
- import com.jogamp.opengl.GL2ES2;
- import com.jogamp.opengl.GL2;
- PJOGL pgl;
- GL2 gl;
- void settings(){
- PJOGL.profile = 1;
- size(800, 600, P3D);
- }
- void setup() {
- float[] fogColor = { 1.0f, 0.0f, 0.0f, 1.0f };
- pgl = (PJOGL) beginPGL();
- gl = pgl.gl.getGL2();
- gl.glClearDepth(1.0f);
- gl.glEnable(GL2.GL_DEPTH_TEST);
- gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST);
- gl.glShadeModel(GL2.GL_SMOOTH);
- gl.glClearColor(0.5f,0.5f,0.5f,1.0f);
- //Setup Fog mode
- gl.glEnable(GL2.GL_FOG);
- gl.glFogfv(GL2.GL_FOG_COLOR, fogColor, 1);
- gl.glFogf(GL2.GL_FOG_DENSITY, 1f);
- gl.glHint(GL2.GL_FOG_HINT, GL2.GL_NICEST);
- gl.glFogf(GL2.GL_FOG_START, 1f);
- gl.glFogf(GL2.GL_FOG_END, 1f);
- endPGL();
- }
- void draw() {
- pgl = (PJOGL) beginPGL();
- gl = pgl.gl.getGL2();
- gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
- gl.glFogi(GL2.GL_FOG_MODE, GL2.GL_EXP);
- gl.glFogf(GL2.GL_FOG_DENSITY, 3.0f);
- perspective(radians(90), (float)width/(float)height, 0.1f, 1000);
- // Geometry transformations from Processing are automatically passed to the shader
- // as long as the uniforms in the shader have the right names.
- translate(width/2, height/2);
- rotateX(mouseX * 0.01);
- rotateY(mouseY * 0.01);
- box(200);
- endPGL();
- }
Add Comment
Please, Sign In to add comment