Examples of AWTGLCanvas


Examples of org.lwjgl.opengl.AWTGLCanvas

   */
  public AWTTest() throws LWJGLException {
    setTitle("LWJGL AWT Canvas Test");
    setSize(640, 320);
    setLayout(new GridLayout(1, 2));
    add(canvas0 = new AWTGLCanvas() {
      int current_height;
      int current_width;
      public void paintGL() {
        try {
          if (getWidth() != current_width || getHeight() != current_height) {
            current_width = getWidth();
            current_height = getHeight();
            glViewport(0, 0, current_width, current_height);
          }
          glViewport(0, 0, getWidth(), getHeight());
          glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
          glClear(GL_COLOR_BUFFER_BIT);
          glMatrixMode(GL_PROJECTION);
          glLoadIdentity();
          gluOrtho2D(0.0f, (float) getWidth(), 0.0f, (float) getHeight());
          glMatrixMode(GL_MODELVIEW);
          glPushMatrix();
          glColor3f(1f, 1f, 0f);
          glTranslatef(getWidth() / 2.0f, getHeight() / 2.0f, 0.0f);
          glRotatef(angle, 0f, 0f, 1.0f);
          glRectf(-50.0f, -50.0f, 50.0f, 50.0f);
          glPopMatrix();
          swapBuffers();
          repaint();
        } catch (LWJGLException e) {
          throw new RuntimeException(e);
        }
      }
    });
    add(canvas1 = new AWTGLCanvas() {
      int current_height;
      int current_width;
      public void paintGL() {
        try {
          angle += 1.0f;
View Full Code Here

Examples of org.lwjgl.opengl.AWTGLCanvas

  }

  public LwjglAWTCanvas (ApplicationListener listener, LwjglAWTCanvas sharedContextCanvas) {
    LwjglNativesLoader.load();

    AWTGLCanvas sharedDrawable = sharedContextCanvas != null ? sharedContextCanvas.canvas : null;
    try {
      canvas = new AWTGLCanvas(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(), new PixelFormat(),
        sharedDrawable) {
        private final Dimension minSize = new Dimension(0, 0);

        public Dimension getMinimumSize () {
          return minSize;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.