2 |
SolidBackdropVob.java |
SolidBackdropVob.java |
3 |
* |
* |
4 |
* Copyright (c) 2002, Matti Katila and Tuomas J. Lukka |
* Copyright (c) 2002, Matti Katila and Tuomas J. Lukka |
5 |
|
* Copyright (c) 2003, Tuomas J. Lukka |
6 |
* |
* |
7 |
* This file is part of Gzz. |
* This file is part of Libvob. |
8 |
* |
* |
9 |
* Gzz is free software; you can redistribute it and/or modify it under |
* Libvob is free software; you can redistribute it and/or modify it under |
10 |
* the terms of the GNU Lesser General Public License as published by |
* the terms of the GNU Lesser General Public License as published by |
11 |
* the Free Software Foundation; either version 2 of the License, or |
* the Free Software Foundation; either version 2 of the License, or |
12 |
* (at your option) any later version. |
* (at your option) any later version. |
13 |
* |
* |
14 |
* Gzz is distributed in the hope that it will be useful, but WITHOUT |
* Libvob is distributed in the hope that it will be useful, but WITHOUT |
15 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
16 |
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General |
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General |
17 |
* Public License for more details. |
* Public License for more details. |
18 |
* |
* |
19 |
* You should have received a copy of the GNU Lesser General |
* You should have received a copy of the GNU Lesser General |
20 |
* Public License along with Gzz; if not, write to the Free |
* Public License along with Libvob; if not, write to the Free |
21 |
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
22 |
* MA 02111-1307 USA |
* MA 02111-1307 USA |
23 |
* |
* |
45 |
public Color color; |
public Color color; |
46 |
|
|
47 |
/** Create a new SolidBackdropVob. |
/** Create a new SolidBackdropVob. |
48 |
|
* @param color The color to clear to. If null, color buffer will not be cleared |
49 |
|
* on OpenGL. |
50 |
*/ |
*/ |
51 |
public SolidBackdropVob(Color color) { |
public SolidBackdropVob(Color color) { |
52 |
this.color = color; |
this.color = color; |
67 |
|
|
68 |
// GL |
// GL |
69 |
private String getGLStr() { |
private String getGLStr() { |
70 |
return |
String common = |
71 |
"ClearColor " + ColorUtil.colorGLString(color) + " 0\n"+ |
"Disable TEXTURE_2D\n"+ |
72 |
"ColorMask 1 1 1 1\n"+ |
"Enable ALPHA_TEST\n"+ |
73 |
"DepthMask 1\n"+ |
"AlphaFunc GREATER 0.1\n"+ |
74 |
"StencilMask 255\n"+ |
"Disable BLEND\n"+ // Don't want to enable this by default |
75 |
"Clear COLOR_BUFFER_BIT DEPTH_BUFFER_BIT STENCIL_BUFFER_BIT\n"+ |
// as it's fairly expensive |
76 |
"Enable TEXTURE_2D\n"+ |
"Enable DEPTH_TEST\n"+ |
77 |
"Enable ALPHA_TEST\n"+ |
"DepthFunc LEQUAL\n"+ |
78 |
"AlphaFunc GREATER 0.1\n"+ |
"BlendFunc SRC_ALPHA ONE_MINUS_SRC_ALPHA\n"+ |
79 |
"Disable BLEND\n"+ // Don't want to enable this by default |
"Color 0 0 0 1\n"+ |
80 |
// as it's fairly expensive |
""; |
81 |
"Enable DEPTH_TEST\n"+ |
if(color != null) { |
82 |
"DepthFunc LEQUAL\n"+ |
return |
83 |
"BlendFunc SRC_ALPHA ONE_MINUS_SRC_ALPHA\n"+ |
"ClearColor " + ColorUtil.colorGLString(color) + " 0\n"+ |
84 |
"Color 0 0 0 1\n"+ |
"ColorMask 1 1 1 1\n"+ |
85 |
""; |
"DepthMask 1\n"+ |
86 |
|
"StencilMask 255\n"+ |
87 |
|
"Clear COLOR_BUFFER_BIT DEPTH_BUFFER_BIT STENCIL_BUFFER_BIT\n"+ |
88 |
|
common; |
89 |
|
} else { |
90 |
|
return |
91 |
|
"ColorMask 1 1 1 1\n"+ |
92 |
|
"DepthMask 1\n"+ |
93 |
|
"StencilMask 255\n"+ |
94 |
|
"Clear DEPTH_BUFFER_BIT STENCIL_BUFFER_BIT\n"+ |
95 |
|
common; |
96 |
|
} |
97 |
|
|
98 |
} |
} |
99 |
|
|
100 |
Vob glList; |
Vob glList; |