Hi everyone
I’ve been trying to write apps recently for the phone that use openGL, without using the usual tutorials for native iphone development that can be found on the web- that set up the EAGLView etc. I wanted to use the standard oF iphone template of setup, update and draw. I have tried to start simple but I am having trouble drawing much to the screen. Has anyone got any, even short, examples of the necessary context setting, shape drawing using openGL ES? For instance, the following should draw a simple shape to screen- but the screen stays stubbornly black…
//--------------------------------------------------------------
void testApp::setup(){
// register touch events
ofxRegisterMultitouch(this);
// initialize the accelerometer
ofxAccelerometer.setup();
//iPhoneAlerts will be sent to this.
ofxiPhoneAlerts.addListener(this);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
//glViewport( 0, 0, backingWidth, backingHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(left, right, bottom, top, near, far);
//glRotatef(30.0f, 1.0, 1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
}
and in the draw loop…
//--------------------------------------------------------------
void testApp::draw() {
// nucleus
glColor4f ( 0.5f, 0.0f, 0.0f, 1.0f );
glTranslatef( 0, 0, 0);
glVertexPointer( 3, GL_FLOAT, 0, nucleus);
glEnableClientState(GL_VERTEX_ARRAY);
glDrawArrays(GL_TRIANGLE_STRIP, 0, points);
}
thanks for the help!