3D Modelling with OpenGL - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

3D Modelling with OpenGL

Description:

... with OpenGL. Brian Farrimond. Robina Hetherington. 2. Schedule. Portfolio work. Week 10. Colour, materials, lighting. Using 3DSMax models. Week 9. 3D OpenGL ... – PowerPoint PPT presentation

Number of Views:105
Avg rating:3.0/5.0
Slides: 29
Provided by: BrianFa8
Category:

less

Transcript and Presenter's Notes

Title: 3D Modelling with OpenGL


1
3D Modelling with OpenGL
  • Brian Farrimond
  • Robina Hetherington

2
Schedule
3
Todays class
  • Programming in C
  • Using .NET Visual C
  • Compiling Linking Building a program
  • C programming with OpenGL
  • Computer Graphics
  • A first OpenGL program

4
Programming in C
  • The Hello world program
  • / hello.cpp /
  • include ltstdio.hgt
  • int main()
  • printf(hello, world\n)
  • return 0

5
Programming in C
  • The Hello world program
  • / hello.cpp /
  • include ltstdio.hgt
  • int main()
  • printf(hello, world\n)
  • return 0

6
Programming in C
  • The Hello world program
  • / hello.cpp /
  • include ltstdio.hgt
  • int main()
  • printf(hello, world\n)
  • return 0

Include information about the standard library
7
Programming in C
  • The Hello world program
  • / hello.cpp /
  • include ltstdio.hgt
  • int main()
  • printf(hello, world\n)
  • return 0

A C function. Its name is main
A C program consists of a collection of functions
8
Programming in C
  • A C function consists of
  • a header line
  • a body made up of statements enclosed by and
  • The Hello world program
  • / hello.cpp /
  • include ltstdio.hgt
  • int main()
  • printf(hello, world\n)
  • return 0

9
Programming in C
  • The Hello world program
  • / hello.cpp /
  • include ltstdio.hgt
  • int main()
  • printf(hello, world\n)
  • return 0

10
Programming in C
  • The Hello world program
  • / hello.cpp /
  • include ltstdio.hgt
  • int main()
  • printf(hello, world\n)
  • return 0

This is where the program actually starts.
11
Programming in C
  • The Hello world program
  • / hello.cpp /
  • include ltstdio.hgt
  • int main()
  • printf(hello, world\n)
  • return 0

Every C program has a main function
12
Programming in C
  • The Hello world program
  • / hello.cpp /
  • include ltstdio.hgt
  • int main()
  • printf(hello, world\n)
  • return 0

printf is a library function to print characters
13
Programming in C
  • The Hello world program
  • / hello.cpp /
  • include ltstdio.hgt
  • int main()
  • printf(hello, world\n)
  • return 0

Return from the main function i.e. end the
program
14
.NET Visual C
  • Microsofts C programming environment
  • Program code is placed inside a .NET project
  • .NET builds the program (or application) with
    this project
  • We shall build a console application (as opposed
    to a Windows application)

15
Using .NET
  • Copy the folder
  • dotNetExamples\hello
  • from the CD to your disc space
  • Launch .NET
  • Open the hello project using File Open and
    navigate to hello.sln inside the hello folder

16
Exploring the hello project
  • Solution tree

17
Exploring the hello project
  • Solution tree
  • Double click on hello.cpp to see the program code

18
Hello.cpp
19
Building the program
  • To build the program, select the menu item
  • Build Build Solution

20
Running the program
  • To run the program, select menu item
  • Debug Start

Or use this button
21
Use of getchar()
  • Without getchar() the program terminates at once
    before we can see what printf has done
  • getchar() pauses the program until we press the
    return key.

22
Exercises
  • Modify the text inside the printf statement
  • Modify the program so that it prints out
  • One
  • Two
  • Three

23
Building Compiling linking
  • Building is a two stage process
  • Compiling source code into object code
  • Linking object code and library code to produce
    the program (known as the executable)

24
More on Building
  • See using dotNET IDE in C page 16

25
Separate compilation
  • Large programs are made up of many source files
  • Each file compiled separately
  • Advantages
  • Changing the code of one file does not require
    recompiling the entire program
  • Team of programmers can work on different files

26
Multifile example
27
The multifile .NET project
  • Copy the folder
  • dotNetExamples\multifile
  • from the CD to your disc space
  • Open the project using
  • File Open
  • Examine the solution tree

28
The multifile .NET project
  • Build and run the program
  • Edit func2.cpp so that it prints out
  • This is the new func 2
  • Rebuild and rerun the program
Write a Comment
User Comments (0)
About PowerShow.com