void Model::render() { if( ! render_inited ) { buildVBO(); bindVBO(); render_inited = true; } glColor3f(0.0, 0.0, 1.0); glDrawElements(GL_TRIANGLES, model->numtriangles * 3, GL_UNSIGNED_INT, NULL); }
//-------------------------------------------------------------- void SkyBox::render(Uint32 passID) { if(passID != 1) return; glScalef(m_scale, m_scale, m_scale); bindVBO(*this); enableTexCoordArray(m_txCoordOffset); m_shader.enable(); m_shader.setProjection(GraphicRenderer::getInstance()->getProjectionMatrix()); m_shader.setView(Camera::getActiveCamera()->getViewMatrix()); m_shader.setModel(getModelMatrix()); /// Left m_shader.setTextureParameter("skyTexture", m_left, 0); enableVertexArray(m_leftOffset); glDrawArrays(GL_QUADS, 0, 4); /// Right m_shader.setTextureParameter("skyTexture", m_right, 0); enableVertexArray(m_rightOffset); glDrawArrays(GL_QUADS, 0, 4); /// Front m_shader.setTextureParameter("skyTexture", m_front, 0); enableVertexArray(m_frontOffset); glDrawArrays(GL_QUADS, 0, 4); /// Back m_shader.setTextureParameter("skyTexture", m_back, 0); enableVertexArray(m_backOffset); glDrawArrays(GL_QUADS, 0, 4); /// Top m_shader.setTextureParameter("skyTexture", m_top, 0); enableVertexArray(m_topOffset); glDrawArrays(GL_QUADS, 0, 4); /// Bottom m_shader.setTextureParameter("skyTexture", m_bottom, 0); enableVertexArray(m_bottomOffset); glDrawArrays(GL_QUADS, 0, 4); m_shader.disable(); unbindVBO(); }