From 1bada8cd6e4f340de93cff4a2439835fc3b1456c Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Sun, 9 Aug 2009 17:01:55 -0700 Subject: Begin implementing SimpleMesh and fix some bugs with refcounting and java object destruction tracking. --- libs/rs/rsComponent.cpp | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'libs/rs/rsComponent.cpp') diff --git a/libs/rs/rsComponent.cpp b/libs/rs/rsComponent.cpp index a9318118c5f2..fde62a00d6ca 100644 --- a/libs/rs/rsComponent.cpp +++ b/libs/rs/rsComponent.cpp @@ -15,6 +15,7 @@ */ #include "rsComponent.h" +#include using namespace android; using namespace android::renderscript; @@ -29,7 +30,7 @@ Component::Component() } Component::Component( - DataKind dk, DataType dt, + DataKind dk, DataType dt, bool isNormalized, uint32_t bits) { mType = dt; @@ -41,3 +42,37 @@ Component::Component( Component::~Component() { } + +uint32_t Component::getGLType() const +{ + switch(mType) { + case RS_TYPE_FLOAT: + rsAssert(mBits == 32); + return GL_FLOAT; + case RS_TYPE_SIGNED: + switch(mBits) { + case 32: + return 0;//GL_INT; + case 16: + return GL_SHORT; + case 8: + return GL_BYTE; + } + break; + case RS_TYPE_UNSIGNED: + switch(mBits) { + case 32: + return 0;//GL_UNSIGNED_INT; + case 16: + return GL_UNSIGNED_SHORT; + case 8: + return GL_UNSIGNED_BYTE; + } + break; + } + //rsAssert(!"Bad type"); + //LOGE("mType %i, mKind %i, mBits %i, mIsNormalized %i", mType, mKind, mBits, mIsNormalized); + return 0; +} + + -- cgit v1.2.3-59-g8ed1b