21 |
* Written by Benja Fallenstein and Tuomas Lukka |
* Written by Benja Fallenstein and Tuomas Lukka |
22 |
*/ |
*/ |
23 |
package gzz.vob; |
package gzz.vob; |
24 |
import gzz.gfx.gl.GLRen; |
import gzz.gfx.gl.*; |
25 |
import java.awt.Rectangle; |
import java.awt.Rectangle; |
26 |
import java.awt.Shape; |
import java.awt.Shape; |
27 |
import gzz.client.*; |
import gzz.client.*; |
48 |
super(); |
super(); |
49 |
this.style = style; |
this.style = style; |
50 |
this.text = text; |
this.text = text; |
51 |
this.scale = -1; |
this.scale = 1; |
52 |
} |
} |
53 |
|
|
54 |
public TextVob(TextStyle style, float scale, String text) { |
public TextVob(TextStyle style, float scale, String text) { |
108 |
g.setClip(oldClip); |
g.setClip(oldClip); |
109 |
} |
} |
110 |
|
|
111 |
|
static private Vob start, stop; |
112 |
|
static public Vob getStartCode() { |
113 |
|
if(start == null) { |
114 |
|
start = GLCache.getCallList( |
115 |
|
" PushAttrib ENABLE_BIT TEXTURE_BIT \n"+ |
116 |
|
" Enable REGISTER_COMBINERS_NV \n" + |
117 |
|
" CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1 \n" + |
118 |
|
" CombinerParameterNV CONSTANT_COLOR0_NV 0 0 0 0.4 \n" + |
119 |
|
" CombinerInputNV COMBINER0_NV ALPHA VARIABLE_A_NV TEXTURE0 UNSIGNED_IDENTITY_NV ALPHA \n" + |
120 |
|
" CombinerInputNV COMBINER0_NV ALPHA VARIABLE_B_NV CONSTANT_COLOR0_NV UNSIGNED_IDENTITY_NV ALPHA \n" + |
121 |
|
" CombinerOutputNV COMBINER0_NV ALPHA SPARE0_NV DISCARD_NV DISCARD_NV SCALE_BY_FOUR_NV NONE FALSE FALSE FALSE \n" + |
122 |
|
" \n" + |
123 |
|
" FinalCombinerInputNV VARIABLE_A_NV ZERO UNSIGNED_IDENTITY_NV RGB \n" + |
124 |
|
" FinalCombinerInputNV VARIABLE_B_NV ZERO UNSIGNED_IDENTITY_NV RGB \n" + |
125 |
|
" FinalCombinerInputNV VARIABLE_C_NV ZERO UNSIGNED_IDENTITY_NV RGB \n" + |
126 |
|
" FinalCombinerInputNV VARIABLE_D_NV PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB \n" + |
127 |
|
" \n" + |
128 |
|
" FinalCombinerInputNV VARIABLE_G_NV SPARE0_NV UNSIGNED_IDENTITY_NV ALPHA \n" + |
129 |
|
""); |
130 |
|
} |
131 |
|
return start; |
132 |
|
} |
133 |
|
static public Vob getStopCode() { |
134 |
|
if(stop == null) { |
135 |
|
stop = GLCache.getCallList("PopAttrib"); |
136 |
|
} |
137 |
|
return stop; |
138 |
|
} |
139 |
|
|
140 |
|
|
141 |
/** The OpenGL renderable for this TextVob. |
/** The OpenGL renderable for this TextVob. |
142 |
*/ |
*/ |
143 |
private GLRen.HorizText2 ht; |
private GLRen.HorizText2 ht; |
|
static Vob cl; // Color callList - XXX Should be removed - |
|
|
// color should come from outside. |
|
144 |
public int addToListGL(GraphicsAPI.Window win, |
public int addToListGL(GraphicsAPI.Window win, |
145 |
int[] list, int curs, int coordsys1, |
int[] list, int curs, int coordsys1, |
146 |
int coordsys2) { |
int coordsys2) { |
152 |
text, gls.theFont.getHeight(), gls.theFont.getYOffs(), |
text, gls.theFont.getHeight(), gls.theFont.getYOffs(), |
153 |
scale * gls.fontScale, 0); |
scale * gls.fontScale, 0); |
154 |
} |
} |
155 |
if(cl == null) { |
curs = getStartCode().addToListGL(win, list, curs, 0, 0); |
|
cl = GLRen.createCallList("Color 0 0 0 1"); |
|
|
} |
|
|
curs = cl.addToListGL(win, list, curs, coordsys1, 0); |
|
156 |
curs = ht.addToListGL(win, list, curs, coordsys1, coordsys2); |
curs = ht.addToListGL(win, list, curs, coordsys1, coordsys2); |
157 |
|
curs = getStopCode().addToListGL(win, list, curs, 0, 0); |
158 |
return curs; |
return curs; |
159 |
} |
} |
160 |
|
|