|
Low-level graphics library.
Use this class to manipulate active transformation matrices, issue rendering commands similar to OpenGL's immediate mode and do other low-level graphics tasks. Note that in almost all cases using Graphics.DrawMesh is more efficient than using immediate mode drawing.
GL immediate drawing functions use whatever is the "current material" set up right now. The material controls how the rendering is done (blending, textures, etc.), so unless you explicitly set it to something before using GL draw functions, the material can happen to be anything. Also, if you call any other drawing commands from inside GL drawing code, they can set material to something else, so make sure it's under control as well.
GL drawing commands execute immediately. That means if you call them in Update(), they will be executed before the camera is rendered (and the camera will most likely clear the screen, making the GL drawing not visible).
The usual place to call GL drawing is most often in OnPostRender() from a script attached to a camera
Note: This class is almost used when you need to draw a couple of lines or triangles, and don't want to deal with meshes. If you want to avoid surprises the usage pattern is this:
where at the "// Draw your stuff" you should do SetPass() on some material previously declared, which will be used for drawing. If you dont call SetPass, then you'll get basically a random material (whatever was used before) which is not good. So do it.
This class is only available in Unity Pro.
TRIANGLES |
Mode for Begin: draw triangles. |
TRIANGLE_STRIP |
Mode for Begin: draw triangle strip. |
QUADS |
Mode for Begin: draw quads. |
LINES |
Mode for Begin: draw lines. |
modelview |
The current modelview matrix. |
Vertex3 |
Submit a vertex. |
Vertex |
Submit a vertex. |
Color |
Sets current vertex color. |
TexCoord |
Sets current texture coordinate (v.x,v.y,v.z) for all texture units. |
TexCoord2 |
Sets current texture coordinate (x,y) for all texture units. |
TexCoord3 |
Sets current texture coordinate (x,y,z) for all texture units. |
MultiTexCoord2 |
Sets current texture coordinate (x,y) for the actual texture unit. |
MultiTexCoord3 |
Sets current texture coordinate (x,y,z) to the actual texture unit. |
MultiTexCoord |
Sets current texture coordinate (v.x,v.y,v.z) to the actual texture unit. |
Begin |
Begin drawing 3D primitives. |
End |
End drawing 3D primitives. |
LoadOrtho |
Helper function to set up an ortho perspective transform. |
LoadPixelMatrix |
Setup a matrix for pixel-correct rendering. |
Viewport |
Set the rendering viewport. |
LoadProjectionMatrix |
Load an arbitrary matrix to the current projection matrix. |
LoadIdentity |
Load the identity matrix to the current modelview matrix. |
MultMatrix |
Multiplies the current modelview matrix with the one specified. |
PushMatrix |
Saves both projection and modelview matrices to the matrix stack. |
PopMatrix |
Restores both projection and modelview matrices off the top of the matrix stack. |
GetGPUProjectionMatrix |
Compute GPU projection matrix from camera's projection matrix. |
SetRevertBackfacing |
Select whether to invert the backface culling (true) or not (false). |
Clear |
Clear the current render buffer. |
ClearWithSkybox |
Clear the current render buffer with camera's skybox. |
InvalidateState |
Invalidate the internally cached renderstates. |