Revision f8686932
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/Distorted.java | ||
---|---|---|
70 | 70 |
*/ |
71 | 71 |
public static final int CLONE_CHILDREN= 0x10; |
72 | 72 |
|
73 |
private static boolean mInitialized = false; |
|
74 |
|
|
75 | 73 |
static int[] mMainProgramAttributes; |
76 | 74 |
|
77 | 75 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
85 | 83 |
|
86 | 84 |
static boolean isInitialized() |
87 | 85 |
{ |
88 |
return mInitialized;
|
|
86 |
return (mMainProgramAttributes!=null);
|
|
89 | 87 |
} |
90 | 88 |
|
91 | 89 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
105 | 103 |
public static void onCreate(final Context context) |
106 | 104 |
throws FragmentCompilationException,VertexCompilationException,VertexUniformsException,FragmentUniformsException,LinkingException |
107 | 105 |
{ |
108 |
mInitialized = true; |
|
109 |
|
|
110 | 106 |
final InputStream vertexStream = context.getResources().openRawResource(R.raw.main_vertex_shader); |
111 | 107 |
final InputStream fragmentStream = context.getResources().openRawResource(R.raw.main_fragment_shader); |
112 | 108 |
|
... | ... | |
116 | 112 |
mainProgram.bindAndEnableAttributes(); |
117 | 113 |
mMainProgramAttributes = mainProgram.getAttributes(); |
118 | 114 |
|
119 |
int textureUniformH = GLES20.glGetUniformLocation(programH, "u_Texture"); |
|
120 |
|
|
121 | 115 |
GLES20.glEnable (GLES20.GL_DEPTH_TEST); |
122 | 116 |
GLES20.glDepthFunc(GLES20.GL_LEQUAL); |
123 | 117 |
GLES20.glEnable(GLES20.GL_BLEND); |
... | ... | |
125 | 119 |
GLES20.glEnable(GLES20.GL_CULL_FACE); |
126 | 120 |
GLES20.glCullFace(GLES20.GL_BACK); |
127 | 121 |
GLES20.glFrontFace(GLES20.GL_CW); |
128 |
GLES20.glActiveTexture(GLES20.GL_TEXTURE0); |
|
129 |
GLES20.glUniform1i(textureUniformH, 0); |
|
130 | 122 |
|
131 | 123 |
EffectQueueFragment.getUniforms(programH); |
132 | 124 |
EffectQueueVertex.getUniforms(programH); |
133 | 125 |
EffectQueueMatrix.getUniforms(programH); |
126 |
DistortedTexture.getUniforms(programH); |
|
134 | 127 |
|
135 | 128 |
DistortedTree.reset(); |
136 | 129 |
EffectMessageSender.startSending(); |
... | ... | |
149 | 142 |
EffectQueue.onDestroy(); |
150 | 143 |
DistortedEffects.onDestroy(); |
151 | 144 |
EffectMessageSender.stopSending(); |
152 |
|
|
153 |
mInitialized = false;
|
|
145 |
|
|
146 |
mMainProgramAttributes = null;
|
|
154 | 147 |
} |
155 | 148 |
} |
Also available in: Unified diff
Minor.