Shared Flashcard Set

Details

OpenGL
Test1 2D objects
22
Computer Science
Undergraduate 2
02/21/2012

Additional Computer Science Flashcards

 


 

Cards

Term
glClear(GL_COLOR_BUFFER_BIT);
Definition
clears color buffer-a region of memory where the image to be drawn is stored (usually on graphics card)
Term
glColor3f(0,0,0);
Definition
defines the color of the object about to be drawn. In RGB color and using numbers 0-1
Term
glRectf(-1,1,1,-1);
Definition
Draws a retangle using two points
Term
glPointSize(4);
Definition
defines the size of points that are to be drawn. This one indicates that each point will contain four pixels and creates a 2x2 box. (Note: does not really create circular points. For example if you declared the point size to be 10, it will create a 5x5 box)
Term
glBegin(x*****);
a***;
b***;
glEnd();
Definition
Will draw a polygon, triangle, points, lines, etc. when you put the correct words in x*****;
a*** sometimes declares what color the following will be drawn with using glColor3f() or glColor3ub();
b*** usually is glVertex2f(x,y) to tell the program exactly where the points of the vertex of the object is
Term
glVertex2f(a,b);
Definition
a and b correspond to x and y coordinates. It will declare a point exactly at a,b for whatever function you are using.
Term
glFlush();
Definition
forces previously buffered OpenGL commands to execute. Often used in void functions the user creates and not in main();
Term
glutInit(&argc, argv);
Definition
(used in int main() ) inits the open GL utility library so that its functions can be used by the program
Term
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
Definition
(used in int main() )
requests single buffering and RGB display mode so that colors are displayed
Term
glutWindowSize(600,600);
Definition
(used in int main() )
sets the display window size to 600 in horiz and 600 in vertical
Term
glutInitWindowPosition(50,50);
Definition
(used in int main() )
sets window position with upper left hand corner at (250, 100);

if changed to (500,50) it will move to the right in the screen
if changed to (50,500) it will move down the screen
Term
glutCreateWindow("Blah");
Definition
(used in int main() )
creates the 600 x 600 pixel window on the screen. Also titles it "Blah"
Term
glClearColor(1.0,1.0,0.0,0.0)
Definition
(used in int main() )
In this case it sets the background color to yellow. the values relate to (R,G,B,opacity). Opacity also means the transparency of the background color.
Term
glutDisplayFunc(myDisplay);
Definition
(used in int main() )
indicates the function ("myDisplay") to be called each time the window is drawn. (myDisplay is usually a user created function)
Term
glutMainLoop();
Definition
(used in int main() )
causes the program to enter an event processing loop (a loop that executes as long as the window is on the screen)
Term
gluOrtho2D(XWL,XWR,YWBot,YWTop);
Definition
function to define world space clipping window with X width and Y height. Used in user created function.
Only needs to be defined in myDisplay func. It does not need anything else in int main()
Term
glLineWidth(3.0);
Definition
Sets line width to 3.0
generally used in user created functions
Term
Clipping Windows
Definition
Used to change to view of the window to a different part. Say the window originally shows 0 to 5 on the x and 0 to 5 on the y. You can change the window to different specifications such as -5 to 5 for both x and y
Term
glLoadIdentity();
Definition
generate an identity matrix for use in developing a world-to-viewpoint transform matrix
used in user created function (myDisplay)
Term
glutPostRedisplay();
Definition
forces display function to be called
user created function (ex. myKeybdFun or used when using the function to enable zooming)
Term
glutKeyboardFunc(myKeyFunc);
Definition
sets keyboard callback for the current window
used in int main()
Term
what are the parameters for the void myKeyFunc(a,b,c)?
Definition
a = unsigned char k;
b = int xx;
c = int yy;
Supporting users have an ad free experience!