sudo apt install -y assimp-utils libassimp-dev
sudo apt install -y build-essential
sudo apt install -y libx11-dev
sudo apt install -y xorg-dev
sudo apt install -y libsdl2-dev
sudo apt install -y libsdl2-ttf-dev
sudo apt install -y pkg-config
https://github.com/JoeyDeVries/LearnOpenGL https://www.opengl.org/archives/resources/code/samples/glut_examples/examples/examples.html https://learnopengl.com/code_viewer_gh.php?code=src/1.getting_started/7.4.camera_class/camera_class.cpp https://ogldev.org/index.html
obj格式
panic: failed to compile #version 330
uniform vec3 viewPos;
uniform vec3 lightPos;
uniform vec3 lightColor;
in vec3 FragPos;
in vec3 Normal;
out vec4 color;
void main() {
vec3 lightDir = normalize(lightPos - FragPos);
float diff = max(dot(Normal, lightDir), 0.0);
vec3 diffuse = diff * lightColor;
color = vec4(diffuse, 1.0);
}
: 0:17(1): error: syntax error, unexpected $undefined, expecting $end
获取shader的变量需要添加"\000"后缀
OpenGL是右手坐标系
https://stackoverflow.com/questions/34455925/render-truetype-fonts-with-opengl https://github.com/golang/freetype/blob/master/example/freetype/main.go
https://developer.apple.com/library/archive/documentation/TextFonts/Conceptual/CocoaTextArchitecture/Art/glyph_metrics_2x.png https://developer.apple.com/library/archive/documentation/TextFonts/Conceptual/CocoaTextArchitecture/Art/glyph_metrics_2x.png
重要的字体度量参数:
- 上下高度 (ascent) : 从基线到放置轮廓点最高 ( 上 ) 的距离;
- 下行高度 (descent) :从基线到放置轮廓点最低 ( 下 ) 的距离;
- 左跨距 ( bearingX ) : 从当前笔位置到轮廓左边界的水平位置;
- 上跨距 ( bearingY ) : 从当前笔位置到轮廓上边界的垂直位置;
- 步进宽度 ( advanceX ): 相邻两个笔位置的水平距离 ( 字间距 );
- 字形宽度 (width) : 字形的水平长度;
- 字形高度 (height) : 字形的垂直长度。