Preview

Computer Graphics Menus

Good Essays
Open Document
Open Document
760 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Computer Graphics Menus
CSC 706 Computer Graphics
• Drawing Polylines Stored in a File
• Parameterizing Figures
• Menus

1

Drawing Polylines
Drawing polyline from vertices in a file





# polylines
# vertices in first polyline
Coordinates of vertices, x y, one pair per line
Repeat last 2 lines as necessary

File for dinosaur available from theWeb site
Code to draw polylines/polygons in Fig.
2.24.
2

Example “dino”

3

Suppose the file dino.dat contains a collection of polylines, in the following format (the comments are not part of the file):
21
4
169 118
174 120
179 124
178 126
5
298 86
304 92
310 104
314 114
314 119
29
32 435
10 439
. . . etc.

number of polylines in the file number of points in the first polyline first point of first polyline second point of first polyline

number of points in the second polyline first point of second polyline

4

Fig. 2.24 A Function for Drawing polylines stored in a File void drawPolyLineFile(char * fileName)
{
fstream inStream; inStream.open(fileName, ios ::in); // open the file if(inStream.fail()) return; glClear(GL_COLOR_BUFFER_BIT); // clear the screen
GLint numpolys, numLines, x ,y; inStream >> numpolys; // read the number of polylines for(int j = 0; j < numpolys; j++) // read each polyline
{
inStream >> numLines; glBegin(GL_LINE_STRIP); // draw the next polyline for (int i = 0; i < numLines; i++)
{
inStream >> x >> y; // read the next x, y pair glVertex2i(x, y);
}
glEnd();
}
glFlush(); inStream.close(); }

5

Parameterizing Figures
Parameterizing Drawings: allows making them different sizes and aspect ratios
Code for a parameterized house is in Fig.
2.27.

6

Parameterizing Figures

7

Drawing a village by calling parameterizedHouse with different parameters

8

