This site has been permanently archived. The content on this site was last updated in 2019.
BufferSpec
Stay organized with collections
Save and categorize content based on your preferences.
Specification of a pixel buffer. A pixel buffer can have color, depth and stencil attachments and
mostly corresponds to the OpenGL concept of a framebuffer object. However, since there can be
multiple such objects for each frame, we avoid calling them "framebuffers". Pixel buffers which
are part of the currently acquired frame are immutable, i.e., they cannot be resized or otherwise
reconfigured.
Public Methods
int
|
getSamples()
Gets the number of samples per pixel in the buffer to be created.
|
void
|
getSize( Point bufferSizeOut)
Gets the size of the buffer to be created.
|
static
boolean
|
|
static
boolean
|
|
void
|
setColorFormat(int format)
Sets the format of the color attachment for the buffer to be created.
|
void
|
setDepthStencilFormat(int format)
Sets the format of the packed depth-stencil attachment for the buffer to be created.
|
void
|
setMultiviewLayers(int numLayers)
Sets the number of layers in a framebuffer backed by an array texture.
|
void
|
setSamples(int samples)
Sets the number of samples per pixel in the buffer to be created.
|
void
|
setSize( Point bufferSize)
Sets the size of the buffer to be created.
|
void
|
shutdown()
Shuts down the BufferSpec instance, freeing associated resources.
|
Inherited Methods
From class
java.lang.Object
boolean
|
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
Public Methods
public
int
getSamples
()
Gets the number of samples per pixel in the buffer to be created.
Returns
- Value >= 1 giving the number of samples. 1 means multisampling is disabled. Negative
values and 0 are never returned.
public
void
getSize
(Point bufferSizeOut)
Gets the size of the buffer to be created.
Parameters
bufferSizeOut |
The (output) size of the pixel buffer. The default is equal to the
recommended render target size at the time when the specification was created.
|
Checks if the given integer is a legal color format.
Checks if the given integer is a legal depth-stencil format.
Sets the format of the color attachment for the buffer to be created.
Sets the format of the packed depth-stencil attachment for the buffer to be created.
public
void
setMultiviewLayers
(int numLayers)
Sets the number of layers in a framebuffer backed by an array texture.
Default is 1, which means a non-layered texture will be created.
Not all platforms support multiple layers, so clients can call
GvrApi.isFeatureSupported(GvrApi.Feature.MULTIVIEW) to check.
Parameters
numLayers |
The number of layers in the array texture.
|
public
void
setSamples
(int samples)
Sets the number of samples per pixel in the buffer to be created.
Parameters
samples |
The number of samples. Negative values are an error. The values 0 and 1 are
treated identically and indicate that multisampling should be disabled.
|
public
void
setSize
(Point bufferSize)
Sets the size of the buffer to be created.
Parameters
bufferSize |
The size. Width and height must both be greater than zero. Otherwise, the
application is aborted.
|
public
void
shutdown
()
Shuts down the BufferSpec instance, freeing associated resources.
Note: The caller is responsible for ensuring that this BufferSpec
isn't used after shutdown.
All rights reserved. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-09 UTC."],[[["\u003cp\u003e\u003ccode\u003eBufferSpec\u003c/code\u003e defines the properties of a pixel buffer, similar to an OpenGL framebuffer object, used for color, depth, and stencil attachments.\u003c/p\u003e\n"],["\u003cp\u003ePixel buffers within an acquired frame are immutable and cannot be resized or reconfigured.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBufferSpec\u003c/code\u003e allows developers to specify the color format, depth-stencil format, size, and multisampling settings of the buffer.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can use methods like \u003ccode\u003esetColorFormat\u003c/code\u003e, \u003ccode\u003esetDepthStencilFormat\u003c/code\u003e, \u003ccode\u003esetSize\u003c/code\u003e, and \u003ccode\u003esetSamples\u003c/code\u003e to configure the buffer's properties.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBufferSpec\u003c/code\u003e must be shut down using the \u003ccode\u003eshutdown\u003c/code\u003e method to release associated resources when no longer needed.\u003c/p\u003e\n"]]],["`BufferSpec` defines pixel buffer specifications, resembling OpenGL's framebuffer objects. Key actions include setting and getting buffer attributes: `setSize` sets the buffer's dimensions, `setSamples` sets samples per pixel, `setColorFormat` and `setDepthStencilFormat` define attachment formats, and `setMultiviewLayers` configures layered textures. `getSamples` and `getSize` retrieve buffer details. `isValidColorFormat` and `isValidDepthStencilFormat` validate formats, and `shutdown` releases resources. BufferSpec instances are immutable if they are part of a currently acquired frame.\n"],null,["# BufferSpec\n\npublic class **BufferSpec** \nSpecification of a pixel buffer. A pixel buffer can have color, depth and stencil attachments and\nmostly corresponds to the OpenGL concept of a framebuffer object. However, since there can be\nmultiple such objects for each frame, we avoid calling them \"framebuffers\". Pixel buffers which\nare part of the currently acquired frame are immutable, i.e., they cannot be resized or otherwise\nreconfigured. \n\n### Nested Classes\n\n|-------|---|---|-------------------------------------|\n| class | [BufferSpec.ColorFormat](/vr/reference/android/com/google/vr/ndk/base/BufferSpec.ColorFormat) || Available color formats. |\n| class | [BufferSpec.DepthStencilFormat](/vr/reference/android/com/google/vr/ndk/base/BufferSpec.DepthStencilFormat) || Available depth \\& stencil formats. |\n\n### Public Methods\n\n|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| int | [getSamples](/vr/reference/android/com/google/vr/ndk/base/BufferSpec#getSamples())() Gets the number of samples per pixel in the buffer to be created. |\n| void | [getSize](/vr/reference/android/com/google/vr/ndk/base/BufferSpec#getSize(android.graphics.Point))([Point](https://developer.android.com/reference/android/graphics/Point) bufferSizeOut) Gets the size of the buffer to be created. |\n| static boolean | [isValidColorFormat](/vr/reference/android/com/google/vr/ndk/base/BufferSpec#isValidColorFormat(int))(int format) Checks if the given integer is a legal color format. |\n| static boolean | [isValidDepthStencilFormat](/vr/reference/android/com/google/vr/ndk/base/BufferSpec#isValidDepthStencilFormat(int))(int format) Checks if the given integer is a legal depth-stencil format. |\n| void | [setColorFormat](/vr/reference/android/com/google/vr/ndk/base/BufferSpec#setColorFormat(int))(int format) Sets the format of the color attachment for the buffer to be created. |\n| void | [setDepthStencilFormat](/vr/reference/android/com/google/vr/ndk/base/BufferSpec#setDepthStencilFormat(int))(int format) Sets the format of the packed depth-stencil attachment for the buffer to be created. |\n| void | [setMultiviewLayers](/vr/reference/android/com/google/vr/ndk/base/BufferSpec#setMultiviewLayers(int))(int numLayers) Sets the number of layers in a framebuffer backed by an array texture. |\n| void | [setSamples](/vr/reference/android/com/google/vr/ndk/base/BufferSpec#setSamples(int))(int samples) Sets the number of samples per pixel in the buffer to be created. |\n| void | [setSize](/vr/reference/android/com/google/vr/ndk/base/BufferSpec#setSize(android.graphics.Point))([Point](https://developer.android.com/reference/android/graphics/Point) bufferSize) Sets the size of the buffer to be created. |\n| void | [shutdown](/vr/reference/android/com/google/vr/ndk/base/BufferSpec#shutdown())() Shuts down the BufferSpec instance, freeing associated resources. |\n\n### Inherited Methods\n\nFrom class java.lang.Object \n\n|-----------------------------------------------------------------------------|---------------------------------------------------------------------------------|\n| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object) arg0) |\n| final [Class](https://developer.android.com/reference/java/lang/Class)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](https://developer.android.com/reference/java/lang/String) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public int\n**getSamples**\n()\n\nGets the number of samples per pixel in the buffer to be created. \n\n##### Returns\n\n- Value \\\u003e= 1 giving the number of samples. 1 means multisampling is disabled. Negative values and 0 are never returned. \n\n#### public void\n**getSize**\n([Point](https://developer.android.com/reference/android/graphics/Point) bufferSizeOut)\n\nGets the size of the buffer to be created. \n\n##### Parameters\n\n| bufferSizeOut | The (output) size of the pixel buffer. The default is equal to the recommended render target size at the time when the specification was created. |\n|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------|\n\n#### public static boolean\n**isValidColorFormat**\n(int format)\n\nChecks if the given integer is a legal color format. \n\n##### Parameters\n\n| format | Value to check. |\n|--------|-----------------|\n\n##### Returns\n\n- Whether the given format exists in [BufferSpec.ColorFormat](/vr/reference/android/com/google/vr/ndk/base/BufferSpec.ColorFormat). \n\n#### public static boolean\n**isValidDepthStencilFormat**\n(int format)\n\nChecks if the given integer is a legal depth-stencil format. \n\n##### Parameters\n\n| format | Value to check. |\n|--------|-----------------|\n\n##### Returns\n\n- Whether the given format exists in [BufferSpec.DepthStencilFormat](/vr/reference/android/com/google/vr/ndk/base/BufferSpec.DepthStencilFormat). \n\n#### public void\n**setColorFormat**\n(int format)\n\nSets the format of the color attachment for the buffer to be created. \n\n##### Parameters\n\n| format | One of the available formats from [BufferSpec.ColorFormat](/vr/reference/android/com/google/vr/ndk/base/BufferSpec.ColorFormat). |\n|--------|----------------------------------------------------------------------------------------------------------------------------------|\n\n#### public void\n**setDepthStencilFormat**\n(int format)\n\nSets the format of the packed depth-stencil attachment for the buffer to be created. \n\n##### Parameters\n\n| format | One of the available formats from [BufferSpec.DepthStencilFormat](/vr/reference/android/com/google/vr/ndk/base/BufferSpec.DepthStencilFormat). |\n|--------|------------------------------------------------------------------------------------------------------------------------------------------------|\n\n#### public void\n**setMultiviewLayers**\n(int numLayers)\n\nSets the number of layers in a framebuffer backed by an array texture.\nDefault is 1, which means a non-layered texture will be created.\nNot all platforms support multiple layers, so clients can call\nGvrApi.isFeatureSupported(GvrApi.Feature.MULTIVIEW) to check. \n\n##### Parameters\n\n| numLayers | The number of layers in the array texture. |\n|-----------|--------------------------------------------|\n\n#### public void\n**setSamples**\n(int samples)\n\nSets the number of samples per pixel in the buffer to be created. \n\n##### Parameters\n\n| samples | The number of samples. Negative values are an error. The values 0 and 1 are treated identically and indicate that multisampling should be disabled. |\n|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n\n#### public void\n**setSize**\n([Point](https://developer.android.com/reference/android/graphics/Point) bufferSize)\n\nSets the size of the buffer to be created. \n\n##### Parameters\n\n| bufferSize | The size. Width and height must both be greater than zero. Otherwise, the application is aborted. |\n|------------|---------------------------------------------------------------------------------------------------|\n\n#### public void\n**shutdown**\n()\n\nShuts down the BufferSpec instance, freeing associated resources.\n\n**Note:** The caller is responsible for ensuring that this [BufferSpec](/vr/reference/android/com/google/vr/ndk/base/BufferSpec)\nisn't used after shutdown."]]