OGLInlineDrawing.kl¶
Types¶
OGLInlineDrawing (object)¶
バージョン 1.12.0 で追加.
The OGLInlineDrawing inherits InlineDrawing object for OpenGL direct rendering.
Members¶
Integer[] | prevProgramValues | |
Integer[] | prevCullFace | |
Integer[] | prevCullFaceEnable | |
Integer[] | prevDepthMask | |
Integer[] | prevDepthEnable | |
Integer[] | prevDeptFunc |
/*
** Example: OGLInlineDrawing
*/
require InlineDrawing;
operator entry() {
InlineDrawing drawing = OGLInlineDrawing_GetInstance();
// create a shape
PolygonMesh myMesh = PolygonMesh();
InlineShape shape = InlineMeshShape('myMesh', myMesh);
drawing.registerShape(shape);
// create a shader
InlineShader shader = OGLInlineShader(
"myFlatShader",
"
#version 120 // My shader uses GLSL 1.20
uniform mat4 u_viewMatrix;
uniform mat4 u_projection;
uniform mat4 u_modelMatrix;
attribute vec4 positions;
void main(){
gl_Position = u_projection * (u_viewMatrix * (u_modelMatrix * positions));
}
", "
#version 120 // My shader uses GLSL 1.20
uniform vec4 u_materialColor;
uniform float u_time;
void main(){
gl_FragColor = u_materialColor * u_time;
}
");
shader.defineUniform(InlineUniform("u_viewMatrix", Mat44()));
shader.defineUniform(InlineUniform("u_projection", Mat44()));
shader.defineUniform(InlineUniform("u_modelMatrix", Mat44()));
shader.defineUniform(InlineUniform("u_materialColor", Color(1.0, 0.0, 0.0)));
shader.defineUniform(InlineUniform("u_time", 0.0));
shader.defineAttribute('positions', "Vec3");
// add the shader to the drawing
drawing.registerShader(shader);
// create a material
InlineMaterial red = shader.getOrCreateMaterial('red');
red.setUniform('u_materialColor', Color(1.0, 0.0, 0.0));
// create an instance and add it to the red material
InlineInstance instance = InlineInstance('redMesh', drawing.getRoot(), shape);
instance.addMaterial(red);
}
/*
** Output:
*/
Methods¶
OGLInlineDrawing ( in OGLInlineDrawing other ) | |
OGLInlineDrawing ( in String name ) | |
OGLInlineDrawing () | |
OGLInlineDrawing | clone ? () |
drawOverlay ! ( io DrawContext context, in SInt32 x, in SInt32 y, in SInt32 width, in SInt32 height, in String filePath, in Boolean transparent ) | |
OGLInlineDrawing | getInstance ? () |
OGLInlineDrawing | getNewInstance ? () |
InlineInstance | setupSceneGrid ! ( in String name, in Scalar xSize, in Scalar zSize, in Size xCount, in Size zCount, in Color color ) |
Functions¶
OGLInlineDrawing_GetInstance¶
OGLInlineDrawing OGLInlineDrawing_GetInstance ()
Get the OGLInlineDrawing singleton, or construct it if it didn’t already exist.