Nothing is visible

Here is code which is not displaying I would like to render the vertices described below.

Where is the problem

 
#include <GL/glut.h>
#include <GL/gl.h>

static float v[6][3] = { {-1.0f,0.0f,2.0f},
				{1.0f,0.0f,2.0f},
				{-1.0f,0.0f,-2.0f},
				{0.0f,2.0f,1.0f},
				{0.0f,3.0f,-1.0f},
				{0.0f,3.0f,2.0f},
};


void init()
{
	glShadeModel(GL_FLAT);
	glClearColor(1.0f,1.0f,1.0f,1.0f);
}

void reshape(int w,int h)
{
	glViewport(0,0,w,h);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	//gluPerspective(45, 1, 1, 10000);
	gluOrtho2D(0.0,(GLdouble)w,0,0,(GLdouble)h);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}

void display()
{
	glClear(GL_COLOR_BUFFER_BIT);
	//gluLookAt(0.0f,0.0f,5.0f,0.0f,0.0f,0.0f,0.0f,1.0f,0.0f);
	glBegin(GL_POINTS);
	for(int i=0;i<6;i++)
	{
			glVertex3dv(&v[i]);
	}
	glEnd();
	glFlush();
	
}


int main(int argc,char **argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowSize(700, 700);
	glutInitWindowPosition(0, 0);
	glutCreateWindow("glCloth");
	init();
	glutReshapeFunc(reshape);
	glutDisplayFunc(display);
	glutMainLoop();

	return (0);


}

 

Hi !

Two problems.

You use gluOrtho2D, this will set the clipping planes to -1 and 1, and as you are using 2 and -2 for most of your vertices a lot will be clipped away.

The second thing is that you map the view to the width and height of the window, this means that your vertices span is 2-4 pixels, this is very small so there is a bug change that you will not see much at all just because of that.

Mikael