-
Notifications
You must be signed in to change notification settings - Fork 4
Click Buffer
To enable clickable objects, renderXF provides a click buffer solution that make its possible to retrieve a face index and a custom integer for each pixel on the screen.
To initialize/deinitialize the click buffer, use the InitializeClickBuffer()
/DeinitializeClickBuffer()
function from the renderX instance:
//Initializes The Click Buffer:
GL.InitializeClickBuffer();
//Deinitializes The Click Buffer:
GL.DeinitializeClickBuffer();
The click buffer can be toggled on and off, through the SetClickBufferWrite()
function from the renderX instance. This is useful for rendering some objects that need to be clickable, but others that do not.
//Enables The Click Buffer Write:
GL.SetClickBufferWrite(true);
//Disables The Click Buffer Write:
GL.SetClickBufferWrite(false);
To set a custom integer value, (ie. different objects have different values) use the SetClickBufferWrite()
function to set its data.
GL.SetClickBufferInt(myInt);
It is also possible to store separate data via bitwise operations.
To retrieve the click buffer data, use the GetClickBufferData()
function from the renderX instance. Please note that GetClickBufferData()
will return false if the requested coordinates are not inside the view buffer, or the selected pixel has no click buffer data applied to it.
int FaceIndex;
int RetrievedInteger;
if (GL.GetClickBufferData(srcX, srcY, out FaceIndex, out RetrievedInteger))
{
//Do Something
}
To clear the click buffer after everyframe, just use the ClearClearBuffer()
function from the renderX instance.
GL.ClearClickBuffer();
- Initializing the renderer
- Setting the transform data
- Blitting and clearing the viewport
- Initializing a vertex buffer
- Creating a shader
- Drawing an object
- Screen space shaders
- Blitting bitmaps
- Loading a texture
- Creating a framebuffer
- Displaying a texture