Lab 1: OpenGL Tutorial CS 282. What’s the plan for today? Go over our framework code. Learn some basic OpenGL! Reveal Lab 1 Answer questions.

Slides:



Advertisements
Similar presentations
GR2 Advanced Computer Graphics AGR
Advertisements

Computer Graphics 2D & 3D Transformation.
02/17/05CISC640/440 OpenGL Tutorial1 OpenGL Tutorial CISC 640/440 Computer Graphics TA: Qi Li/Mani Thomas
CSE 457 Modeler Help Session Lovingly brought to you by: TA Steve.
CLASS 4 CS770/870. Translation Scale Multiplying Matrices. The R C rule What happens when we do two translates? What happens when we do two scales?
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Informationsteknologi Monday, October 29, 2007Computer Graphics - Class 21 Today’s class Graphics programming Color.
What is OpenGL? Low level 2D and 3D Graphics Library Competitor to Direct3D (the rendering part of DirectX) Used in: CAD, virtual reality, scientific.
#4: OpenGL Implementation & Project 2 CSE167: Computer Graphics TAs: Alex Kozlowski & Cameron Chrisman UCSD, Winter 2006.
3.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 3 Viewing Transformation Getting Started with OpenGL Introduction to Projections.
LAB #1: Computer Graphics Framework IGX is a set of programs which allow you to write graphics programs in C/C++ from plain text files. Benefits: 1. You.
CS148: Introduction to Computer Graphics and Imaging Midterm Review Session.
Computer Graphics CS 385 February 7, Fundamentals of OpenGl and Glut Today we will go through the basics of a minimal OpenGl Glut project, explaining.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Reference1. [OpenGL course slides by Rasmus Stenholt]
CS380 LAB I OpenGL Donghyuk Kim Reference1. [OpenGL course slides by Rasmus Stenholt] Reference2. [
CSE328:Computer Graphics OpenGL Tutorial Dongli Zhang Department of Computer Science, SBU Department of Computer Science, Stony.
CAP4730: Computational Structures in Computer Graphics Introduction to OpenGL.
COS 397 Computer Graphics Assoc. Prof. Svetla Boytcheva AUBG 2013 COS 397 Computer Graphics Practical Session №1 Introduction to OpenGL, GLFW and CG.
Basic OpenGL Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, September 10, 2003.
1 GLUT Callback functions Event-driven: Programs that use windows  Input/Output  Wait until an event happens and then execute some pre-defined functions.
INTRO TO COMPUTER GRAPHICS TEXT EDWARD ANGEL: EDITION 5 CS770/870
Drawing Basic Graphics Primitives Lecture 4 Wed, Sep 3, 2003.
OpenGL Shading Language (Advanced Computer Graphics) Ernest Tatum.
C O M P U T E R G R A P H I C S Jie chen Computer graphic -- OpenGL Howto.
Triangulation Introduction to Computer Graphics and Animation (Principle of Computer Graphics) Rattapoom Waranusast.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
CS 450: COMPUTER GRAPHICS PORTRAIT OF AN OPENGL PROGRAM SPRING 2015 DR. MICHAEL J. REALE.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical.
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
Interactive Computer Graphics CS 418 – Spring 2015 Mesh Rendering, Transformation, Camera Viewing and Projection in OpenGL TA: Zhicheng Yan Sushma S Kini.
Ch 2 Graphics Programming page 1 CSC 367 Coordinate Systems (2.1.2) Device coordinates, or screen coordinates (pixels) put limitations on programmers and.
1. OpenGL/GLU/GLUT  OpenGL v4.0 (latest) is the “core” library that is platform independent  GLUT v3.7 is an auxiliary library that handles window creation,
1 Figures are extracted from Angel's book (ISBN x) The Human Visual System vs The Pinhole camera Human Visual System Visible Spectrum Pinhole.
CD2012 Principles of Interactive Graphics Lecture 01 Introduction Abir Hussain (Rome: 6.33,Tel , Web:
CS559: Computer Graphics Lecture 15: Hierarchical Modeling and Shading Li Zhang Spring 2008.
Modeling with OpenGL Practice with OpenGL transformations.
Jul 25, 2014IAT 3551 Scene Graphs.  A data structure that stores information about a graphics scene –Each node has information that structures the interpretation.
Intro to OpenGL Transformations CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Introduction to Computer Graphics 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
Introduction to OpenGL  OpenGL is a graphics API  Software library  Layer between programmer and graphics hardware (and software)  OpenGL can fit in.
Lecture 2: Some definitions of terms 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
OpenGL: The Open Graphics Language Introduction By Ricardo Veguilla.
NoufNaief.net 1 TA: Nouf Al-Harbi.
Computer Graphics and the Game Industry Speaker: Ted Bisson.
Graphical Objects and Scene Graphs Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Lecture 2 Review OpenGL Libraries Graphics Overview Rendering Pipeline OpenGL command structure.
Composing Transformations
Transformation. 3D Transformation oIn the modeling lecture we saw how to define an object in terms of its vertices in object space oWe will now see how.
Introduction to Graphics Programming. Graphics API.
Introduction to OpenGL (INF 250) Veronika Solteszova et al., UiB Dept. of Informatics,
CS380 LAB II OpenGL Donghyuk Kim Reference1. [OpenGL course slides by Rasmus Stenholt] Reference2. [
OpenGL: The Open Graphics Language Technology and Historical Overview By Ricardo Veguilla.
Introduction to 3-D Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 27, 2003.
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.
Dependency GRAPH ANALYZER
School of Computer Science
IAT 355 Scene Graphs Feb 23, 2017 IAT 355.
Starting to draw dealing with Windows which libraries? clipping
Outline Announcements Dynamic Libraries HWII on web, due Friday
Chapter 4/5 glMatrixMode Modeling Transformations glTranslate glScale
Modeler Help Session CSE 457, Autumn 2008
Projection in 3-D Glenn G. Chappell
Modeler Help Session CSE 457, Autumn 2007
OpenGL program.
Modeler Help Session CSE 457, Spring 2008
Starting to draw dealing with Windows which libraries? clipping
Modeler Help Session CSE 457, Spring 2007
Prepared by your friendly, phantom TA Jennifer
Presentation transcript:

Lab 1: OpenGL Tutorial CS 282

What’s the plan for today? Go over our framework code. Learn some basic OpenGL! Reveal Lab 1 Answer questions

Framework Environment C/C++ and OpenGL Code will be given with Makefiles You can compile in Linux, Mac, and Windows! You must use the framework

What should you know? At the very least You’ve programmed before You know the programming cycle Better for you if You are familiar with C/C++ Amazing if You already know OpenGL Have a degree in Computer Science

Framework Where do I get it?! Resources in Class Website Resources in Class Website This lab’s framework provides you with An initial OpenGL window Callback functions you will need

What is OpenGL? A powerful, open source graphics library Widely used in both industry and academia Capable of rendering 3D geometries with a plethora of effects Keeps a “global” state Transformation, projection matrices Attributes from primitives

Exercise: Compiling Compile the framework Change window size, position, and title

Exercise: Drawing Things! Since you guys are now pros, let’s draw things! Every GL primitive starts with glBegin(…), and ends with glEnd () Example: glBegin (GL_POINT); glVertex3f( 1.0,1.0,1.0); glEnd()

Exercise: Drawing Quads Find the DrawGLScene() function After glLoadIdentity(), create a GL primitive using GL_QUADS

Exercise: Drawing Quads Add this code And this code…

What just happened?! OK, that’s weird, why is the screen yellow? We’ve basically rendered our object too close for us to really see it. So, we need to move (or translate) it further back.

Translation and Rotation Rotation (unsurprisingly) rotates the primitive, BUT rotates it around the “world” axis, NOT its local axis Hint: You can think of the camera as always being at the world origin(0,0,0) Translation “moves” the primitive around to a different location The order you do translations and rotations in MATTERS

Translation and Rotation RotateTranslate

Rotate then Translate Translate then Rotate

Translation and Rotation WARNING!!! OpenGL will perform translations and rotations IN THE OPPOSITE ORDER YOU WRITE THEM IN CODE i.e. writing the following in code: … glTranslate(...) glRotate(…) … Will rotate then translate the primitive

Translation and Rotation Important things to keep in mind: Translate/Rotate operates relative to the world origin The order of translations and rotations matters OpenGL will perform translations and rotations in the OPPOSITE order you list them in code

Exercise: Finish the cube Add this line of code above your primitive in your drawing function. Finish the rest of the cube. Change the color of each side to something else! glColor3f( red, green, blue );

Callbacks GLUT allows us to interface between events (such as clicking, keyboard input, etc.) and OpenGL.

Lab 1 Implement a camera to move around in OpenGL. Use the callback functions provided for you. Use the cube as a way to debug your camera. Make sure you at least create a vector, camera, and framework class.

Questions?

Useful sites OpenGL Reference Pages: (what we use) (latest ver.) NeHe Tutorials (under Legacy Tutorials): Note: As of Aug. 2011, the current tutorials are a little out-of-date/deprecated, but in the process of being updated. They still give a good explanation of the basics, but don’t expect to be able to run the code.