Sce.PlayStation.Core.Graphics provides a feature for graphics rendering. Its functional model is based on OpenGL ES 2.0.
Contents
GraphicsContext controls overall graphics rendering; this class represents the graphics context of OpenGL. The constructor of this class is used to initialize the graphics device and the screen; the member functions of this class are used to carry out graphics rendering.
GraphicsContext initializes the graphics device and the screen according to the system's standard settings. If necessary, the screen size and pixel format can be specified as arguments. Specifications of the graphics device and actual screen size, as well as the pixel format, can be obtained after initialization.
To carry out graphics rendering, create a graphics object (described later) in advance, set the graphics object and render states, and render the primitive using the GraphicsContext member function.
ShaderProgram controls shader features; this class represents program objects of OpenGL. Consisting of the vertex shader and the fragment shader, this class is created from the file storing these shader programs.
ShaderProgram holds multiple uniform variables and attribute variables. Values can be set to the uniform variables, and vertex data can be continuously transferred to the attribute variables. These variables are accessed by the numbers assigned to them. If necessary, these variables can be linked to specific numbers in a manner that is useful to the application.
The extension of the shader file is .cgx, and it is binary converted from source code written in Cg language. Use .vcg and .fcg or .vp.cg and .fp.cg for the extensions of the source code. When the extensions of the source code are .vcg and .fcg, a vertex shader and fragment shader with the same name are stored in one file.
VertexBuffer stores vertex data; this class represents vertex buffer objects of OpenGL. This class can store multiple vertex arrays and 1 index array, as necessary; it can be created by specifying the size and format.
Multiple VertexBuffer can be specified to a GraphicsContext. Each vertex array is linked to an attribute variable of the ShaderProgram in order.
When multiple index arrays are enabled, the last one will be used.
Texture stores pixel data; this class represents an texture object of OpenGL. Derivative classes (Texture2D, TextureCube, etc.) exist; a Texture can be created from an image file or by specifying its size and format.
Multiple Texture can be specified to a GraphicsContext. Each Texture is linked to a sampler of the ShaderProgram in order.
The usable image formats are DDS, PNG, JPG, BMP, and GIF (however, animated GIFs are not supported).
FrameBuffer controls the storing destination of the rendering result; this class represents a frame buffer object of OpenGL. Changing the storing destination of the rendering result from the screen to another buffer will enable off-screen rendering.
Storing destinations of the color and depth can be set using the FrameBuffer. The ColorBuffer can be set as the storing destination for color, and the DepthBuffer can be set as the storing destination for depth. If the Renderable option is specified at the time of creation, Texture can be set as the storing destination for color.
Depending on the color's storing destination and the depth's storing destination, rendering may not be possible. Whether or not rendering is possible with the current combination can be checked by referencing the FrameBuffer.Status property.
ColorBuffer and DepthBuffer store rendering results; these classes represent the render buffer object of OpenGL. The ColorBuffer can store color values, and the DepthBuffer can store depth values as well as stencil values; these classes can be created by specifying the size and format.
The ColorBuffer and the DepthBuffer cannot be set to the GraphicsContext. These should be set to the FrameBuffer.
In the current version, the following features cannot be used.
In addition, device performance is limited to the following values.
Shader descriptions have the following restrictions in comparison with standard Cg language.
The semantics that can be specified for input to the vertex shader are as follows
The semantics that can be specified for output of the vertex shader are as follows
The semantics that can be specified for input to the fragment shader are as follows
The semantics that can be specified for output of the fragment shader are as follows
A graphics object uses graphics memory managed by the device driver in addition to the resource heap managed by the application. Objects such as VertexBuffer and ShaderProgram require the resource heap and graphics memory.
On the other hand, PixelBuffer objects such as Texture2D, TextureCube, ColorBuffer, and DepthBuffer used to require the resource heap until SDK 1.20 but no longer do from SDK 2.00. In the current version, only the graphics memory is required.
The size of graphics memory is approximately 96 MiB. This size cannot be changed.