Advertisement
Guest User

FlickerProblem

a guest
Sep 6th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.93 KB | None | 0 0
  1. package de.puffeldings.collaboration.core;
  2.  
  3. import java.util.logging.Level;
  4. import java.util.logging.Logger;
  5.  
  6. import com.jme3.app.SimpleApplication;
  7. import com.jme3.light.AmbientLight;
  8. import com.jme3.material.Material;
  9. import com.jme3.math.Vector2f;
  10. import com.jme3.math.Vector3f;
  11. import com.jme3.renderer.RenderManager;
  12. import com.jme3.scene.Geometry;
  13. import com.jme3.scene.Node;
  14. import com.jme3.scene.shape.Box;
  15. import com.jme3.system.AppSettings;
  16.  
  17. public class FlickerProblem extends SimpleApplication
  18. {
  19.     private static final Logger LOGGER = Logger.getLogger("com.jme3");
  20.     private static final int MAX_OBJECTS = 500000;
  21.     private static boolean ONCE = true;
  22.     public static FlickerProblem app;
  23.     public Node world;
  24.     public static Geometry geom;
  25.  
  26.     public static void main(String[] args)
  27.     {
  28.         LOGGER.setLevel(Level.SEVERE);
  29.         AppSettings settings = new AppSettings(true);
  30.         settings.setTitle("Puffeldings");
  31.         settings.setResolution(1280, 720);
  32.         // settings.setFullscreen(true);
  33.         settings.setFrequency(60);
  34.         settings.setVSync(true);
  35.         // settings.setSamples(8); // AA
  36.         settings.setBitsPerPixel(32);
  37.         settings.setRenderer(AppSettings.LWJGL_OPENGL_ANY);
  38.         app = new FlickerProblem();
  39.         app.setSettings(settings);
  40.         app.setShowSettings(false);
  41.         app.start();
  42.     }
  43.  
  44.     @Override
  45.     public void simpleInitApp()
  46.     {
  47.         cam.setFrustumPerspective(55f, (float) cam.getWidth() / cam.getHeight(), 0.01f, 1024f);
  48.         cam.setLocation(new Vector3f(500000, 0.5f, 1));
  49.         flyCam.setMoveSpeed(200);
  50.  
  51.         world = new Node("World");
  52.         Material mat_normals = new Material(assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
  53.  
  54.         for (int objectsIdx = 0; objectsIdx < MAX_OBJECTS; objectsIdx++)
  55.         {
  56.             Box box = new Box(0.5f, 0.5f, 0.5f);
  57.             Geometry geom = new Geometry(box.toString(), box);
  58.             geom.setLocalTranslation(objectsIdx, 0, 0);
  59.             geom.setMaterial(mat_normals);
  60.             world.attachChild(geom);
  61.         }
  62.         rootNode.attachChild(world);
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement