在顶点着色器和片段着色器中间还有一个几何着色器。 几何着色器的输入是一个图元的一组顶点,在几何着色器中进行任意变换之后再给片段着色器,可以变成完全不一样的图元、可以生成更多的顶点。 #version 330 core layout (points) in; layout (line_strip, max_vertices = 2) out; void main() { gl_Position = gl_in[0].gl_Position + vec4(-0.1, 0.0, 0.0, 0.0); EmitVertex(); gl_Position = gl_in[0].gl_Position + vec4( 0.1, 0.0, 0.0, 0.0); EmitVertex(); EndPrimitive(); } 这是一个几何着色器的例子。 我们不仅用这一帧的着色器输出,我们还会使用上一帧的着色器变量来进行更多变化。 使用几何着色器 首先先写一个最简单的画4个点的程序。 #include <iostream> #define GLEW_STATIC #include...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with unsigned int
Contact unsigned int, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack