OpenGL Code
OpenGL Code
void display() {
glClear(GL_COLOR_BUFFER_BIT); // Clear the color buffer
glBegin(GL_POINTS);
glColor3f(1.0f, 0.0f, 0.0f); // Point color (red)
glVertex2f(0.0f, 0.0f); // Point position
glEnd();
return 0;
}
Write open GL code to draw line starting from (-1, -1) to (3,4)
#include <GL/glut.h> // Include the GLUT library
void display()
{
glClear(GL_COLOR_BUFFER_BIT); // Clear the color buffer
glColor3f(1.0f, 0.0f, 0.0f); // Set the line color to red