diff options
Diffstat (limited to 'libs/rs/rsScriptC.cpp')
-rw-r--r-- | libs/rs/rsScriptC.cpp | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp index 3c4bfa2a5935..60339ecdc2d8 100644 --- a/libs/rs/rsScriptC.cpp +++ b/libs/rs/rsScriptC.cpp @@ -261,6 +261,35 @@ extern "C" void drawTriangleArray(void *vp, RsAllocation alloc, uint32_t count) glDrawArrays(GL_TRIANGLES, 0, count * 3); } +extern "C" void drawRect(void *vp, int32_t x1, int32_t x2, int32_t y1, int32_t y2) +{ + x1 = (x1 << 16); + x2 = (x2 << 16); + y1 = (y1 << 16); + y2 = (y2 << 16); + + int32_t vtx[] = {x1,y1, x1,y2, x2,y1, x2,y2}; + static const int32_t tex[] = {0,0, 0,0x10000, 0x10000,0, 0x10000,0x10000}; + + + ScriptC::Env * env = static_cast<ScriptC::Env *>(vp); + env->mContext->setupCheck(); + + glBindBuffer(GL_ARRAY_BUFFER, 0); + //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, tm->mBufferObjects[1]); + + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_NORMAL_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + + glVertexPointer(2, GL_FIXED, 8, vtx); + glTexCoordPointer(2, GL_FIXED, 8, tex); + //glColorPointer(4, GL_UNSIGNED_BYTE, 12, ptr); + + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); +} + extern "C" void pfBindTexture(void *vp, RsProgramFragment vpf, uint32_t slot, RsAllocation va) { //LOGE("pfBindTexture %p", vpf); @@ -326,8 +355,6 @@ static rsc_FunctionTable scriptCPtrTable = { matrixTranslate, color, - renderTriangleMesh, - renderTriangleMeshRange, pfBindTexture, pfBindSampler, @@ -341,9 +368,16 @@ static rsc_FunctionTable scriptCPtrTable = { disable, scriptRand, - drawTriangleArray, contextBindProgramFragment, - contextBindProgramFragmentStore + contextBindProgramFragmentStore, + + + renderTriangleMesh, + renderTriangleMeshRange, + + drawTriangleArray, + drawRect + }; |