PDA

View Full Version : Letters not showing up in redbook example in C#



HowitZer
02-28-2009, 04:26 PM
The following code is supposed to draw three 'F's across the opengl window. This is VS 2008 Express C#. I get the correct background color but, not the bitmapped letters being drawn. What's the problem with my code?

Please help.

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

namespace fonttestredbook
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

m_opengl.InitializeContexts();

byte[] rasters = { 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00,
0xff, 0x00, 0xff, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xff, 0xc0, 0xff, 0xc0 };

Gl.glPixelStorei(Gl.GL_UNPACK_ALIGNMENT, 1);
Gl.glClearColor(0.0f, 1.0f, 0.0f, 0.0f);
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT);

Gl.glColor3f(1.0f, 1.0f, 1.0f);

Gl.glRasterPos2i(15, 15);

Gl.glBitmap(10, 12, 0.0f, 0.0f, 11.0f, 0.0f, rasters);
Gl.glBitmap(10, 12, 0.0f, 0.0f, 11.0f, 0.0f, rasters);
Gl.glBitmap(10, 12, 0.0f, 0.0f, 11.0f, 0.0f, rasters);

Gl.glFlush();
}
}
}"

Best Wishes,
HowitZer

HowitZer
02-28-2009, 09:41 PM
Setting the raster pos to 0,0 showed my letters. I guess the raster pos was invalid and so nothing was drawn.