Hello,
This is my code
#include <stdio.h>
#include <GL/glu.h>
#include <GL/gl.h>
#include <GL/freeglut.h>
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,1.0,1.0);
static GLint vertices[]={200.0,350.0,0.0,
230.0,300.0,0.0,
200.0,250.0,0.0,
170.0,300.0,0.0,
230.0,200.0,0.0,
200.0,150.0,0.0,
170.0,200.0,0.0,
250.0,280.0,0.0,
300.0,250.0,0.0,
250.0,220.0,0.0,
150.0,280.0,0.0,
100.0,250.0,0.0,
150.0,220.0,0.0};
static GLuint index1[]={0,1,2,3};
static GLuint index2[]={2,4,5,6};
static GLuint index3[]={2,7,8,9};
static GLuint index4[]={2,10,11,12};
static GLuint* indices[4]={index1,index2,index3,index4};
GLsizei count[]={4,4,4,4};
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3,GL_INT,0,vertices);
glDrawRangeElements(GL_QUADS,1,3,12,GL_UNSIGNED_INT,indices);
glFlush();
}
void reshape(int w,int h)
{
glViewport(0,0,(GLsizei)w,(GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,(GLdouble)w,0.0,(GLdouble)h);
}
void init()
{
glClearColor(0.0,0.0,0.0,0.0);
glShadeModel(GL_FLAT);
/* glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0,1.0,0.0,1.0,1-1.0,1.0);*/
}
int main(int argc,char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(600,600);
glutInitWindowPosition(100,100);
glutCreateWindow("hello");
init();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}
I am getting a blank screen when i run the code. Where is the mistake? Thanks in advance
-swetha