Developing Graphics Program
with UWBGL Essentials of Interactive Computer Graphics: Concepts and
Implementation |
Working with (or Modifying) UWBGL:
Question:
Where/What are the headers files I should use for working with
UWBGL and where are these files included in the given tutorials? Answer:
All the tutorials from Chapter 6 on are based on two libraries:
UWBGL_MFC_Lib and versions of UWBGL_D3D_Lib. The header files for these:
These two files are included at the end of the pre-compile
header file: “StdAfx.h” in
each tutorial projects. |
Question:
I have added a new class (with new .cpp and .h files) into the
UWBGL library, and the library compiles with no errors. However, the compiler
complains about undefined symbol when I try to instantiate an object based on
my class. What is going on? Answer:
You need to add the header file of your new class into the
library header file. In Visual Studio, go to the library project (for
example, if you are working with library version 5: Lib5):
You need to add the header file of your new class into this
file. |
Drawing with
DrawHelper:
Question:
I want to coordinate drawing between WindowHandler and my Model,
so in my WindowHandler:
And in my Model:
Why is it I cannot see any of the transformations performed in
by DrawGraphics() function? Answer: DrawHelper class uses a local instance of MatrixStack to keep track of world transformation. Each separate instance of DrawHelp has its own matrix stack. In this case, there are two separate and independent instances of DrawHelper (the red and the green ones), and there are two independent matrix stacks! Solution: Declare a DrawHelper in the Model. In the above case, make sure both WindowHandler and Model both uses this same instance for setting up matrix. In general: if a sequence of operations are sharing the same transformation results then they should share the same DrawHelper. |
General:
Question:
Should I use math3d++ (e.g., vec3) or the D3D library (e.g.,
D3DXVECTOR3D)? Answer: Either one will do, UWBGL uses math3d++ simply because we must support both D3D and OGL. In general, the tutorials try to use math3d++. The important thing is to use a math library whenever possible. It greatly simplifies your code and makes your program much easier to understand. |
This material is based upon work supported
by the National Science Foundation under Grant No. 0442420. Any
opinions, findings, and conclusions or recommendations expressed in this
material are those of the author(s) and do not necessarily reflect the views
of the Nation Science Foundation. |
The refinement of this course material is
supported by a grant from Microsoft Research under the Computer Gaming
Curriculum in Computer Science RFP, Award Number 15871. |
Kelvin Sung | Kelvin
Research Page | CSS
Home | UW
Bothell | UW
Seattle
|
|
|