2010-06-27 5 views
1
다음과 같이 내가 시도

는 (Google 검색을 통해 얻었다) -iPhone OS에서 OpenGL ES를 사용하여 일련의 줄을 그릴 수 있습니까?

static const GLfloat vertices[] = 
{ 
    0.0, 0.0, 
    250.0, 280.0,   
    250.0, 280.0, 
    250.0, 500.0, 
    250.0, 500.0, 
    350.0, 500.0, 
    350.0, 500.0, 
    250.0, 280.0 
}; 

static const GLubyte squareColors[] = { 
    255, 255, 255, 255, 
    255, 255, 255, 255 
}; 

glDisable(GL_TEXTURE_2D); 
BOOL colorArrayEnabled = glIsEnabled(GL_COLOR_ARRAY); 
if (!colorArrayEnabled) { 
    glEnableClientState(GL_COLOR_ARRAY); 
} 

BOOL vertexArrayEnabled = glIsEnabled(GL_VERTEX_ARRAY); 
if (!vertexArrayEnabled) { 
    glEnableClientState(GL_VERTEX_ARRAY); 
} 

glLineWidth(16.0f); 
glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors); 
glVertexPointer(2, GL_FLOAT, sizeof(GLfloat)*2, vertices); 
glDrawArrays(GL_LINES, 0, 2); 


if (!vertexArrayEnabled) { 
    glDisableClientState(GL_VERTEX_ARRAY); 
} 

if (!colorArrayEnabled) { 
    glDisableClientState(GL_COLOR_ARRAY); 
} 
glEnable(GL_TEXTURE_2D); 

을 참고 : 나는 아이폰 프로그래밍에서 선발입니다.

+0

어떻게 투영 매트릭스를 설정 했습니까? – ognian

답변

-1

Blender에서 선을 그리고 Wavefront OBJ 파일을 내 보냅니다. 이 파일을 OpenGLOBJLoader 클래스와 함께 사용하십시오. 그 후에 원하는 경우 OBJ 파일의 정점을 편집 할 수 있습니다.

관련 문제