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
Create an array of 7 words,named "temperatures"containing daily temperatures for a week. Temperatures can be positive or negativ
zepelin [54]

Answer:

// program in C++.

// headres

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // array

   int temperatures[7];

   // count variable

   int count=0;

   cout<<"Enter the temperature of all days:";

   for(int a=0;a<7;a++)

   {

       // read temperature of 7 days

       cin>>temperatures[a];

       // find temperature is extreme or not

       if(temperatures[a]<-10||temperatures[a]>25)

       // count

       count++;

   }

   // print count of extreme temperature

   cout<<"number of days of extreme temperature:"<<count<<endl;

return 0;

}

Explanation:

Create an array of size 7 to store the temperature of all days of week.Read the temperature of each day.If the temperature is less than -10 or greater than 25 then increment the count.This will count the number of days of extreme temperature.Print  the count.

Output:

Enter the temperature of all days:-20 12 18 30 32 -15 15                                                                  

number of days of extreme temperature:4

3 0
3 years ago
What is the least effective way to create balance and flow in your life?
ratelena [41]
<span>Act on your emotions in the moment instead of thinking about them. </span>
6 0
3 years ago
Question: How does Brainly's ban system work?
Dima020 [189]

Answer: well usually when you get banned on here it because someone reported your question or answer or something

Explanation:

4 0
3 years ago
Read 2 more answers
When typing using the number row, your ___________________ is the proper finger to key the "6" key.
bazaltina [42]

Answer:

your left pointer finger

Explanation:

6 0
3 years ago
Read 2 more answers
What is “public domain” and how is it used?
Paraphin [41]

Public Domain refers to creative materials that are not protected by laws such as copy right. Public Domain in used by lots of people

7 0
3 years ago
Other questions:
  • Isaac is researching Abraham Lincoln’s life for a social studies report. He finds an encyclopedia that includes original letters
    5·2 answers
  • What cell address indicates the intersection of the first row and the first column in a worksheet?
    15·2 answers
  • With arbitrary code execution, the ________________ launches ("spawns") a command shell from which instructions can then be issu
    11·1 answer
  • What are some of the causes for error 1921 when updating?
    11·2 answers
  • Which computer company was named after an orchard? dell, apple, or ibm
    11·1 answer
  • Write a class Example() such that it has a method that gives the difference between the size of strings when the '-' (subtractio
    6·1 answer
  • Marco had a database that showed the first, second, and third favorite ice cream flavors for each person in his school. He used
    11·2 answers
  • '|'/2`/ '|'[] |)[-([]|)[- '|'#!$
    9·1 answer
  • What spreadsheet tool could be used to add together the numbers in a<br> selected group of cells?
    10·1 answer
  • How might a company gain followers on Twitter?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!