NeHe教程Qt實現 lesson17

2021-06-08 03:18:30 字數 935 閱讀 5210

nehe 系列教程之十四:2d紋理字型

本課展示2d紋理生成字型。

首先是字型庫的建立及相關字元輸出函式:

namespace ;

struct fyjbitmapfont

;static fyjbitmapchar chars1[128];

static fyjbitmapchar chars2[128];

const fyjbitmapfont font1 = ;

const fyjbitmapfont font2 = ;

void buildfont()

renderbitmapcharacter(currentfont.characters[c-32], fontsize);

gltranslated(currentfont.characters[c-32].right * fontsize/16, 0, 0);

}glmatrixmode(gl_projection);

glpopmatrix();

glmatrixmode(gl_modelview);

glpopmatrix();

glenable(gl_depth_test);

}void glprint(glint x, glint y, int set, int fontsize, const char *fmt, ...)

初始化:

void myglwidget::initializegl()

繪製:

void myglwidget::paintgl()

執行效果圖:

NeHe教程Qt實現 lesson04

nehe 系列教程之四 多邊形旋轉 本課在第三課的基礎上增加了旋轉多邊形的 具體如下 首先,在標頭檔案中增加了兩個旋轉因子 ifndef myglwidget h define myglwidget h include class qtimer class qkeyevent class myglw...

NeHe教程Qt實現 lesson07

nehe 系列教程之七 光照及紋理過濾 本課將以第一課的 為基礎,實現光照效果。首先是物件定義與紋理載入的 namespace ambient light values new glfloat lightdiffuse diffuse light values new glfloat lightpo...

NeHe教程Qt實現 lesson12

nehe 系列教程之十二 顯示列表 本課主要演示了顯示列表的使用。基於第六課。顯示列表的主要介面 glgenlists glnewlist glcalllist 具體來看 中的使用 namespace static glfloat topcol 5 3 array for top colors gl...