Hi,
As per my understanding, reshape function of GLUT is used to adjust your drawing when the window is resized, is that a mandatory requirement for every drawing. When I tried the below code, it didnt gave me any output. I wasnt sure what the problem was, I was trying to learn a sample from one book, I then copied the reshape function and it started working fine. I am not sure why this was happening. Pls help, the below is the code which I tried to run with out reshape function
#include <stdlib.h>
#include <GLUT/glut.h>
#include <math.h>
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(1, 1, 0);
glPointSize(1.0);
glBegin(GL_POINTS);
glVertex3f(10.0f, 10.0f, 0.0f);
glVertex3f(20.0f, 10.0f, 0.0f);
glVertex3f(30.0f, 10.0f, 0.0f);
glVertex3f(40.0f, 10.0f, 0.0f);
glVertex3f(50.0f, 10.0f, 0.0f);
glVertex3f(60.0f, 10.0f, 0.0f);
glEnd();
glutSwapBuffers();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowPosition(0,0);
glutInitWindowSize(640, 480);
glutCreateWindow("GLUT Program");
glutDisplayFunc(display);
glutMainLoop();
return EXIT_SUCCESS;
}
-anoop