55 |
protected final TextStyle style; |
protected final TextStyle style; |
56 |
protected final String text; |
protected final String text; |
57 |
protected final boolean baselined; |
protected final boolean baselined; |
58 |
|
protected String textColor = "Color 1 0 0"; |
59 |
|
|
60 |
protected Object key; |
protected Object key; |
61 |
|
|
62 |
|
/** Same as another constructor but in GL side you can give the color |
63 |
|
* with string like "Color 1 0.5 0.5" |
64 |
|
* @param color OpenGL Color used to draw the text. |
65 |
|
*/ |
66 |
|
public TextVob(TextStyle style, String text, boolean baselined, String color) { |
67 |
|
this(style, text, baselined); |
68 |
|
this.textColor = color; |
69 |
|
} |
70 |
|
|
71 |
/** Create a new TextVob. |
/** Create a new TextVob. |
72 |
* @param style The textstyle to use. |
* @param style The textstyle to use. |
73 |
* @param text The text that the Vob should show |
* @param text The text that the Vob should show |
144 |
//g.setClip(oldClip); |
//g.setClip(oldClip); |
145 |
} |
} |
146 |
|
|
147 |
static private Vob start, stop; |
static private Vob start, stop, resetColor; |
148 |
|
private Vob setColor; |
149 |
static public Vob getStartCode() { |
static public Vob getStartCode() { |
150 |
if(start == null) { |
if(start == null) { |
151 |
if (GL.hasExtension("GL_NV_register_combiners")) { |
if (GL.hasExtension("GL_NV_register_combiners")) { |
179 |
return stop; |
return stop; |
180 |
} |
} |
181 |
|
|
182 |
|
private Vob setColor() { |
183 |
|
if(setColor == null) { |
184 |
|
setColor = GLCache.getCallList(this.textColor); |
185 |
|
} |
186 |
|
return setColor; |
187 |
|
} |
188 |
|
static public Vob resetColor() { |
189 |
|
if(resetColor == null) { |
190 |
|
resetColor = GLCache.getCallList("Color 0 0 0"); |
191 |
|
} |
192 |
|
return resetColor; |
193 |
|
} |
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
|
198 |
/** The OpenGL renderable for this TextVob. |
/** The OpenGL renderable for this TextVob. |
199 |
*/ |
*/ |
213 |
1, 1); |
1, 1); |
214 |
} |
} |
215 |
curs = getStartCode().addToListGL(win, list, curs, 0, 0); |
curs = getStartCode().addToListGL(win, list, curs, 0, 0); |
216 |
|
curs = setColor().addToListGL(win, list, curs, 0, 0); |
217 |
curs = ht.addToListGL(win, list, curs, coordsys1, coordsys2); |
curs = ht.addToListGL(win, list, curs, coordsys1, coordsys2); |
218 |
|
curs = resetColor().addToListGL(win, list, curs, 0, 0); |
219 |
curs = getStopCode().addToListGL(win, list, curs, 0, 0); |
curs = getStopCode().addToListGL(win, list, curs, 0, 0); |
220 |
return curs; |
return curs; |
221 |
} |
} |