Week 10 Tutorial

Question 1

a) Use Bresenham's algorithm to draw a line from P(3,3) to Q(10,5). Repeat for the line (3,3) to (9,6)

b) Consider the symmetrical problem of drawing for Q to P. What changes do you need to make to the algorithm to guarantee you get the same set of pixels?

Question 2

Consider the scan line algorithm described in class. For the polygon drawn here, what does the edge list look like? What does the Active Edge List (AEL) look like just before filling the pixels on scan line 5? What pixels will be filled?

Question 3:

Suppose you are interested in implementing a particle system to represent a fire. How would your particles evolve over time? What variables would you want to change? How would their values change over time?

Question 4:

In the assignment specification it says for the particle system "For the full marks this would need to include alpha blended billboarded particles, creation and destruction ,some kind of evolution over time (position, size, colour, as is appropriate for your kind of particles)."

Discuss what alpha blended billboarded particles are.

What are some issues that may arise when implementing blending in opengl? What are some ways these issues can be overcome?

Question 5:

Suppose we had the following vertex shader
out vec2 texCoord;

void main (void) {	
  
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;	
	gl_FrontColor = gl_Color;	
	texCoord= vec2(gl_MultiTexCoord0);
}
And suppose we had executed the following command in our jogl program
texUnitLoc = gl.glGetUniformLocation(shaderprogram,"texUnit");
gl.glUniform1i(texUnitLoc , 0);

Assignment Use any left over time to discuss the assignment with your tutor