Sign in to follow this  
Lithic

[.net] Bitmap Fonts

Recommended Posts

How can I display OpenGL bitmap fonts when using Tao C#. Looking at the NeHe Tuts, they use the SelectObject function to associate the font with the device context, what would be the C# equivelant?

Share this post


Link to post
Share on other sites
Well, if you want to do it the way shown in the tutorial, you will need to add the pinvoke methods to your class, see: PInvoke. You can use the System.Drawing.Font class to create the font, then call the ToHfont method. The IntPtr returned from that can be passed to SelectObject, and from there to your wgl call.

On that note, i'm trying to get onto tha Tao site, but it's not letting me, so I can't tell you how to do it using the Tao framework. As soon as i can access said site, I will give you an answer :P

Share this post


Link to post
Share on other sites
Ok, just got this up and running. ToHFont was just what I needed =). Is there any way I can find the size of a printed string in the OpenGL window, perhaps a function that will give me the pixel width of a string printed in a particular font that I could divide by the window's width?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this