Introduce Jogl. Outline What is Jogl Jogl coding template Create a GLPanel Draw a 2D object on GLPanel Draw texts on GLPanel Draw a 3D object on GLPanel.

Slides:



Advertisements
Similar presentations
Java + OpenGL = JOGL Java and OpenGL Rich Truban Andrew Potozniak.
Advertisements

OpenGL CMSC340 3D Character Design & Animation. What is OpenGL? A low-level graphics library specification designed for use with the C and C++ provides…
Picture It Very Basic Game Picture Pepper. Original Game import java.util.Scanner; public class Game { public static void main() { Scanner scan=new Scanner(System.in);
Drawing in a frame – Java GUI
1 Drawing C Sc 335 Object-Oriented Programming and Design Rick Mercer.
Things to mention public static void main(String [] args) –The starting point for a free-standing Java application (i.e. one not run from the DrJava interactions.
CS 468 OpenGL Jon Moon Spring 2004 Computer Science Cornell University.
Graphics & Animation in Android. Android rendering options The Canvas API Renderscript OpenGL wrappers NDK OpenGL
Things to mention public static void main(String [] args) imports comments –block comments /* … */ –single-line comments // –javadoc comments and tags.
Graphics Programming With Applets Feb 23, Applets There are three different types of executable java code. –Standalone application, which has main()
Event Handling Events and Listeners Timers and Animation.
CS 280 Data Structures Professor John Peterson. Quiz 4 Recap Consider the following array: {2, 6, 7, 3, 4, 1, 5, 9}. Draw this in tree form and then show.
3D Development In Java CCNY Capstone Project By: Peter Giang.
Graphical User Interfaces
Java Review Structure of a graphics program. Computer Graphics and User Interfaces Java is Object-Oriented A program uses objects to model the solution.
Animations by Physicists PHYSICS DEPARTMENT TAMU SUMMER ’05 Mario Francisco Borunda.
by Jim X. Chen: 1.1. Professor Jim X. Chen Department of Computer Science George Mason University Fairfax, VA
Overview of Computer Graphics Chapter 1. Bird’s Eye View  Overview of Computer Graphics –Basic concept of computer graphics, system, programming platforms,
2005 by Jim X. Chen: The OpenGL graphics system is an application Programming interface (API) to graphics hardware. WHAT.
Java Swing Chris North cs3724: HCI. AWT to Swing AWT: Abstract Windowing Toolkit import java.awt.* Swing: new with Java2 import javax.swing.* Extends.
Zhang & Liang, Computer Graphics Using Java 2D and 3D (c) 2007 Pearson Education, Inc. All rights reserved. 1 Chapter 1 Overview of Computer Graphics.
Chapter 03: Graphics Primitives Course web page: Chapter #3.
2005 by Jim X. Chen: Jim X. Chen, Ph.D. Director of Computer Graphics Lab George Mason University.
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
UniS CS297 Graphics with Java and OpenGL Viewing, the model view matrix.
UniS CS297 Graphics with Java and OpenGL Introduction.
2002 by Jim X. Chen George Mason University Transformation and Viewing.1. Plane Example: J2_0_2DTransform.
JAPPLET.
1 Chapter 1 Overview of Computer Graphics  To understand the basic objectives and scope of computer graphics  To identify computer graphics applications.
Lab 6: Shapes & Picture Extended Ellipse & Rectangle Classes Stand-Alone GUI Applications.
Esri UC 2014 | Technical Workshop | Animating Thousands of Graphics with ArcGIS Runtime SDK for Java Mark Baird and Vijay Gandhi.
Introducing your Game Engine Part 1 Games Fundamentals © by Jarek Francik Kingston University, London February 2008.
NEWTON’S CRADLE CADENAS QUIJANO, PATRICIA COTRINA FERNÁNDEZ, MANUEL GARCÍA TOMILLO, JAVIER HIJARRUBIA BERNAL, LUIS An OpenGL Application.
1 Applets and Course Evaluation Applet Example - Sailing Applet UML Diagrams Applet Web Page Encoding (HTML) Applet Java Coding – Hello World Course Evaluation.
Applets. What is an applet? Why create applets instead of applications? – Applets are Java programs that can be embedded in an HTML document – In contrast,
3D Animations on the Internet Tyson Shepherd (sophomore) Intense Laser Physics Theory Unit Supports: NSF, Res. Co, URG.
UniS CS297 Graphics with Java and OpenGL Basic Definitions.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Review of Graphics in Java,
1 University of Utah – School of Computing Computer Science 1021 "Applets and Applications"
Introduction to Processing. 2 What is processing? A simple programming environment that was created to make it easier to develop visually oriented applications.
CPSC 453 Tutorial Xin Liu Sep 23, OpenGL An open standard of rendering pipeline A software interface to graphics hardware A useful set of APIs for.
Introduction to OpenGL  OpenGL is a graphics API  Software library  Layer between programmer and graphics hardware (and software)  OpenGL can fit in.
CS 480/680 Computer Graphics Programming with Open GL Part 6: Three Dimensions Dr. Frederick C Harris, Jr. Fall 2011.
Creating Windows. How can we use Java to create programs that use windows (GUI applications)? How can we use Java to create programs that use windows.
 GUI – Graphic User Interface  Up to now in the programs we have written all output has been sent to the standard output device i.e.: the DOS console.
Creating Applets. What is an applet? What is an applet? A Java program that runs in a web browser. A Java program that runs in a web browser. An applet.
1 Applets. 2 Design of Applets 3 Sun wrote Java to be executable within a hosting application browser The applications are applets. An applet is downloaded.
Review_6 AWT, Swing, ActionListener, and Graphics.
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
Outline Creating Objects The String Class The Random and Math Classes Formatting Output Enumerated Types Wrapper Classes Components and Containers Images.
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
Java Swing One of the most important features of Java is its ability to draw graphics.
Documenting a function. Documenting a function definition We have a template for information that we need you to put at the top of each function - if.
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
Java With NetBeans First Project. Java Are language for this semester is Java The Development Environment is Netbeans.
Graphical User Interface (GUI)
Agenda For Feb PowerPoint Presentation on Java Methods. 3. Finish Happy Face Assignment (Due by the.
Advanced Topics on Graphical User Interfaces CardLayout JTabbedPane JFrame.
Basic Graphics 03/03/16 & 03/07/16 Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010.
Introducing, the JFrame Gives us a work area beside System.out.println.
Computer Graphics Lecture 1. Books D. Hearn, M. P. Baker, "Computer Graphics with OpenGL", 3rd Ed., Prentice Hall, 2003, ISBN
COMP3421/9415 Computer Graphics
Our Graphics Environment
گرافیک رایانه ای.
GUI AND GRAPHICS.
OpenGL and Related Libraries
Membuat Lingkaran.
Plane 2D GEOMETRICAL TRANSFORMATIONS Example: J2_0_2DTransform
CS297 Graphics with Java and OpenGL
Presentation transcript:

Introduce Jogl

Outline What is Jogl Jogl coding template Create a GLPanel Draw a 2D object on GLPanel Draw texts on GLPanel Draw a 3D object on GLPanel

What is Jogl It is a wrapper graphics library that allows OpenGL to be used in Java. Some online demos: – worldbuilder/

Jogl coding template JFarme GLPanel + GLEventListener init() display() reshape() displayChanged() Your drawing functions, used in display() drawA2DBall() drawA3DSphere() drawText()

Create a GLPanel public class JOGL3DBasics { JOGLDemo() { GLJPanel panel = getGLJPanel(); panel.addGLEventListener(new MyGLEventListener()); JFrame frame = new JFrame(); frame.getContentPane().add(panel); } class MyGLEventListener { void init() {…} void display() {…} void reshape() [] {…} void displayChanged() {…} } public static void main() { // create a JOGL3DBasics object } } // end of class

Draw a 2D object void draw2DObject(GL gl) { gl.glColor3f(1, 0, 0); gl.glRecti(-SIZE / 2, -SIZE / 2, SIZE / 2, SIZE / 2); } void display(GLAutoDrawable drawable) { GL gl = drawable.getGL(); gl.glClear(GL.GL_COLOR_BUFFER_BIT); // clean panel draw2DObject(gl); }

Draw texts Create a TextRenderer object, called renderer. void drawTexture(GLAutoDrawable drawable) { renderer.beginRendering(drawable.getWidth(), drawable.getHeight()); renderer.setColor(1.0f, 0.1f, 0.8f, 0.8f); renderer.draw("Jogl Demo for CPSC 332", 80, 60); renderer.endRendering(); }

Draw a 3D object Create a TextRenderer object, called renderer. void drawTexture(GLAutoDrawable drawable) { renderer.beginRendering(drawable.getWidth(), drawable.getHeight()); renderer.setColor(1.0f, 0.1f, 0.8f, 0.8f); renderer.draw("Jogl Demo for CPSC 332", 80, 60); renderer.endRendering(); }

Put them all together

Animate them

Q uestions ?