CSE4030 Introduction to Computer Graphics

Similar documents
Abel J. P. Gomes LAB. 1. INTRODUCTION TO OpenGL

Announcements OpenGL. Computer Graphics. Autumn 2009 CS4815

Computer Graphics. OpenGL

Lecture 3. Understanding of OPenGL programming

Announcements OpenGL. Computer Graphics. Spring CS4815

Teacher Assistant : Tamir Grossinger Reception hours: by - Building 37 / office -102 Assignments: 4 programing using

Drawing Primitives. OpenGL basics

Introduction to Computer Graphics with OpenGL/GLUT

Introduction to MS Visual C/C++

COMPUTER GRAPHICS LAB # 3

CS 4204 Computer Graphics

Programming using OpenGL: A first Introduction

CS 543 Lecture 1 (Part II): Intro to OpenGL and GLUT (Part I) Emmanuel Agu

Assignment 1. Simple Graphics program using OpenGL

OpenGL Basics I. Seoul National University Graphics & Media Lab

Duc Nguyen CSE 420 Computer Graphics 10/10/2018 Homework 1

Computer Graphics. Bing-Yu Chen National Taiwan University

LECTURE 02 OPENGL API

CS559: Computer Graphics. Lecture 12: OpenGL Li Zhang Spring 2008

Using OpenGL with CUDA

Graphics Programming. August 31, Programming of the Sierpinski gasket. Programming with OpenGL and C/C++

Computer Graphics. Making Pictures. Computer Graphics CSC470 1

Precept 2 Aleksey Boyko February 18, 2011

(21) OpenGL GUI. OpenGL GUI 1 UNIX MAGAZINE UNIX. SGI (Silicon Graphics Inc.) Windows PC GUI. UNIX Windows GUI. Java. 1 prefposition() X X


CS 4731 Lecture 3: Introduction to OpenGL and GLUT: Part II. Emmanuel Agu

To Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3)

C++ is Fun Part 13 at Turbine/Warner Bros.! Russell Hanson

Computer Graphics (CS 4731) OpenGL/GLUT(Part 1)

Lecture 2 CISC440/640 Spring Department of Computer and Information Science

Draw the basic Geometry Objects. Hanyang University

Cameras (and eye) Ideal Pinhole. Real Pinhole. Real + lens. Depth of field

PART-I: Lab for MCS-051 (Advanced Internet Technologies)

Lectures OpenGL Introduction

Graphics Programming

CS 543 Lecture 1 (Part 3) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Using OpenGL & GLUT in Visual Studio.NET 2003

by modifying the glutinitwindowsize() function you can change the screen size to whatever you please.

Programming with OpenGL Part 2: Complete Programs Computer Graphics I, Fall

Programming with OpenGL Part 1: Background

Basic Graphics Programming

Early History of APIs. PHIGS and X. SGI and GL. Programming with OpenGL Part 1: Background. Objectives

Computer Graphics, Chapt 08

Programming with OpenGL Part 1: Background

OpenGL/GLUT Intro. Week 1, Fri Jan 12

2. OpenGL -I. 2.1 What is OpenGL? Things OpenGL can do: -23-

Introduction to OpenGL Week 1

Objectives. Image Formation Revisited. Physical Approaches. The Programmer s Interface. Practical Approach. Introduction to OpenGL Week 1

6. Make use of glviewport() to display two sine curves on the same screen, one on the

ERKELEY DAVIS IRVINE LOS ANGELES RIVERSIDE SAN DIEGO SAN FRANCISCO EECS 104. Fundamentals of Computer Graphics. OpenGL

CS Computer Graphics: Intro to OpenGL

CS Computer Graphics: Intro to OpenGL

CS 432 Interactive Computer Graphics

Bob s Concise Introduction to Doxygen

C++ - OpenGL - Setting up Visual Studio

RECITATION - 1. Ceng477 Fall

Computer graphics MN1

OpenGL JOGL. OpenGL & JOGL. Shaoting Zhang, or Tony. September 12, 2007

CS380: Computer Graphics Basic OpenGL Structure. Sung-Eui Yoon ( 윤성의 ) Course URL:

Computer Graphics (CS 543) Lecture 1 (Part 2): Introduction to OpenGL/GLUT (Part 1)

