High Performance Visualization I - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

High Performance Visualization I

Description:

Introduction to the Immersive Visualization System. http://ivs.cs.jmu.edu ... Add source files, compile, and run! Creating a project reference: ... – PowerPoint PPT presentation

Number of Views:28
Avg rating:3.0/5.0
Slides: 25
Provided by: cs196
Category:

less

Transcript and Presenter's Notes

Title: High Performance Visualization I


1
High Performance Visualization I
  • Instructors
  • Dr. James Sochacki
  • Dr. Ramon Mata-Toledo
  • Lab Instructors
  • Joshua Blake
  • Justin Creasy

2
Introduction
  • HPV I
  • Introduction to OpenGL and Scientific
    Visualization
  • HPV II
  • Introduction to the Immersive Visualization
    System
  • http//ivs.cs.jmu.edu/
  • HPV III (proposed for Spring 05)
  • Projects on IVS

3
Immersive Visualization System
4
Course Overview
  • OpenGL
  • 3D graphics API standard
  • Cross-platform
  • Hardware accelerated (i.e. GeForceFX 5950 Ultra)
  • DirectX / Direct3D
  • Windows only
  • Maya / 3dStudio / Blender
  • Create 3D Models
  • NOT an API
  • NOT the subject of this course

5
Course Overview
  • Scientific Visualization
  • Visualization of scientific data
  • Sources Measured, estimated, computed
  • We will focus on computed
  • Visualize in order to make data understandable
  • Complex and high-dimensional data (5 or 6
    dimensions) is hard to understand!

6
OpenGL History
  • OpenGL Open Graphics Library
  • Single Vendor-independent API for 2D and 3D
    graphics applications
  • Adapted from SGI Iris GL library in 1992
  • Industry review board
  • Recently released OpenGL 2.0 spec
  • No license needed!

7
WTF is OpenGL?
  • According to The Redbook (SGI)
  • Construct shapes from geometric primitives,
    thereby creating mathematical descriptions of
    objects. (OpenGL considers points, lines,
    polygons, images, and bitmaps to be primitives.)

8
  • Arrange the objects in three-dimensional space
    and select the desired vantage point for viewing
    the composed scene.

9
  • Calculate the color of all the objects. The
    color might be explicitly assigned by the
    application, determined from specified lighting
    conditions, obtained by pasting a texture onto
    the object, or some combination of these three
    actions.

10
  • Convert the mathematical description of objects
    and their associated color information to pixels
    on the screen. This process is called
    rasterization.
  • Also
  • No commands for performing windowing tasks or
    obtaining user input are included in OpenGL
    instead, you must work through whatever windowing
    system controls the particular hardware youre
    using.

11
OpenGL Programming Environment
  • OpenGL spec contains 150 commands
  • Other libraries add to functionality
  • GLUT GL Utility Toolkit
  • Handles windowing, input/output
  • Cross-platform, Windows and Linux and more

12
Setting up GLUT on VS.Net 2003
  • Download GLUT
  • http//www.xmission.com/nate/glut/glut-3.7.6-bin.
    zip
  • Copy files to appropriate directories
  • glut.h -gt C\Program Files\Microsoft Visual
    Studio .NET 2003\Vc7\PlatformSDK\Include\gl
  • glut32.lib -gt \PlatformSDK\Lib
  • Glut32.dll -gt C\Windows\System
  • Glut32.dll must be on any computer that runs a
    glut program, so distribute it with your program

13
Creating a Project in VS.Net 2003
  • Create New Project (Select Visual C Projects,
    Win32, Win32 Console Project), give it a name,
    and press OK

14
Creating a Project in VS.Net 2003
  • Click Application Settings and check Empty
    Project

15
Creating a Project in VS.Net 2003
  • Add source files, compile, and run!
  • Creating a project reference
  • http//helpdesk.cs.tamu.edu/docs/glut_Visual_Studi
    o2003

16
First Program
  • include ltgl/glut.hgt
  • void renderScene(void)
  • glClear(GL_COLOR_BUFFER_BIT)
  • glBegin(GL_TRIANGLES)
  • glVertex3f(-0.5,-0.5,0.0)
  • glVertex3f(0.5,0.0,0.0)
  • glVertex3f(0.0,0.5,0.0)
  • glEnd()
  • glFlush()
  • void main(int argc, char argv)
  • glutInit(argc, argv)
  • glutInitDisplayMode(GLUT_DEPTH GLUT_SINGLE
    GLUT_RGBA)
  • glutInitWindowPosition(100,100)
  • glutInitWindowSize(320,320)
  • glutCreateWindow("3D Tech- GLUT Tutorial")
  • glutDisplayFunc(renderScene)
  • glutMainLoop()

Source http//www.lighthouse3d.com/opengl/glut/in
dex.php3?2
17
Draw with Points, Quads, Triangles
  • glBegin(GL_TRIANGLES)
  • Begins a vertex list, and specifies how to
    process the vertices. Vertex list ends with
    glEnd() below.
  • glVertex3f(-0.5,-0.5,0.0)
  • glVertex3f(0.5,0.0,0.0)
  • glVertex3f(0.0,0.5,0.0)
  • The vertex list. We can also have colors,
    normals, and other appropriate commands here
  • glColor3f(1.0, 0.0, 0.0)
  • glVertex3f(-1.5,-0.5,0.0)
  • glColor3f(0.0, 1.0, 0.0)
  • glVertex3f(-0.5,0.0,0.0)
  • glColor3f(0.0, 0.0, 1.0)
  • glVertex3f(-1.0,0.5,0.0)
  • glEnd()

18
Draw with Points, Quads, Triangles
19
Callbacks
  • Give GLUT function pointers to our functions
  • void renderScene(void)
  • glutDisplayFunc(renderScene)
  • GLUT calls the function as needed, according to
    the purpose.

20
Input
  • void keyboard(unsigned char key, int x, int y)
  • glutKeyboardFunc(keyboard)
  • Keyboard input (characters plus escape key) are
    sent to this callback
  • X and Y are mouse position in window coordinates
    when key is pressed

21
Animation!
  • void timer(int num)
  • int milliseconds 10, num 1
  • glutTimerFunc(milliseconds, timer, num)
  • Sets a timer and the specified function is called
    at minimum 10 ms (in this case) with a value of
    1.
  • void idle()
  • glutIdleFunc(idle)
  • Calls the idle function whenever GLUT isnt doing
    anything else

22
Program State
  • Anything that determines what is displayed is
    called the program state.
  • In a game would be game state
  • For smooth animation, the state should be updated
    only in the timer function.
  • User input should change HOW the timer function
    changes the state (i.e. change the rate of
    change/velocity)
  • Timer function can do small bits of computation

23
Reference
  • www.opengl.org
  • www.sgi.com/products/software/opengl
  • www.gatetutorials.com/Tutorials/tutorials.htm
  • www.gamedev.net (The Redbook)

24
Homework
  • Write name in 2D using Quads and/or Triangles
  • Make it animated in a cool way.
Write a Comment
User Comments (0)
About PowerShow.com