main-grtownfaq

Project 4 - Frequently Asked Questions

This page will have answers to Frequently Asked Questions about Project 4, Graphics Town. The page may be updated frequently, so you might want to view it as an BAD LINK.

OK, Maybe these questions aren’t “Frequently Asked” - but they are the questions that people ask.

December 12,2009 by gleicher BAD LINK
**Can the Texture class do transparency?**

The Texture class in GrTown is set up to only load 3 channel (RGB) images. However, internally it converts them to RGBA. It shouldn’t be too hard to modify it to allow 4 channel textures as well - it would mainly involve changing the reader code.

December 9,2009 by gleicher BAD LINK
**glContexts - or why don’t my textures and shaders load?**

If your textures or shaders aren’t loading correctly, the problem might be when you’re doing it, even if you are doing it correctly. This is a common problem.

You can only make calls to OpenGL (for example to initialize a texture or load a shader) once OpenGL is fully initialized and ready to go. Also, once you have OpenGL ready to go, you can only do things if OpenGL knows which window to associate the commands with. This is called “having a GL context.”

So, basically, the only time you can make calls to OpenGL (including loading shaders or textures) is inside of the “draw” method of an FlTk Widget (or the draw methods of your object). If you look at the sample code, you’ll notice that things get initialized the first time draw is called (rather than in the constructor).

December 5,2009 by gleicher BAD LINK
Subtle Bug in the Road System

A very perceptive student found a bug in the road system. On line 197 of Roads.cpp, it used to read:

    } else if (feq(cz,(*r)->az)) {

but it should read

    } else if (feq(cz,(*r)->bz)) {

(note: this is the second identical line - the first block of code does it for the A)

This is a very subtle bug (which is why I didn’t notice it for 9 years), but it could make a difference if you try to connect roads yourself and aren’t getting the desired effect.

December 4,2009 by gleicher BAD LINK
**What does “1 behavior/scenery/texture” per person mean?**

It means that each person makes one of each.

The pedagogical goal is that each person gets to have each of the experiences. So if 1 person does all the scenery and the other does all of the behaviors, it doesn’t meet the goals since there was a person who didn’t experience creating behavior.

November 21,2009 by gleicher BAD LINK
**How do I show off my features?**

The best way to show off a feature is to have an object that really uses the feature well, and make it an interesting location (so you can find it quickly). Make sure that when you look at it (or fly around it), you can see that it really does what its supposed to do.

November 21,2009 by gleicher BAD LINK
**How complicated does “affected by the time of day” need to be in a shader?**

Not very. Just having a light turn on or change color if the time of day is nighttime is fine. But you can do something fancier. (some of this is to see if you can figure out how to pass the time of day to a shader)

November 21,2009 by gleicher BAD LINK
**Would Phong Shading satisfy the lighting requirement for a shader?**

Yes - its actually what I had in mind. It doesn’t have to be the full phong model, or be affected by lots of light sources - but the better the lighting model, the cooler it is.

The simple diffuse shading I showed in class probably counts as lighting, but just barely.

November 21,2009 by gleicher BAD LINK
**Is the practice shader (white and blue stripes) a procedural texture?**

Yup - its a very simple example, but it would count as a procedural texture. If you added lighting to it, that would be a much better procedural shader.

November 21,2009 by gleicher BAD LINK
**What does a “Flat” Texture Mean?**

It means a single texture (for example 1 image), applied to more than 1 triangle where those triangles are not all co-planar.

November 21,2009 by gleicher BAD LINK
**What does “Multiple New Textures” Mean?**

“Multiple New Textures” means that you create more than 1 texture. A texture is (usually) a picture that you texture map onto an object. But, it might mean a procedural texture (that you write a shader for). If you use 2 different pictures, that’s 2 textures.

November 21,2009 by gleicher BAD LINK
**Test Question: Does this Actually work?**

Yes, it does seem that I can answer questions using this!

Page last modified on December 12, 2009, at 04:19 PM