<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://programmingexamples.net/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=OpenGL%2FDisplayList</id>
		<title>OpenGL/DisplayList - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=OpenGL%2FDisplayList"/>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=OpenGL/DisplayList&amp;action=history"/>
		<updated>2026-06-15T12:12:22Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.5</generator>

	<entry>
		<id>http://programmingexamples.net/w/index.php?title=OpenGL/DisplayList&amp;diff=359&amp;oldid=prev</id>
		<title>Daviddoria: Created page with '==DisplayList.cxx== &lt;source lang=&quot;cpp&quot;&gt; #include &lt;iostream&gt;  #include &lt;GL/glut.h&gt;  using namespace std;  void display(void); void polygon(int a, int b, int c , int d); void DrawC…'</title>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=OpenGL/DisplayList&amp;diff=359&amp;oldid=prev"/>
				<updated>2010-11-24T00:42:14Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;==DisplayList.cxx== &amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt; #include &amp;lt;iostream&amp;gt;  #include &amp;lt;GL/glut.h&amp;gt;  using namespace std;  void display(void); void polygon(int a, int b, int c , int d); void DrawC…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==DisplayList.cxx==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;GL/glut.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
void display(void);&lt;br /&gt;
void polygon(int a, int b, int c , int d);&lt;br /&gt;
void DrawCube();&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
  int WindowHeight = 1000;&lt;br /&gt;
  int WindowWidth = 1000;&lt;br /&gt;
&lt;br /&gt;
  glutInit(&amp;amp;argc, argv);&lt;br /&gt;
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);&lt;br /&gt;
  glutInitWindowSize(WindowWidth, WindowHeight);&lt;br /&gt;
  glutInitWindowPosition(0, 0);&lt;br /&gt;
&lt;br /&gt;
  //setup the main window&lt;br /&gt;
  glutCreateWindow(&amp;quot;OpenGL Example&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  glutDisplayFunc(display);&lt;br /&gt;
&lt;br /&gt;
  DrawCube(); //create display list&lt;br /&gt;
&lt;br /&gt;
  glMatrixMode(GL_PROJECTION);&lt;br /&gt;
  glLoadIdentity();&lt;br /&gt;
  gluPerspective(70, 1, 1, 100);&lt;br /&gt;
&lt;br /&gt;
  glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
  glLoadIdentity();&lt;br /&gt;
&lt;br /&gt;
  gluLookAt(2, 2, 10, 2, 0, 0, 0, 1, 0);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  glutMainLoop();&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
GLuint list;&lt;br /&gt;
&lt;br /&gt;
void display(void)&lt;br /&gt;
{&lt;br /&gt;
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);&lt;br /&gt;
&lt;br /&gt;
  glEnable(GL_DEPTH_TEST);&lt;br /&gt;
&lt;br /&gt;
  glCallList(list);&lt;br /&gt;
&lt;br /&gt;
  glutSwapBuffers();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void DrawCube()&lt;br /&gt;
{&lt;br /&gt;
  list = glGenLists(1);&lt;br /&gt;
  glNewList(list,GL_COMPILE);&lt;br /&gt;
&lt;br /&gt;
  glPushName(1);&lt;br /&gt;
  glColor3f(1.0f, 0.0f, 0.0f);	// Color Red&lt;br /&gt;
  polygon(0,3,2,1);&lt;br /&gt;
  glPopName();&lt;br /&gt;
&lt;br /&gt;
  glPushName(2);&lt;br /&gt;
  glColor3f(0.0f,1.0f,0.0f);	// Color Green&lt;br /&gt;
  polygon(2,3,7,6);&lt;br /&gt;
  glPopName();&lt;br /&gt;
&lt;br /&gt;
  glPushName(3);&lt;br /&gt;
  glColor3f(0.0f, 0.0f, 1.0f);	// Color Blue&lt;br /&gt;
  polygon(0,4,7,3);&lt;br /&gt;
  glPopName();&lt;br /&gt;
&lt;br /&gt;
  glPushName(4);&lt;br /&gt;
  glColor3f(1.0f,1.0f,0.0f);	// Color Yellow&lt;br /&gt;
  polygon(1,2,6,5);&lt;br /&gt;
  glPopName();&lt;br /&gt;
&lt;br /&gt;
  glPushName(5);&lt;br /&gt;
  glColor3f(0.0f,1.0f,1.0f);	// Color Cyan&lt;br /&gt;
  polygon(4,5,6,7);&lt;br /&gt;
  glPopName();&lt;br /&gt;
&lt;br /&gt;
  glPushName(6);&lt;br /&gt;
  glColor3f(1.0f,0.0f,1.0f);	// Color Magenta&lt;br /&gt;
  polygon(0,1,5,4);&lt;br /&gt;
  glPopName();&lt;br /&gt;
&lt;br /&gt;
  glEndList();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
GLfloat vertices[][3] = {{-1.0,-1.0,-1.0},{1.0,-1.0,-1.0},&lt;br /&gt;
		{1.0,1.0,-1.0}, {-1.0,1.0,-1.0}, {-1.0,-1.0,1.0},&lt;br /&gt;
{1.0,-1.0,1.0}, {1.0,1.0,1.0}, {-1.0,1.0,1.0}};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void polygon(int a, int b, int c , int d)&lt;br /&gt;
{&lt;br /&gt;
  glBegin(GL_QUADS);&lt;br /&gt;
  glVertex3fv(vertices[a]);&lt;br /&gt;
  glVertex3fv(vertices[b]);&lt;br /&gt;
  glVertex3fv(vertices[c]);&lt;br /&gt;
  glVertex3fv(vertices[d]);&lt;br /&gt;
  glEnd();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CMakeLists.txt==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
cmake_minimum_required(VERSION 2.6)&lt;br /&gt;
&lt;br /&gt;
PROJECT(OpenGLDisplayLists)&lt;br /&gt;
&lt;br /&gt;
set(CMAKE_CXX_FLAGS &amp;quot;${CMAKE_CXX_FLAGS} -fopenmp&amp;quot;) #g++&lt;br /&gt;
&lt;br /&gt;
INCLUDE_DIRECTORIES(/usr/include/ /usr/local/include/)&lt;br /&gt;
&lt;br /&gt;
LINK_DIRECTORIES(/usr/lib /usr/local/lib)&lt;br /&gt;
&lt;br /&gt;
ADD_EXECUTABLE(Test DisplayLists.cpp  )&lt;br /&gt;
&lt;br /&gt;
TARGET_LINK_LIBRARIES(Test glut GLU GL Xmu X11)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daviddoria</name></author>	</entry>

	</feed>