void RenderingEngine2::Initialize(int width, int height) { // Create the framebuffer object and attach the color buffer. #ifdef __APPLE__ glGenFramebuffers(1, &m_framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffer); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_renderbuffer); #endif #ifndef ANDROID_NDK m_framebuffer = (GLuint)0; #endif glViewport(0, 0, width, height); // m_simpleProgram = BuildProgram(gVertexShader, gFragmentShader); m_simpleProgram = BuildProgram(SimpleVertexShader, SimpleFragmentShader); glUseProgram(m_simpleProgram); // Initialize the projection matrix. ApplyOrtho(2, 3); // Initialize rotation animation state. OnRotate(DeviceOrientationPortrait); m_currentAngle = m_desiredAngle; }
void on_GLES2_Size(int view_w,int view_h) { glViewport(0,0,view_w,view_h); ApplyOrtho(2,3); }