Building a Polyline Drawer class GLintPointArray{ const int MAX_NUM = 100; public: int num;
GLintPoint pt[MAX_NUM];
};
void drawPolyLine(GlintPointArray poly, int

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Building 4 (L-Shape) : The points A (3, 8), B (6, 8), C (6, 3), and D (5, 3) need to be transformed to points A’’ (–3, 1), B’’ (–6, 1), C’’ (–6, –4), and D’’ (–5, –4).…

    • 367 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    The double jeopardy claim can be supported by facts in the sense that Falkowsi had entered a plea which was unconditional in nature on November, 1992.The case on October,1992 which stated that the Government had taken action in the property seizure of the illegal marijuana plantation. The civil case was taken up at Fairbanks. Also on the charge of possession of marijuana a criminal case was lodged Anchorage. So Falkowski was tried on the same case both the times and so this was a case of double jeopardy.…

    • 333 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Before starting VBScript Input/Output lab, you should practice using NotePad++ to run and debug VBScript programs.…

    • 2429 Words
    • 10 Pages
    Good Essays
  • Good Essays

    Graphical User Interface

    • 559 Words
    • 3 Pages

    * Ease-of-Use with fast installation: Easy configuration and integration, give developers enough time to focus on application development.…

    • 559 Words
    • 3 Pages
    Good Essays
  • Better Essays

    The purpose of this essay is to detail the steps taken to create the graphics required for…

    • 1054 Words
    • 6 Pages
    Better Essays
  • Satisfactory Essays

    Gpu

    • 314 Words
    • 2 Pages

    A few years ago all graphics hardware used a fixed pipeline. Where each vertex and triangle description was passed through pre-programmed components to generate the image on the screen.…

    • 314 Words
    • 2 Pages
    Satisfactory Essays
  • Better Essays

    Input Controls

    • 1669 Words
    • 7 Pages

    There are many kinds of input controls. Write a 4-5 page paper in which you:…

    • 1669 Words
    • 7 Pages
    Better Essays
  • Good Essays

    Graphics

    • 607 Words
    • 3 Pages

    Sketches of ideas and designs are the initial ideas of a product or object. They are very quick sketches to show shape and form. Annotations around the sketch help to explain how the design works. Sketching Enhancement There are many ways of enhancing your sketches these include: Thick & Thin line – the outline of a sketch is ‘lined-in’ to make the shape stand out. Tonal Shading – the use of light and dark shading to create the illusion of 3D. Colour – used to make sketches stand out and attract attention to important features. Texture & Material representation – different materials can be represented by adding effects to the sketch. Grids & Underlays - Grids and underlays are used to support and enhance different drawing skills. There are different types including letter grids, isometric grids, number grids and orthographic grids. Understanding colour – understand the meanings of colours, tones and hues, colour separation and fusion.…

    • 607 Words
    • 3 Pages
    Good Essays
  • Better Essays

    Michael Spahr born on March 19, 1973 in Bern, Switzerland is a very creative artist whom specializes in video art. The art form of video art has not really been around that long it was first introduced in the 60’s and 70’s and has evolved with technology. Mr. Spahr is really great with creativity and grew very fond of video art and has produced many works using this new form of art. Leonardo Davinci is one of the most famous artists of all time born in Vinci, Italy April 15, 1452 he has created some of the most famous paintings ever. Davinci is considered to be a genius in many circles, he was way more than just an artist, but his artwork is genuinely astounding. These two artists have very little in common when it comes to the way they produced their art work but they do have a…

    • 1261 Words
    • 6 Pages
    Better Essays
  • Good Essays

    Graphic Design

    • 913 Words
    • 4 Pages

    One of the earliest forms of Graphic Design is said to have been cave paintings from the South of France. They depict various animals and are said to have been made in 30,000BC. The history of writing appeared in 4000BC and with the history of these cave and rock designs the foundation of Graphic Art was created.…

    • 913 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    The programmer said to his son: "Here, I brought you a new basketball." "Thank you, daddy, but where is the user's guide?" (www.jokes.net) This is just a joke, but with that it is clear that nowadays technology is rapidly progressing and we are forgetting simple things. Is is good or bad? It depends on which way we would look at this... New technology has had a great impact on the field of Graphic Design because of printers and scanners, Internet and designing programs.…

    • 481 Words
    • 2 Pages
    Satisfactory Essays
  • Better Essays

    Input Controls

    • 1227 Words
    • 5 Pages

    2. Teeling, M. (2012, May 14). What is data integrity? learn how to ensure database data integrity via checks, tests, & best practices. Retrieved fromhttp://www.veracode.com/blog/2012/05/what-is-data-integrity/…

    • 1227 Words
    • 5 Pages
    Better Essays
  • Better Essays

    Input Controls

    • 1473 Words
    • 6 Pages

    When we talk about input controls, what are we really talking about? Input control includes the necessary measures to ensure that data is correct, complete, and secure. A system analyst must focus on input control during every phrase of input design, starting with source documents that promote data accuracy and quality. (Shelly & Rosenblatt, (2012)). Input controls can help the flow of data in a database to be the same format and easy to understand. Without input controls there can be data integrity errors that could occur and cause information to be incorrect in the database. There are advantages and disadvantages to restricting user interfaces to limit a person ability of typing in too much information or maybe not enough information.…

    • 1473 Words
    • 6 Pages
    Better Essays
  • Good Essays

    7/31/2014 Objectives • • Chapter 5 • • • Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures McGraw-Hill 5-2 Copyr ight © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.…

    • 1542 Words
    • 16 Pages
    Good Essays
  • Better Essays

    Visual Programming

    • 3044 Words
    • 13 Pages

    MDI (Multiple Document Interface) and SDI (Single Document Interface) are different interface designs meant to handle documents within a single application. MDI allows an application to contain child windows per document, while SDI enforces one document per window.…

    • 3044 Words
    • 13 Pages
    Better Essays