1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mr Goodwill [35]
3 years ago
6

Write a program in C/C++ to draw the following points: (0.0,0.0), (20.0,0.0), (20.0,20.0), (0.0,20.0) and (10.0,25.0). For this

purpose, you may use the GL_POINTS primitive.Write a program in C/C++ to draw the following points: (0.0,0.0), (20.0,0.0), (20.0,20.0), (0.0,20.0) and (10.0,25.0). For this purpose, you may use the GL_POINTS primitive.​
Computers and Technology
1 answer:
Fed [463]3 years ago
6 0

Introductory program; just a static picture of a colored triangle.
Shows how to use GLUT.
Has minimal structure: only main() and a display callback.
Uses only the default viewing parameters (in fact, it never mentions viewing at all). This is an orthographic view volume with bounds of -1..1 in all three dimensions.
Draws only using glColor and glVertex within glBegin and glEnd in the display callback.
Uses only the GL_POLYGON drawing mode.
Illustrates glClear and glFlush.
triangle.cpp
// A simple introductory program; its main window contains a static picture
// of a triangle, whose three vertices are red, green and blue. The program
// illustrates viewing with default viewing parameters only.

#ifdef __APPLE_CC__
#include
#else
#include
#endif

// Clears the current window and draws a triangle.
void display() {

// Set every pixel in the frame buffer to the current clear color.
glClear(GL_COLOR_BUFFER_BIT);

// Drawing is done by specifying a sequence of vertices. The way these
// vertices are connected (or not connected) depends on the argument to
// glBegin. GL_POLYGON constructs a filled polygon.
glBegin(GL_POLYGON);
glColor3f(1, 0, 0); glVertex3f(-0.6, -0.75, 0.5);
glColor3f(0, 1, 0); glVertex3f(0.6, -0.75, 0);
glColor3f(0, 0, 1); glVertex3f(0, 0.75, 0);
glEnd();

// Flush drawing command buffer to make drawing happen as soon as possible.
glFlush();
}

// Initializes GLUT, the display mode, and main window; registers callbacks;
// enters the main event loop.
int main(int argc, char** argv) {

// Use a single buffered window in RGB mode (as opposed to a double-buffered
// window or color-index mode).
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);

// Position window at (80,80)-(480,380) and give it a title.
glutInitWindowPosition(80, 80);
glutInitWindowSize(400, 300);
glutCreateWindow("A Simple Triangle");

// Tell GLUT that whenever the main window needs to be repainted that it
// should call the function display().
glutDisplayFunc(display);

// Tell GLUT to start reading and processing events. This function
// never returns; the program only exits when the user closes the main
// window or kills the process.
glutMainLoop();
}
You might be interested in
A(n) ____ address is an assigned series of numbers, separated by periods, that designate an address on the Internet.
schepotkina [342]

Answer: An <em>IP</em> address is commonly referred to as an accredited series of numbers, disjointed by periods, this eventually provides an address on web. In laymen terms, an IP address is commonly known as a numerical label accredited to a device that is connected to a network which uses the IP for communication.

6 0
3 years ago
Is all binary signaling digital give resistance to error?
AfilCa [17]
Digital signals (usually binary coded) can include extra information that can be used for error detection or even correction. This allows recovery of the original signal, either by requesting retransmission or by directly correcting the error. 

<span>analog signals can't include any extra information needed for this purpose. it is impossible to distinguish an error from the original data.

cited:</span>http://www.answers.com/Q/Which_has_greater_resistance_to_transmission_errors_Binary_signaling_or_Ana...
8 0
3 years ago
What are the tools which are used by search engine ? explain them? ​
bagirrra123 [75]
Java script and python for the UK
4 0
3 years ago
If x has a value of 7 and y has a value of 20, what is displayed as a result of executing the code segment
Llana [10]

<em>6.65 </em><em>is displayed as the</em><em> output </em><em>of the </em><em>block of code</em>

<em />

In python programming, * denotes multiplication. To get the output, we will substitute the value of x and y given into the result to have;

<em> result = x * y - x / (y)</em>

<em> result = 7 * 20 - 7 / (20)</em>

<em> result = 140 - 7 / (20)</em>

<em> result = 133/20</em>

<em> result = 6.65</em>

<em />

<em>This shows that </em><em>6.65 </em><em>is displayed as the</em><em> output </em><em>of the </em><em>block of code</em>

<em />

The question is incomplete;

Let the code segment be

<em>>>> x = 7 </em>

<em>>>> y = 20   </em>

<em>>>> result = x * y - x / (y) </em>

<em>>>> result  </em>

<em>output:__?</em>

<em />

Learn more here: brainly.com/question/24240957

5 0
3 years ago
When is using the Transmission Control Protocol (TCP) most appropriate?
Elodia [21]

Answer:

TCP is typically used when you need a connection-oriented, reliable communication channel.

Most internet protocols (like HTTP, POP, MQTT, ...) have TCP as their underlying protocol.

Only when speed is important and it is acceptable to lose some of the data, you would consider simpler protocols like UDP.

7 0
3 years ago
Other questions:
  • The organization of logistics activities within a firm depends on a number of factors, including the number and location of cust
    10·1 answer
  • What Is the output of the following: =OR (5 &lt;7, 16*Rand ()&gt;23,FALSE)
    5·1 answer
  • Which type of movement lets the player control an object's movement?
    5·1 answer
  • The destination ip address is 164.109.27.233 subnet mask of 255.255.192.0 network address is
    12·1 answer
  • What is the line tool used for in photoshop
    6·1 answer
  • True or False: the sky looks blue because it is reflecting the blue ocean.​
    12·2 answers
  • Which property do you use to align an element horizontally with the left or right edge of its parent element?
    6·1 answer
  • Which situation is the best choice for using telehealth?
    12·1 answer
  • The ______ Works on a single variable or constant. *​
    8·1 answer
  • A web server on your network hosts your company's public website. You want to make sure that an NIC failure doesn't prevent the
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!