I am working with OpenGL ES 3.0 and using Eclipse NDK for rendering volume data with Google Nexus. I am using AssetManager for loading the volume data which is a raw file of 16 MB to the real device but it's not working. I stored the resource in the Asset folder included headers too but still i am receiving the same error in logcat __load_uniform_float:802>:GL_INVALID_OPERATION I tried to Google some related examples but couldn't find any.
Here is my code:
int LoadVolume()
{
GLubyte *pdata;
const unsigned int BUFFER_SIZE = XDIM*YDIM*ZDIM;
GLubyte buffer[BUFFER_SIZE];
AAssetManager*mgr;
AAsset* asset=AAssetManager_open(mgr,"Engine256.raw",AASSET_MODE_BUFFER);
if(!asset)
{
__android_log_print(ANDROID_LOG_ERROR, "TAG", "_ASSET_NOT_FOUND_");
return 0;
}
pdata=(GLubyte*)AAsset_read(asset,buffer,BUFFER_SIZE);
AAsset_close(asset);
glGenTextures ( 1,&textureId );
glBindTexture ( GL_TEXTURE_3D,textureId );
glTexImage3D ( GL_TEXTURE_3D, 0, GL_RED,XDIM, YDIM, ZDIM, 0,
GL_RED, GL_UNSIGNED_BYTE,pdata);
glTexParameteri ( GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri ( GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri ( GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri ( GL_TEXTURE_3D, GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE );
glTexParameteri ( GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glBindTexture ( GL_TEXTURE_3D, 0 );
return 1;
}