Click here to Skip to main content
15,892,575 members
Articles / Desktop Programming / WPF

OpenGL for Both Native and .NET Environment

Rate me:
Please Sign up or sign in to vote.
4.92/5 (12 votes)
7 Jan 2013CPOL3 min read 36.2K   2.3K   51  
This article shows how you can bring OpenGL to both native and .NET environment.
////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2002-2013 Computations & Graphics, Inc. 
// 
// All rights reserved.
//
// Author: Junlin Xu
//
//////////////////////////////////////////////////////////////////////////

#pragma once

#include "OpenGraphDefines.h"

namespace NSOpenGraphLib
{
struct  CGLFont2d
{
    GLuint base;        // Display list number of first character
    int    widths[256]; // Width of each character in pixels
    int    height;			// Height of characters
    HFONT fontid;
} ;

struct CGLFont3d
{
	GLuint base;        // Display list number of first character
	double fScale;
	GLYPHMETRICSFLOAT gmf[256];	// Storage For Information About Our Outline Font Characters
};

CGLFont2d *Font2dCreate(HDC hdc, const TCHAR *typeface, int height, int weight, DWORD italic);
void	Font2dDelete(CGLFont2d *font);
void	Font2dPuts(CGLFont2d *font, const TCHAR *s);
void	Font2dPrintf(CGLFont2d *font, int align, CPointf ptBase, const TCHAR *szText);
void UnicodeFont2dPrintf(CGLFont2d* font, int align, CPointf ptBase, const TCHAR* szText);
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
President Computations & Graphics, Inc.
United States United States
Junlin Xu is the founder of Computations & Graphics, Inc. (http://www.cg-inc.com). He is the author of Real3D finite element package, SolverBlaze finite element SDK, OpenGraph Library (OpenGL-based visualization and charting SDK for native and .NET environment), and double128 SDK (quad precision floating point math for C++ and .NET).

Junlin has 20+ years software development experiences in various industries. He has skills in Windows desktop and web application development using C++, C++/CLI, C#, Qt, MFC, STL, OpenGL, GLSL, COM/COM+, WinForms, MS SQL, MySQL, ASP.NET and .NET Core, CSS, jQuery and jQuery UI, Autodesk Revit API, Inno Setup. He is also an expert in mathematical, CAD and algorithmic software development.

Comments and Discussions