Free OpenGL Computer Graphics Questions and Answers — Questions and Answers
Question 1: What are a 3D transformation matrix's dimensions?
- 3x3 (Correct answer)
- 2x2
- 3x4
- 4x4
Correct answer: 3x3
A 3x3 matrix is the standard size for representing 3D linear transformations like rotation and scaling, since each of the three output coordinates (x, y, z) is a combination of the three input coordinates. A 2x2 matrix only handles 2D, while 4x4 is used when translation is added via homogeneous coordinates and 3x4 is non-square and can't be composed cleanly for these operations.
Question 2: In OpenGL, is it possible to specify the location of a light source?
- Yes (Correct answer)
- No
Correct answer: Yes
Explanation: <br> In OpenGL you can specify the location of a light source using various functions provided by the OpenGL API.
Question 3: How can one revolve about a location other than the origin?
- Rotations can only be performed around the origin
- Translate to origin, rotate about origin, then translate back to original position (Correct answer)
- Perform a glRotate and specify the point to rotate around
Correct answer: Translate to origin, rotate about origin, then translate back to original position
Rotation matrices inherently spin objects around the origin, so to rotate around any other point you translate the object so that point lands on the origin, perform the rotation, then translate back to its original location. The claim that rotations can only happen around the origin is false, and simply specifying a point in glRotate does not change that — glRotate always rotates about the origin along the given axis.
Question 4: What stands for GLUT?
- Opengl utility toolkit (Correct answer)
- Opengl graphics Library
- Opengl utility library toolkit
Correct answer: Opengl utility toolkit
Explanation: <br> GLUT is a library of utility functions for OpenGL programming that simplifies the process of creating windows and handling input events. It provides a set of functions that allow programmers to create windows, menus, and user interfaces for their OpenGL applications, without having to worry about the low-level details of window management and event handling.
Question 5: What is glMaterialf(...) used for?
- Switches to material mode to add visual effects
- Turns material properties on
- Gets the current material properties of a drawn object
- Defines the material properties of a drawn object for visual effects (Correct answer)
Correct answer: Defines the material properties of a drawn object for visual effects
Explanation: <br> The glMaterialf function in OpenGL is used to set a single floating-point value for a specific material property of a drawn object. The material properties defined using this function affect the way that an object interacts with light, and can be used to achieve various visual effects.
Question 6: What makes glColor3d and glColor3f different from one another?
- glColor3d takes double arguments, while glColor3f takes float arguments (Correct answer)
- glColor3d only sets RGB, while glColor3f sets R,G,B and A
- glColor3d is in real space, glColor3f is in integer space
- glColor3d allows 3d color operations, while glColor3f only allows 8-bit
Correct answer: glColor3d takes double arguments, while glColor3f takes float arguments
Explanation: <br> The difference between glColor3d and glColor3f in OpenGL is the data type of the arguments that they take.
Question 7: Which function specifies the vertex's color while illumination is off?
- glColor() (Correct answer)
- glDisplayfunc()
- glClearColor()
- None of These
Correct answer: glColor()
Explanation: <br> When lighting is disabled in OpenGL, the glColor() function is used to specify the color of the vertices. This function sets the current color of the vertices that follow, until a new color is specified using glColor() again.
What are a 3D transformation matrix's dimensions?