창 공간에서 직접 그릴 수 있도록하려면 가장 쉬운 방법은 모델 뷰와 프로젝션을 단위 행렬로 일시적으로로드하고 필요한 위치로 GL_POINT
을 그립니다. 그래서 그것은 다음과 같을 것입니다 :
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
// draw the point here; specifics depending on whether you
// favour VBOs, VBAs, etc
// e.g. (assuming you don't have any client state enabled
// on entry and don't care about leaving the vertex array
// enabled on exit)
GLfloat vertexLocation[] = {0.0f, 0.0f, -1.0f};
glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertexLocation);
glDrawArrays(GL_POINTS, 0, 1);
// end of example to plot a GL_POINT
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
// and possibly restore yourself to some other matrix mode
// if, atypically, the rest of your code doesn't assume modelview
0,0, -1에 포인트를 그리는 방법을 모르겠습니까? 코드를 추가 할 수 있습니까? – NullPointerException
몇 가지 코드를 추가했지만 질문을 다시 읽으면서 내가 묻는 내용을 오해했을 수도 있습니다. 3D 세계에서 (0, 0, -1) 위치를 원하십니까? 카메라를 가지고 이동했거나 눈 영역에 직접 올리면 영향을 받습니까? – Tommy
GLfloat가 종료되지 않습니다. android : S 무엇을 사용해야합니까? – NullPointerException