CS602 Assignment 3 Solution and Discussion
-
Re: CS602 Assignment 3 Solution and Discussion
Total Marks = [20]
Assignment No. 03
Semester: Fall 2020
Computer Graphics – CS602
Total Marks: 20Due Date:
February 08, 2020Objectives:
Objective of this assignment is to assess the understanding of students about
the concepts of Open GL programming in computer graphics.
Instructions:
Please read the following instructions carefully before submitting assignment:- You should consult the recommended books, PowerPoint slides and audio lectures to clarify your concepts.
- You are supposed to submit your assignment in .doc format. Any other formats like scan images, PDF, ZIP, RAR and BMP etc, will not be accepted.
- It should be clear that your assignment will not get any credit if:
• The assignment is submitted after the due date.
• The assignment is copied from the Internet or any other student.
• The submitted assignment does not open or file is corrupt.
Note: No assignment will be accepted after the due date through email in any case (load shedding, server down, internet malfunctioning etc.).
It is recommended to upload solution file at least two days before its closing date.
For any query about the assignment, contact at [email protected]
Question Statement Marks=15
Question # 1:
Write a program using Open GL Programming to create a window as shown in the below image. The title of window should be your Student Id and your Name. You can fill the window area with any color.
Hint: Initialize the GLFW and GLEW libraries using the commands glfwInit() and glewInit() respectively.
Question # 2:
What are the Open GL Buffers and how can you create and allocate these buffers. Discuss with an example.Note: Only write the statement of creation and allocation. No need to write the complete program.
BEST OF LUCK -
@wafa-sehar said in CS602 Assignment 3 Solution and Discussion:
Question # 2:
What are the Open GL Buffers and how can you create and allocate these buffers. Discuss with an example.Nearly everything you may ever do with OpenGL will involve buffers full of data. Buffers in
OpenGL are depicted as buffer objects. As with several things in OpenGL, buffer objects are
named using GLuint values. Values are stored using the glGenBuffers () command.
Example: void glGenBuffers(GLsizei n, GLuint *buffers);
After calling glGenBuffers(),you will have an array of buffer object names in buffers, but at this
time, they’re simply placeholders. They’re not really buffer objects yet. The buffer objects
themselves don’t seem to be really created till the name is first sure to one of the buffer binding
points on the context. this can be important as a result of OpenGL could build choices regarding
the most effective way to assign memory for the buffer object based on where it’s bound. -
@zaasmi said in CS602 Assignment 3 Solution and Discussion:
Write a program using Open GL Programming to create a window as shown in the below image. The title of window should be your Student Id and your Name. You can fill the window area with any color.
#include <GL/glew.h> #include <GLFW/glfw3.h> int main() { GLFWwindow* window; if (!glfwInit()) { return -1; } window = glfwCreateWindow(400, 300, "BC123456789 Name", NULL, NULL); if (!window) { glfwTerminate(); return -1; } glfwMakeContextCurrent(window); glViewport(0, 0, 800, 800); glClearColor(30, 20, 40, 0); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); while (!glfwWindowShouldClose(window)) { glClearColor(30, 40, 0, 0); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); glfwPollEvents(); } glfwTerminate(); }



100% Off on Your FEE Join US! Ask Me How?


