From patchwork Thu Jul 21 12:36:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandros Frantzis X-Patchwork-Id: 2906 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 6F25923F4D for ; Thu, 21 Jul 2011 12:36:36 +0000 (UTC) Received: from mail-qy0-f180.google.com (mail-qy0-f180.google.com [209.85.216.180]) by fiordland.canonical.com (Postfix) with ESMTP id 11087A18287 for ; Thu, 21 Jul 2011 12:36:35 +0000 (UTC) Received: by qyk30 with SMTP id 30so842327qyk.11 for ; Thu, 21 Jul 2011 05:36:35 -0700 (PDT) Received: by 10.229.217.3 with SMTP id hk3mr202789qcb.38.1311251795318; Thu, 21 Jul 2011 05:36:35 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.217.78 with SMTP id hl14cs139327qcb; Thu, 21 Jul 2011 05:36:34 -0700 (PDT) Received: by 10.216.30.9 with SMTP id j9mr156993wea.82.1311251793684; Thu, 21 Jul 2011 05:36:33 -0700 (PDT) Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139]) by mx.google.com with ESMTP id x47si2384682weq.76.2011.07.21.05.36.33; Thu, 21 Jul 2011 05:36:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) client-ip=91.189.90.139; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) smtp.mail=bounces@canonical.com Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QjsUS-0000DP-6B for ; Thu, 21 Jul 2011 12:36:32 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id E83312E890E for ; Thu, 21 Jul 2011 12:36:29 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: glmark2 X-Launchpad-Branch: ~glmark2-dev/glmark2/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 2 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 2: Remove immediate rendering and display list functionality that is not available in OpenGL ES 2.0. Message-Id: <20110721123629.17019.99764.launchpad@loganberry.canonical.com> Date: Thu, 21 Jul 2011 12:36:29 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13475"; Instance="initZopeless config overlay" X-Launchpad-Hash: 65ebbcf0cb74000b06ad2af0f43bbf5f63ef340e ------------------------------------------------------------ revno: 2 committer: Alexandros Frantzis timestamp: Wed 2010-07-07 15:29:59 +0300 message: Remove immediate rendering and display list functionality that is not available in OpenGL ES 2.0. Add texture coord support when rendering using vertex arrays or VBOs. modified: mesh.cpp mesh.h scenebuild.cpp scenetexture.cpp --- lp:glmark2 https://code.launchpad.net/~glmark2-dev/glmark2/trunk You are subscribed to branch lp:glmark2. To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription === modified file 'mesh.cpp' --- mesh.cpp 2010-07-07 10:32:18 +0000 +++ mesh.cpp 2010-07-07 12:29:59 +0000 @@ -21,7 +21,6 @@ Mesh::~Mesh() { delete [] mVertex; - glDeleteLists(1, mBuildList); //deleteArray } @@ -130,48 +129,22 @@ } } -void Mesh::render() -{ - glBegin(mMode); - glColor3f(1.0f, 0.0f, 0.0f); - for(unsigned i = 0; i < mVertexQty; i++) - { - glNormal3f(mVertex[i].n.x, mVertex[i].n.y, mVertex[i].n.z); - glTexCoord2f(mVertex[i].t.u, mVertex[i].t.v); - glVertex3f(mVertex[i].v.x, mVertex[i].v.y, mVertex[i].v.z); - } - glEnd(); -} - void Mesh::render_array() { glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); glVertexPointer(3, GL_FLOAT, sizeof(Vertex), &mVertex[0].v.x); glNormalPointer(GL_FLOAT, sizeof(Vertex), &mVertex[0].n.x); + glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), &mVertex[0].t.u); glDrawArrays(mMode, 0, mVertexQty); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); } -void Mesh::build_list() -{ -#ifdef _DEBUG - printf("Building list for mesh... "); -#endif - - mBuildList = glGenLists(1); - glNewList(mBuildList, GL_COMPILE); - render(); - glEndList(); - -#ifdef _DEBUG - printf("[ Done ]\n"); -#endif -} - void Mesh::build_vbo() { #ifdef _DEBUG @@ -225,16 +198,20 @@ { glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVBONormals); glNormalPointer(GL_FLOAT, 0, 0); glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVBOVertices); glVertexPointer(3, GL_FLOAT, 0, 0); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVBOTexCoords); + glTexCoordPointer(2, GL_FLOAT, 0, 0); glDrawArrays(GL_TRIANGLES, 0, mVertexQty); glBindBuffer(GL_ARRAY_BUFFER, 0); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); } === modified file 'mesh.h' --- mesh.h 2010-07-07 10:32:18 +0000 +++ mesh.h 2010-07-07 12:29:59 +0000 @@ -34,20 +34,16 @@ GLenum mMode; // Polygon mode, eg GL_QUADS, GL_TRIANGLES etc... Vertex *mVertex; // Storage for the verticies - GLuint mBuildList; // Build list name - - GLuint mVBOVertices; // Vertex VBO name - GLuint mVBONormals; // Texture coordinate VBO name - GLuint mVBOTexCoords; // Texture coordinate VBO name + GLuint mVBOVertices; // Vertex VBO name + GLuint mVBONormals; // Texture coordinate VBO name + GLuint mVBOTexCoords; // Texture coordinate VBO name Mesh(); // Default Constructor, should set pointers to null ~Mesh(); void make_cube(); void make_torus(); - void render(); void render_array(); - void build_list(); void build_vbo(); void render_vbo(); }; === modified file 'scenebuild.cpp' --- scenebuild.cpp 2010-07-07 10:32:18 +0000 +++ scenebuild.cpp 2010-07-07 12:29:59 +0000 @@ -10,14 +10,13 @@ model.calculate_normals(); model.convert_to_mesh(&mMesh); - mMesh.build_list(); mMesh.build_vbo(); mRotationSpeed = 36.0f; mRunning = false; - mPartsQty = 4; + mPartsQty = 2; mPartDuration = new double[mPartsQty]; mAverageFPS = new unsigned[mPartsQty]; mScoreScale = new float[mPartsQty]; @@ -72,16 +71,9 @@ switch(mCurrentPart) { case 0: - printf("Precompilation\n"); - printf(" No Precompilation FPS: %u\n", mAverageFPS[mCurrentPart]); + printf(" Vertex array FPS: %u\n", mAverageFPS[mCurrentPart]); break; case 1: - printf(" Build list FPS: %u\n", mAverageFPS[mCurrentPart]); - break; - case 2: - printf(" Vertex array FPS: %u\n", mAverageFPS[mCurrentPart]); - break; - case 3: printf(" Vertex buffer object FPS: %u\n", mAverageFPS[mCurrentPart]); break; } @@ -106,14 +98,9 @@ switch(mCurrentPart) { case 0: - mMesh.render(); + mMesh.render_array(); break; case 1: - glCallList(mMesh.mBuildList); - case 2: - mMesh.render_array(); - break; - case 3: mMesh.render_vbo(); break; } === modified file 'scenetexture.cpp' --- scenetexture.cpp 2010-07-07 10:32:18 +0000 +++ scenetexture.cpp 2010-07-07 12:29:59 +0000 @@ -18,7 +18,7 @@ model.calculate_normals(); model.convert_to_mesh(&mCubeMesh); - mCubeMesh.build_list(); + mCubeMesh.build_vbo(); mRotationSpeed = Vector3f(36.0f, 36.0f, 36.0f); @@ -114,14 +114,14 @@ { case 0: glBindTexture(GL_TEXTURE_2D, mTexture[0]); - glCallList(mCubeMesh.mBuildList); + mCubeMesh.render_vbo(); break; case 1: glBindTexture(GL_TEXTURE_2D, mTexture[1]); - glCallList(mCubeMesh.mBuildList); + mCubeMesh.render_vbo(); case 2: glBindTexture(GL_TEXTURE_2D, mTexture[2]); - glCallList(mCubeMesh.mBuildList); + mCubeMesh.render_vbo(); break; } }