Spring 2010Topics in Computer Graphics FLTK and OpenGL Jyun-Ming Chen.

Slides:



Advertisements
Similar presentations
Microsoft® Small Basic
Advertisements

MiniDraw Testing COMP 102 # T1
FLUID  The Fast Light User Interface Designer, or FLUID, is a graphical editor that is used to produce FLTK source code  Creates C++ code  Compile.fl.
Starting and Customizing a PowerPoint Slide Show
CS 4731 Lecture 2: Intro to 2D, 3D, OpenGL and GLUT (Part I) Emmanuel Agu.
1 of 25 Assignment Orthographic Wireframe Elevation Orthographic Wireframe Plan Orthographic Wireframe End-Elevation Perspective View.
A graphical user interface (GUI) is a pictorial interface to a program. A good GUI can make programs easier to use by providing them with a consistent.
What is OpenGL? Low level 2D and 3D Graphics Library Competitor to Direct3D (the rendering part of DirectX) Used in: CAD, virtual reality, scientific.
1 3D modelling with OpenGL Brian Farrimond Robina Hetherington.
Sketchify Tutorial Graphics and Animation in Sketchify sketchify.sf.net Željko Obrenović
Based on slides created by Edward Angel
OpenGL Brian Farrimond Robina Hetherington. What is OpenGL A specification of a set of functions for drawing graphics –Names of functions –What information.
Write a Simple Program with OpenGL & GLUT. Books and Web Books OpenGL Programming Guide (Red-book) OpenGL Reference Manual (Blue-book) OpenGL Super Bible.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
INTRO TO COMPUTER GRAPHICS TEXT EDWARD ANGEL: EDITION 5 CS770/870
Andy Wilson - GLUT and GLVU - 9/99 - Slide 1 GLUT and GLVU Andy Wilson September 22, 1999.
Bertrand Bellenot ROOT Users Workshop Mar ROOT GUI Builder Status & Plans ROOT & External GUI World MFC, FOX, Qt, PVSS… Snapshot of the Future.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
Written by: Itzik Ben Shabat Technion - Israel Institute of Technology Faculty of Mechanical Engineering Laboratory for CAD & Lifecycle Engineering Lab.
Introduction to Matlab & Data Analysis
Introduction to OpenGL and GLUT GLUT. What is OpenGL? An application programming interface (API) A (low-level) Graphics rendering API Generate high-quality.
C O M P U T E R G R A P H I C S Jie chen Computer graphic -- OpenGL Howto.
FLTK Tutorial.
Lecture 5: Interaction 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
1Computer Graphics Input and Interaction Lecture 8 John Shearer Culture Lab – space 2
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
3461A Readings from the Swing Tutorial. 3461A Overview  The follow is the Table of Contents from the trail “Creating a GUI with JFC/Swing” in the “The.
FLTK Help Session By Richard Yu Gu CS 638 -Graphics Fall, 1999.
Lecture 3 OpenGL.
1 Input and Interaction. 2 Input Devices Physical input devices Keyboard devices and pointing devices Logical input devices.
Computer Graphics I, Fall 2010 Input and Interaction.
Write a Simple Program with OpenGL & GLUT. Books OpenGL Programming Guide (Red-book) OpenGL Reference Manual (Blue-book) OpenGL Super Bible
1 Graphics CSCI 343, Fall 2015 Lecture 1 Introduction to Graphics Read: Chapter 1 of textbook.
Computer Graphics, KKU. Lecture 101 Introduction to OpenGL.
 “OpenGL (Open Graphics Library) is a standard specification defining a cross- language cross-platform API for writing applications that produce 2D and.
