text in Tao Framework with Visual C#

1.1k views Asked by At

I am working with VS 2013 Community in a C# Windows Form and I am trying out the Tao Framework. My Problem is that I can´t create Text with it, it just appears a white surface with a red cross in it. Could anyonyone tell me what is wrong or how I can manage it?

Here the Example Code:

using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Windows.Forms; 
using Tao.OpenGl; 
using Tao.Platform; 
using Tao.FreeGlut; 

namespace TaoOpenGLTest 
{ 
 public partial class Form1 : Form 
 { 
     int w = 500; 
     int h = 500; 

     public Form1() 
     { 
         InitializeComponent(); 

         this.simpleOpenGlControl1.InitializeContexts(); 

         Gl.glClearDepth(1.0); 
         Gl.glClearColor(0, 0, 0, 0);       
         Gl.glEnable(Gl.GL_DEPTH_TEST); 
         Gl.glDepthMask(Gl.GL_TRUE); 
         Gl.glViewport(0, 0, w, h); 
         Gl.glMatrixMode(Gl.GL_PROJECTION); 
         Gl.glLoadIdentity(); 
         Glu.gluPerspective(45.0f, (double)w / (double)h, 0.01f, 5000.0f); 

         Gl.glEnable(Gl.GL_CULL_FACE); 
         Gl.glCullFace(Gl.GL_BACK);           
     } 

     private void timer1_Tick(object sender, EventArgs e) 
     { 
         this.simpleOpenGlControl1.Invalidate(); 
     } 

     private void simpleOpenGlControl1_Paint(object sender, PaintEventArgs e) 
     { 
         Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT); 
         Gl.glMatrixMode(Gl.GL_MODELVIEW); 
         Gl.glLoadIdentity(); 

         Gl.glTranslated(0, 0, -10); 
         Gl.glBegin(Gl.GL_LINE_LOOP); 
         Gl.glVertex3d(-1, 1, 0); 
         Gl.glVertex3d(-1, -1, 0); 
         Gl.glVertex3d(1, -1, 0); 
         Gl.glVertex3d(1, 1, 0); 
         Gl.glEnd(); 

         Gl.glRasterPos3f(0, 0, 0);    // Set the position for the string (text) 
         text("Text");                      // Display the text "Front"  
     } 

     // Used for the font that will be displayed 
     static void text(string c) 
     { 
         for (int i = 0; i < c.Length; i++) 
         { 
             // Render bitmap character 
             Glut.glutBitmapCharacter(Glut.GLUT_BITMAP_TIMES_ROMAN_10, c[i]); 
         } 
     } 

 } 
} 
0

There are 0 answers