41 |
public static boolean dbg = false; |
public static boolean dbg = false; |
42 |
|
|
43 |
static private GL.Texture tex; |
static private GL.Texture tex; |
|
static private boolean needInit = true; |
|
44 |
static private void loadTex() { |
static private void loadTex() { |
45 |
if (needInit) { |
if (tex == null) { |
46 |
String[] texparam = new String[0]; |
String[] texparam = new String[0]; |
47 |
tex = GL.createTexture(); |
tex = GL.createTexture(); |
48 |
//tex.shade_all_levels(256, 256, 0, 1, "ALPHA", "ALPHA", "line", texparam); |
//tex.shade_all_levels(256, 256, 0, 1, "ALPHA", "ALPHA", "line", texparam); |
49 |
tex.shade(128, 128, 0, 1, "ALPHA", "ALPHA", "line", texparam); |
tex.shade(128, 128, 0, 1, "ALPHA", "ALPHA", "line", texparam); |
|
needInit = false; |
|
50 |
} |
} |
51 |
} |
} |
52 |
|
|
104 |
|
|
105 |
// GL implementation |
// GL implementation |
106 |
// ================= |
// ================= |
107 |
static float[] tmp_floats = new float[3]; |
|
108 |
|
private Vob initVob; |
109 |
|
private Vob lineVob; |
110 |
|
private Vob finishVob; |
111 |
|
|
112 |
public int putGL(VobScene vs, int coordsys1) { |
public int putGL(VobScene vs, int coordsys1) { |
113 |
|
/* |
114 |
|
* Mudyc's original implementation. |
115 |
|
* Left in here until he reads this and the corrected implementation and understands |
116 |
|
* what was wrong. |
117 |
if (needInit) loadTex(); |
if (needInit) loadTex(); |
118 |
|
|
119 |
vs.map.put(GLCache.getCallList( |
vs.map.put(GLCache.getCallList( |
126 |
vs.map.put(cl, coordsys1); |
vs.map.put(cl, coordsys1); |
127 |
vs.map.put(GLCache.getCallList("PopAttrib")); |
vs.map.put(GLCache.getCallList("PopAttrib")); |
128 |
return 0; |
return 0; |
129 |
|
*/ |
130 |
|
if (tex == null) loadTex(); |
131 |
|
if(initVob == null) { |
132 |
|
initVob = GLCache.getCallList( |
133 |
|
"PushAttrib ENABLE_BIT \n"+ |
134 |
|
"Color "+ ColorUtil.colorGLString(color) |
135 |
|
); |
136 |
|
if (dbg) pa("tex:"+tex+", w:"+width+", jS:"+joinStyle+", chain:"+chain+", points"+points); |
137 |
|
lineVob = |
138 |
|
GLRen.createContinuousLine(tex.getTexId(), width, joinStyle, chain, points); |
139 |
|
finishVob = GLCache.getCallList("PopAttrib"); |
140 |
|
} |
141 |
|
|
142 |
|
vs.map.put(initVob); |
143 |
|
vs.map.put(lineVob, coordsys1); |
144 |
|
vs.map.put(finishVob); |
145 |
|
return 0; |
146 |
|
|
147 |
} |
} |
148 |
} |
} |
149 |
|
|
150 |
|
|