画两条线段
在OpenGL Console里运行下面的脚本:
import java.nio.ByteBuffer
import java.nio.ByteOrder
import javax.media.opengl.GL
def vertexShaderCode = """
attribute vec4 a_Position;
void main() {
gl_Position = a_Position;
gl_PointSize = 10.0;
}
"""
def fragmentShaderCode = """
precision mediump float;
void main() {
gl_FragColor = vec4(1.0, 0.5, 0.0, 1.0);
}
"""
def shaderProgram = glob.compileAndLink(vertexShaderCode, fragmentShaderCode)
def aPositionLocation = gl.glGetAttribLocation(shaderProgram.objectId, "a_Position")
shaderProgram.use()
d