Computer Graphics Introduction to OpenGL

GL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW

Overview of Graphics Systems Hearn & Baker Chapter 2. Some slides are taken from Robert Thomsons notes.

Computer Graphics 1 Computer Graphics 1

CS Computer Graphics: OpenGL, Continued

CS Computer Graphics: OpenGL, Continued

VR-programming tools (procedural) More VRML later in this course! (declarative)

Fourier Series. Given a periodic function, x(t), (-T <t <T): + b n sin n t T. a n cos n t T. 2 a 0 + Z T. a n = 1 T. x(t) cos n t T. b n = 1 T.

Computer Graphics. Chapter 3 Computer Graphics Software

Computer Graphics Course 2005

CS418 OpenGL & GLUT Programming Tutorial (I) Presented by : Wei-Wen Feng 1/30/2008

Introduction to OpenGL: Part 2

COMP 371/4 Computer Graphics Week 1

GLUT Tutorial. John Tsiombikas (Nuclear / The Lab Demos) May 6, Introduction to GLUT (OpenGL Utility Toolkit)

Programming with OpenGL Part 3: Three Dimensions

LAB MANUAL. Computer Graphics using OpenGL Department of CSE & IT, JUIT. Chief Course Coordinator: Dr Rajesh Siddavatam Associate Professor, CSE& IT

OpenGL refresher. Advanced Computer Graphics 2012

OpenGL Introduction Computer Graphics and Visualization

OpenGL and GLUT. COMP413 Computer Graphics. School of Computer Sci. & Eng. Kyungpook National University, Korea. Spring Semester, 2016

2 Transformations and Homogeneous Coordinates

Computer Graphics Primitive Attributes

Graphics Programming. 1. The Sierpinski Gasket. Chapter 2. Introduction:

CS559: Computer Graphics. Lecture 12: OpenGL Transformation Li Zhang Spring 2008

to OpenGL Introduction Pipeline Graphics pipeline OpenGL pipeline OpenGL syntax Modeling Arrays Conclusion 1 Introduction Introduction to OpenGL

Lecture 4 of 41. Lab 1a: OpenGL Basics

Graphics Hardware and OpenGL

11/1/13. Basic Graphics Programming. Teaching Assistant. What is OpenGL. Course Producer. Where is OpenGL used. Graphics library (API)

Computer Graphics (Basic OpenGL)

Basic Graphics Programming

Exercise 1 Introduction to OpenGL

Introduction to Computer Graphics. Hardware Acceleration Review

1.2 Basic Graphics Programming

UNIT 7 LIGHTING AND SHADING. 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M

Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D

Computer Graphics: Line Drawing Algorithms

Source code: #include <iostream>

Programming of Graphics

Information Coding / Computer Graphics, ISY, LiTH. OpenGL! ! where it fits!! what it contains!! how you work with it 11(40)

Computer graphics MN1

Introduction to OpenGL

Transcription:

CSE4030 Introduction to Computer Graphics Dongguk University Jeong-Mo Hong

Week 2 The first step on a journey to the virtual world An introduction to computer graphics and interactive techniques How to start graphics programming

Teaching Assistants Jeong-Hyun Lee H.P. 010 9789-6972 E-mail jhlee@atelierj.pro Sun-Tae Kim H.P. 010 2629-9775 E-mail stkim@atelierj.pro Dong-Ho Park H.P. 010 8975-4130 E-mail dhpark@atelierj.pro

Location Room No.613 DGU Research Institute for Image & Cultural Content Main Bldg.

Lab 2 How to Start Graphics Programming GLUT setup Visual Studio environment setting GLUT API Preparing for a canvas (window) Input devices (keyboard, mouse)

OpenGL Open Graphics Library API for 2D and 3D graphics programming Developed by Silicon Graphics OpenGL 3.0 was released on August 11, 2008 Cross-platform (but MS has D3D) GLUT The OpenGL Utility Toolkit

OpenGL in Windows opengl32.dll in C:\Windows\System32

OpenGL in Windows glu32.dll in C:\Windows\System32

GLUT GL Utility API Documents http://www.opengl.org/resources/libraries/glut/spec3/spec3.html Download GLUT Nate Robin s Homepage Google Nate Robin http://www.xmission.com/~nate/glut.html GLUT for Win32 : glut-3.7.6-bin.zip

GLUT Setup glut binary release glut.def glut.h glut32.dll glut32.lib

GLUT Setup (header) C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include Default include path of Visual Studio 2005 Copy glut.h file to GL directory

GLUT Setup (lib) C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib Default library path of Visual Studio 2005 Copy glut32.lib

GLUT Setup (dll) C:\Windows\System32 Default DLL directory of Windows Copy glut32.dll

Visual Studio

Visual Studio (Project Setting) Create a new project

Visual Studio (Project Setting) C++ - Win32 Win32 Console Application

Visual Studio (Project Setting) Application setting

Visual Studio (Project Setting) Add source code files

Visual Studio (Project Setting) C++ - Code C++ File(.cpp)

Visual Studio (Project Setting) Change project property

Visual Studio (Project Setting) Additional library files for linking Configuration Properties Linker - Input No comma!!! opengl32.lib glu32.lib glut32.lib

Visual Studio (Project Setting)

Visual Studio (Project Setting) Additional library directories Linker General Additional Library Directories

GL Window Creating a window Initialize the background color glclearcolor(glclampf red, Glclmapf green, Glclampf blue, Glclampf alpha) glclearcolor(0, 0, 0, 0) glclearcolor(1, 1, 1, 0)

GL Window [1/2] int main(int argc, char **argv) { glutinit(&argc, argv); glutinitdisplaymode(glut_single GLUT_RGB); glutinitwindowsize(500, 500); glutinitwindowposition(100, 100); glutcreatewindow("gl Sample : Hello!"); glclearcolor(0.0, 0.0, 0.0, 0.0); gluortho2d(0, 500, 500, 0); glutdisplayfunc(display); glutmainloop(); } return 0;

GL Window [2/2] void display() { glclear(gl_color_buffer_bit); glflush(); }

Check List glut.h Is GL\glut.h in one of the include paths? windows.h Required to use GL\GL.h on Windows platform

Build Test Build success Build failure Check if the library files(lib) are in correct directories. Is the DLL fine in system32 directory?

Keyboard Event Keyboard input handlers int main(int argc, char **argv) { // glutdisplayfunc(display); glutkeyboardfunc(keyboard); glutkeyboardupfunc(keyupfunc); // } return 0;

Keyboard Event Test functions for keyboard input void keydownfunc(unsigned char key, int x, int y) { printf( keydown function\n ); } void keyupfunc(unsigned char key, int x, int y) { printf("keyup function ); }

Mouse Event Mouse input handlers int main(int argc, char **argv) { // glutdisplayfunc(display); glutmousefunc(mouse); glutmotionfunc(dragging); glutpassivemotionfunc(motion); } // return 0;

Mouse Event Test functions for mouse input void mouse(int button, int state, int x, int y) { printf( mouse function\n ); } void motion(int x, int y) { printf("motion function\n ); } void dragging(int x, int y) { printf( dragging function\n ); }

Results Expected results

Drawing primitives All drawing codes must be implemented in display function Registered using glutdisplayfunc( ) void display() { glbegin( ); // // codes for drawing here // } glend(); glflush(); glutswapbuffers(); glutpostredisplay();

Drawing - Points glcolor3f(0.0, 0.0, 0.0); glpointsize(5.0); glbegin(gl_points); glvertex3f(0.1, 0.1, 0.0); glvertex3f(0.9, 0.1, 0.0); glvertex3f(0.1, 0.9, 0.0); glend(); vertex position

Drawing - Line GL_LINES GL_LINE_STRIP GL_LINE_LOOP GL_LINES GL_LINE_STRIP glcolor3f(0.0, 0.0, 0.0); glbegin(gl_lines); glvertex3f(0.1, 0.1, 0.0); glvertex3f(0.9, 0.1, 0.0); glvertex3f(0.1, 0.9, 0.0); glend(); GL_LINE_LOOP

Assignment Write a visual interactive program Keyboard input (a, s, d, w) Mouse input(move, click)?

Appendix - Environment setting Tools Import and Export Settings Environment setting

Appendix - Environment setting Reset all settings

Appendix - Environment setting Reset settings

Appendix - Environment setting Select Visual C++ Development settings