From 261acefbdc5a5f7bac02e876d3c4d08be5873ed4 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sat, 15 Jan 2011 17:15:40 +0000 Subject: [PATCH] Remove display list mesh implementation --- src/Mesh.cpp | 72 +--------------------------------------------------- 1 file changed, 1 insertion(+), 71 deletions(-) diff --git a/src/Mesh.cpp b/src/Mesh.cpp index 3901121..b7495aa 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -1,5 +1,5 @@ // -// Copyright (C) 2009-2010 Nick Gasson +// Copyright (C) 2009-2011 Nick Gasson // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -312,76 +312,6 @@ void Material::apply() const } } -// Simple implementation using display lists -class DisplayListMesh : public IMesh { -public: - DisplayListMesh(IMeshBufferPtr a_buffer); - ~DisplayListMesh(); - - void render() const; -private: - GLuint my_display_list; -}; - -DisplayListMesh::DisplayListMesh(IMeshBufferPtr a_buffer) -{ - my_display_list = glGenLists(1); - - glNewList(my_display_list, GL_COMPILE); - - const MeshBuffer* buf = MeshBuffer::get(a_buffer); - - if (buf->has_material) - buf->material.apply(); - else - glEnable(GL_COLOR_MATERIAL); - - glBegin(GL_TRIANGLES); - - vector::const_iterator it; - for (it = buf->indices.begin(); - it != buf->indices.end(); ++it) { - - if (!buf->has_material) { - gl::colour(buf->colours[*it]); - } - - const MeshBuffer::Normal& n = buf->normals[*it]; - glNormal3f(n.x, n.y, n.z); - - const MeshBuffer::Vertex& v = buf->vertices[*it]; - glVertex3f(v.x, v.y, v.z); - } - - glEnd(); - - for (it = buf->indices.begin(); - it != buf->indices.end(); ++it) { - const MeshBuffer::Vertex& v = buf->vertices[*it]; - const MeshBuffer::Normal& n = buf->normals[*it]; - draw_normal(v, n); - } - - glEndList(); -} - -DisplayListMesh::~DisplayListMesh() -{ - glDeleteLists(my_display_list, 1); -} - -void DisplayListMesh::render() const -{ - glPushAttrib(GL_ENABLE_BIT); - - glDisable(GL_BLEND); - glEnable(GL_CULL_FACE); - - glCallList(my_display_list); - - glPopAttrib(); -} - // Packed vertex data used by vertex array and VBO mesh implementations struct VertexData { float x, y, z; -- 2.39.2