Adding a New Option to the Framework. Introduction This is intended as a step by step guide to adding a new action to the menu or toolbar. The order of.
Lecture 6: 3D graphics Concepts 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271 
Project 6 Tumbling Cube Fri, Nov 21, 2003 Due Mon, Dec 8, 2003.
FLTK. Objectives Install and Use FLTK Widgets ◦Callbacks Handling event ◦System events ◦Mouse events ◦Keyboard events.
1 Chapter 12 GUI C/C++ Language Programming Wanxiang Che.
Interactive Computer Graphics CS 418 MP1: Dancing I TA: Zhicheng Yan Sushma S Kini Mary Pietrowicz Slides Taken from: “An Interactive Introduction to OpenGL.
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Build-A-Button Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, October 8, 2003.
The Abstract Window Toolkit (AWT) supports Graphical User Interface (GUI) programming. AWT features include: a rich set of user interface components; a.
Program 2 due 02/01  Be sure to document your program  program level doc  your name  what the program does  each function  describe the arguments.
1 Input and Interaction. 2 Objectives Introduce the basic input devices ­Physical Devices ­Logical Devices ­Input Modes Event-driven input Introduce double.
More on GLUT Programming Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, September 15, 2003.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
University of New Mexico
NoufNaief.net TA: Nouf Al-harbi.
GLUT functions glutInit allows application to get command line arguments and initializes system gluInitDisplayMode requests properties for the window.
Simple Clicker App WPF App using C#. App Requirement Need a ‘counter’ display, which starts at 0 Need a ‘clicker’ button ! Pressing the clicker every.
OpenGL Basic Drawing 2003 Spring Keng Shih-Ling
Lecture 2 Review OpenGL Libraries Graphics Overview Rendering Pipeline OpenGL command structure.
Visualization Recreate the ping pong scene in 3D using ball and racket coordinates.
Introduction to OpenGL
OpenGL in FLTK  .
OpenGL Basic Drawing Jian-Liang Lin A Smidgen of OpenGL Code #include main() { InitializeAWindowPlease(); glClearColor (0.0, 0.0, 0.0, 0.0); glClear.
July FLTK The Fast Light Toolkit • A C++ graphical user interface toolkit • Can be used under X, Windows, MacOS • Supports OpenGL • Provides: – Interactive.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Computer Graphics (fall,2010) School of Computer Science University of Seoul Minho Kim.
School of Computer Science
Final Project of Computer Graphics
FLTK The Fast Light Toolkit
CSC461 Lecture 8: Input Devices
The User Interface Lecture 2 Mon, Aug 27, 2007.
Event Driven Programming
Input and Interaction Ed Angel
University of New Mexico
Input and Interaction Ed Angel
Presentation transcript:

Spring 2010Topics in Computer Graphics FLTK and OpenGL Jyun-Ming Chen

Content Review inter-widget communication “ Double.c ” -based examples Idle, timer, … numerous events Fluid-based implementation Viewer examples

Review: Widget Talk Value can be controlled by the text widget and the slider Demonstrate inter- widget communications 13 value v Design

WidgetTalk

Handle()

Using OpenGL in FLTK Subclass Fl_Gl_Window Draw(): display callback Redraw(): PostRedisplay Handle(): mouse/kbd event handler Valid(): off when FLTK creates a new context for this window, or when the window resizes; on after draw() is called. reshape

Double.c by Fl_Gl_Window Class design Private double angle; Private double speed; Public draw(); Public handle(); Public toggleMotion(); Other issues: Speed control Time-based animation “ Callback ” Reshape Display Mouse Keyboard Timer Idle

Animation Idle function add_idle(void (*cb)(void*), void* = 0); void remove_idle(void (*cb)(void*), void* = 0); Timer function: one-shot timeout callback Fl::add_timeout (double t, // seconds Fl_Timeout_Handler,void* = 0); void remove_timeout(Fl_Timeout_Handler, void* = 0); void repeat_timeout(double t, Fl_Timeout_Handler,void* = 0); Class method of Fl

Summary: OpenGL Using Fluid (or Fl_Group)

First example: shape First, simple application with no animation! Create Shape_Win class with these method Set_sides Draw() Generate interface with fluid: A double_win and a slider Callback of the slider: set the sides and calls redraw

Creating a Double.c in FLTK

Step 1 Create main() Create a function

Step 2 Select main Create a Window inside main()

Class Double_Win A subclass of Fl_Gl_Window Must define draw() Include them in the directory Later …

Step 3 Add the class Double_Win into the window First, create a group Add these…

Toggle Motion Use timeout “ fl_spin ” to animate Spin_on: records the spin status

Step 4 Add a button for toggleMotion First, create a button Add these…

Finally, Save the fluid file Generate the codes Compile and run!

Flaux – my addition to FLTK Glm.c: OBJ reader Glutshapes.c: the glut primitives Glutteapot.c: the Utah teapot Viewer: the class of spherical viewer

Viewer Methods Void center (float*c); Void center (const float c[3]); Float extent(); Void extent (float e); Float fovY(); Void fovY(float f); Void set_content (void (*fun)(void)); Color & depth buffers are already cleared No need to “ swapbuffer ”… taken care of by FLTK Void set_glinit(void(void (*fun)(void));

About Viewer Design philosophy Only a simple prototype, illustrating how camera control is done by an event handler As to the displaying content, simply handed out to a content function call If additional control (by GUI)is demanded (e.g., turn on/off lights, animation, etc.), one needs to customize the draw( ) with additional public methods to be called from other widgets. MD2chooser is a good example.

Shapes Sphere, cone, cube, torus Dodecahedron, octahedron, icosahedron, tetrahedron Teapot About FL/glut.h I do not wish to mix GLUT with FLTK. Hence, all shapes routines are extracted out of glut library and make them in an aux library.

Other Examples

OBJ_Viewer Version 0: straight modification from viewer Version 1: ViewerGLM augmented Viewer with: pmodel and set_objmodel () Version 2: Derive OBJ_Viewer from Viewer

OBJ Chooser Use Fl_File_Chooser, ViewerGLM and Fluid

Texture Experiment Using plain Viewer Testing wrap and filters