Я пытаюсь создать приложение, в котором вы вводите свои координаты, а оно рисует что-то, используя Open GL ES.вот сборщик данных.он берет текст UITextField и создает и массив, а затем отправляет его в мою функцию рисования.
float sq[] = {
[A1.text doubleValue],[B1.text doubleValue],
[A2.text doubleValue], [B2.text doubleValue],
[A3.text doubleValue], [B3.text doubleValue],
};
[renderer render:sq];
вот моя функция рисования.он берет массив, сгенерированный текстовыми полями, и превращает его в форму (не работает)
- (void)render:(float)shape
{// Заменим реализацию этого метода, чтобы сделать ваш собственный рисунок
// Replace the implementation of this method to do your own custom drawing
float squareVertices = shape;
static const GLubyte squareColors[] = {
255, 0, 0, 255,
0, 255, 0, 255,
0, 0, 255, 255,
};
// static float transY = 0.0f;
// This application only creates a single context which is already set current at this point.
// This call is redundant, but needed if dealing with multiple contexts.
[EAGLContext setCurrentContext:context];
// This application only creates a single default framebuffer which is already bound at this point.
// This call is redundant, but needed if dealing with multiple framebuffers.
glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);
glViewport(0, 0, backingWidth, backingHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// glTranslatef (0.0f, (GLfloat) (sinf (transY) /2.0f), 0.0f);// transY + = 0.075f;
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glVertexPointer(2, GL_FLOAT, 0, squareVertices);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
// This application only creates a single color renderbuffer which is already bound at this point.
// This call is redundant, but needed if dealing with multiple renderbuffers.
glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
}