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

	<entry>
		<id>http://www.programmingexamples.net/w/index.php?title=OpenGL/Text&amp;diff=363&amp;oldid=prev</id>
		<title>Daviddoria: Created page with 'This example displays white text in the lower left corner of the window.  ==Text.cxx== &lt;source lang=&quot;cpp&quot;&gt; #include &lt;iostream&gt; #include &lt;cstdio&gt; #include &lt;string&gt; #include &lt;cstdl…'</title>
		<link rel="alternate" type="text/html" href="http://www.programmingexamples.net/w/index.php?title=OpenGL/Text&amp;diff=363&amp;oldid=prev"/>
				<updated>2010-11-24T00:48:57Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;This example displays white text in the lower left corner of the window.  ==Text.cxx== &amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt; #include &amp;lt;iostream&amp;gt; #include &amp;lt;cstdio&amp;gt; #include &amp;lt;string&amp;gt; #include &amp;lt;cstdl…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This example displays white text in the lower left corner of the window.&lt;br /&gt;
&lt;br /&gt;
==Text.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;
#include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;lt;cstdlib&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;
void printtext(int x, int y, string String);&lt;br /&gt;
&lt;br /&gt;
int WindowHeight = 1000;&lt;br /&gt;
int WindowWidth = 1000;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char *argv[])&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;
	glutCreateWindow(&amp;quot;OpenGL Text Example&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	glutDisplayFunc(display);&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;
	glutMainLoop();&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void printtext(int x, int y, string String)&lt;br /&gt;
{&lt;br /&gt;
//(x,y) is from the bottom left of the window&lt;br /&gt;
    glMatrixMode(GL_PROJECTION);&lt;br /&gt;
    glPushMatrix();&lt;br /&gt;
    glLoadIdentity();&lt;br /&gt;
    glOrtho(0, WindowWidth, 0, WindowHeight, -1.0f, 1.0f);&lt;br /&gt;
    glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
    glPushMatrix();&lt;br /&gt;
    glLoadIdentity();&lt;br /&gt;
    glPushAttrib(GL_DEPTH_TEST);&lt;br /&gt;
    glDisable(GL_DEPTH_TEST);&lt;br /&gt;
    glRasterPos2i(x,y);&lt;br /&gt;
    for (int i=0; i&amp;lt;String.size(); i++)&lt;br /&gt;
    {&lt;br /&gt;
        glutBitmapCharacter(GLUT_BITMAP_9_BY_15, String[i]);&lt;br /&gt;
    }&lt;br /&gt;
    glPopAttrib();&lt;br /&gt;
    glMatrixMode(GL_PROJECTION);&lt;br /&gt;
    glPopMatrix();&lt;br /&gt;
    glMatrixMode(GL_MODELVIEW);&lt;br /&gt;
    glPopMatrix();&lt;br /&gt;
}&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;
    char string[64];&lt;br /&gt;
    sprintf(string, &amp;quot;something&amp;quot;);&lt;br /&gt;
    printtext(10,10,string);&lt;br /&gt;
&lt;br /&gt;
	glutSwapBuffers();&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(Text)&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(Text Text.cpp)&lt;br /&gt;
&lt;br /&gt;
TARGET_LINK_LIBRARIES(Text 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>