Exemplo n.º 1
0
 public static FragmentShader load(Class<?> base, String name) {
   InputStream in = base.getResourceAsStream(name);
   try {
     try {
       return (parse(new InputStreamReader(in, Utils.ascii)));
     } finally {
       in.close();
     }
   } catch (IOException e) {
     throw (new RuntimeException(e));
   }
 }
Exemplo n.º 2
0
 public static String constname(Class<?> cl, int val) {
   String ret = null;
   for (java.lang.reflect.Field f : cl.getFields()) {
     if (((f.getModifiers() & java.lang.reflect.Modifier.STATIC) != 0)
         && ((f.getModifiers() & java.lang.reflect.Modifier.PUBLIC) != 0)
         && (f.getType() == Integer.TYPE)) {
       int v;
       try {
         v = f.getInt(null);
       } catch (IllegalAccessException e) {
         continue;
       }
       if (v == val) {
         if (ret == null) ret = f.getName();
         else ret = ret + " or " + f.getName();
       }
     }
   }
   if (ret == null) return (Integer.toString(val));
   return (ret);
 }
Exemplo n.º 3
0
  public static void main(String[] args) {
    int type = USE_NEWT;
    String tstName = "demos.es2.perftst.PerfVBOLoad"; // default

    for (int i = args.length - 1; i >= 0; i--) {
      if (args[i].equals("-awt")) {
        type |= USE_AWT;
      }
      if (args[i].equals("-test") && i + 1 < args.length) {
        tstName = args[i + 1];
      }
    }

    try {
      PerfModule pmod = (PerfModule) Class.forName(tstName).newInstance();
      new Perftst().run(type, pmod);
      System.exit(0);
    } catch (Exception e) {
      e.printStackTrace();
      System.exit(1);
    }
  }