示例#1
0
  public void init() {

    // IG.p("width="+getWidth()+", height="+getHeight());

    panel = new IGridPanel(0, 0, getWidth(), getHeight(), 2, 2);
    panel.setVisible(true);
    panel.setParent(this);
    // panel.setAdapter(this);

    ig = IG.init(panel);
    ig.server().graphicServer().enableGL();

    addMouseListener(panel);
    addMouseMotionListener(panel);
    addMouseWheelListener(panel);
    addKeyListener(panel);
    addFocusListener(panel);
    addComponentListener(panel);
    // addWindowListener(panel); // ?

    igg = new IGraphicsGL2();

    enableEvents(
        AWTEvent.MOUSE_EVENT_MASK
            | AWTEvent.MOUSE_MOTION_EVENT_MASK
            | AWTEvent.MOUSE_WHEEL_EVENT_MASK
        /*|AWTEvent.KEY_EVENT_MASK*/
        );

    initScreen(); // is it ok to put here?

    addComponentListener(
        new ComponentListener() {
          public void componentHidden(ComponentEvent e) {}

          public void componentMoved(ComponentEvent e) {}

          public void componentShown(ComponentEvent e) {}

          public void componentResized(ComponentEvent e) {
            setSize(getSize());
          }
        });

    setLayout(null);
    /*
    //GL
    GLProfile.initSingleton();
    final GLCanvas glcanvas = new GLCanvas();
    glcanvas.addGLEventListener(new GLEventListener(){
    	//@Override public void reshape( GLAutoDrawable glautodrawable, int x, int y, int w, int h){}
    	@Override public void init( GLAutoDrawable glautodrawable){}
    	@Override public void dispose( GLAutoDrawable glautodrawable){}
    	@Override public void display( GLAutoDrawable glautodrawable){
    	    glautodrawable.getGL().getGL2();
    	    glautodrawable.getWidth();
    	    glautodrawable.glHeight();
    	}
    	@Override public void displayChanged(GLAutoDrawable glautodrawable, boolean f1, boolean f2){}

        });
    glcanvas.setSize(getSize());
    add(glcanvas);
    //glanimationcontrol = new FPSAnimator(glacanvas, 30);
    */
    // final GLCanvas glcanvas = new GLCanvas();
    // IG.p(GL.GL_VERSION);
    // IG.p("Jogl package = "+Package.getPackage("javax.media.opengl"));
    // IG.p("JOGL version: "+ Package.getPackage("javax.media.opengl").getImplementationVersion());
  }