• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2010 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */
16 
17 package com.google.gwt.webgl.client;
18 
19 import com.google.gwt.core.client.JavaScriptObject;
20 
21 /** The WebGLContextAttributes interface contains drawing surface attributes and is passed as the second parameter to getContext. A
22  * native object may be supplied as this parameter; the specified attributes will be queried from this object. */
23 public class WebGLContextAttributes extends JavaScriptObject {
24 
create()25 	public static native WebGLContextAttributes create () /*-{
26 																			return { premultipliedAlpha:false };
27 																			}-*/;
28 
WebGLContextAttributes()29 	protected WebGLContextAttributes () {
30 	}
31 
32 	/** Default: true. If the value is true, the drawing buffer has an alpha channel for the purposes of performing OpenGL
33 	 * destination alpha operations and compositing with the page. If the value is false, no alpha buffer is available. */
setAlpha(boolean alpha)34 	public final native void setAlpha (boolean alpha) /*-{
35 																		this.alpha = alpha;
36 																		}-*/;
37 
clearAlpha()38 	public final native void clearAlpha () /*-{
39 														delete this.alpha;
40 														}-*/;
41 
42 	/** Default: true. If the value is true, the drawing buffer has a depth buffer of at least 16 bits. If the value is false, no
43 	 * depth buffer is available. */
setDepth(boolean depth)44 	public final native void setDepth (boolean depth) /*-{
45 																		this.depth = depth;
46 																		}-*/;
47 
clearDepth()48 	public final native void clearDepth () /*-{
49 														delete this.depth;
50 														}-*/;
51 
52 	/** Default: false. If the value is true, the drawing buffer has a stencil buffer of at least 8 bits. If the value is false, no
53 	 * stencil buffer is available. */
setStencil(boolean stencil)54 	public final native void setStencil (boolean stencil) /*-{
55 																			this.stencil = stencil;
56 																			}-*/;
57 
clearStencil()58 	public final native void clearStencil () /*-{
59 															delete this.stencil;
60 															}-*/;
61 
62 	/** Default: true. If the value is true and the implementation supports antialiasing the drawing buffer will perform
63 	 * antialiasing using its choice of technique (multisample/supersample) and quality. If the value is false or the
64 	 * implementation does not support antialiasing, no antialiasing is performed. */
setAntialias(boolean antialias)65 	public final native void setAntialias (boolean antialias) /*-{
66 																					this.antialias = antialias;
67 																					}-*/;
68 
clearAntialias()69 	public final native void clearAntialias () /*-{
70 																delete this.antialias;
71 																}-*/;
72 
73 	/** Default: true. If the value is true the page compositor will assume the drawing buffer contains colors with premultiplied
74 	 * alpha. If the value is false the page compositor will assume that colors in the drawing buffer are not premultiplied. This
75 	 * flag is ignored if the alpha flag is false. See Premultiplied Alpha for more information on the effects of the
76 	 * premultipliedAlpha flag. */
setPremultipliedAlpha(boolean premultipliedAlpha)77 	public final native void setPremultipliedAlpha (boolean premultipliedAlpha) /*-{
78 																											this.premultipliedAlpha = premultipliedAlpha;
79 																											}-*/;
80 
clearPremultipliedAlpha()81 	public final native void clearPremultipliedAlpha () /*-{
82 																			delete this.premultipliedAlpha;
83 																			}-*/;
84 
setPreserveDrawingBuffer(boolean preserveDrawingBuffer)85 	public final native void setPreserveDrawingBuffer (boolean preserveDrawingBuffer) /*-{
86 																			this.preserveDrawingBuffer = preserveDrawingBuffer;
87 																			}-*/;
88 }
89