당신은 정점 1 좌표를지도하는 투사 설정할 수 있습니다 픽셀에 1 좌표 :
glViewport(0, 0, window_width, window_height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, window_width, 0, window_height, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
정점 X에 여기에서, Y 좌표는 왼쪽 하단 모서리에있는 원점 픽셀에 있습니다. 이론 상으로는 GL_POINT 프리미티브와 함께 즉석 모드를 사용할 수 있습니다. 하지만 일괄 처리하는 것이 훨씬 더 좋은 생각입니다. ...
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
/* Those next two calls don't copy the data, they set a pointer, so vertices must not be deallocated, as long OpenGL points to it! */
glVertexPointer(2, GL_FLOAT, sizeof(Vertex), &vertices[0].x);
glColorPointer(3, GL_FLOAT, sizeof(Vertex), &vertices[0].red);
을
struct Vertex
{
GLfloat x,y,red,green,blue;
};
std::vector<Vertex> vertices;
/* fill the vertices vector */
이 당신이 할 수있는 OpenGL을 지점을 ... 그리고 그것을 액세스 할 수와 함께 모든 것을 그릴 대신 각 지점을 보내는 indivisually 그릴하고자하는 모든 포인트의 배열을 만들 단일 호출 :
glDrawArrays(GL_POINTS, 0, vertices.size();
그런데 OpenGL 1.0이 가장 기본적인 것처럼 들리지만 실제로 OpenGL 1.1은 가장 일반적인 공통 분모입니다. 적어도 1.1 이상을 지원하지 않는 플랫폼을 본 적이 없습니다 (소프트웨어에서도 가능). In 1.0 텍스처 오브젝트와 정점 배열이 없습니다. –
괜찮아, tnx 많이 알았어. –