Example #1
0
	void OGLESTexture3D::Unmap3D(uint32_t array_index, uint32_t level)
	{
		BOOST_ASSERT(0 == array_index);
		KFL_UNUSED(array_index);

		switch (last_tma_)
		{
		case TMA_Read_Only:
			break;

		case TMA_Write_Only:
		case TMA_Read_Write:
			{
				GLint gl_internalFormat;
				GLenum gl_format;
				GLenum gl_type;
				OGLESMapping::MappingFormat(gl_internalFormat, gl_format, gl_type, format_);

				uint32_t const w = this->Width(level);
				uint32_t const h = this->Height(level);
				uint32_t const d = this->Depth(level);

				OGLESRenderEngine& re = *checked_cast<OGLESRenderEngine*>(&Context::Instance().RenderFactoryInstance().RenderEngineInstance());
				re.BindTexture(0, target_type_, texture_);

				if (IsCompressedFormat(format_))
				{
					uint32_t const block_size = NumFormatBytes(format_) * 4;
					GLsizei const image_size = ((w + 3) / 4) * ((h + 3) / 4) * d * block_size;

					if (glloader_GLES_VERSION_3_0())
					{
						glCompressedTexSubImage3D(target_type_, level, 0, 0, 0,
							w, h, d, gl_format, image_size, &tex_data_[level][0]);
					}
					else
					{
						glCompressedTexSubImage3DOES(target_type_, level, 0, 0, 0,
							w, h, d, gl_format, image_size, &tex_data_[level][0]);
					}
				}
				else
				{
					if (glloader_GLES_VERSION_3_0())
					{
						glTexSubImage3D(target_type_, level,
							0, 0, 0, w, h, d, gl_format, gl_type, &tex_data_[level][0]);
					}
					else
					{
						glTexSubImage3DOES(target_type_, level,
							0, 0, 0, w, h, d, gl_format, gl_type, &tex_data_[level][0]);
					}
				}
			}
			break;

		default:
			BOOST_ASSERT(false);
			break;
		}
	}
JNIEXPORT void JNICALL Java_org_lwjgl_opengles_OESTexture3D_nglCompressedTexSubImage3DOES(JNIEnv *__env, jclass clazz, jint target, jint level, jint xoffset, jint yoffset, jint zoffset, jint width, jint height, jint depth, jint format, jint imageSize, jlong dataAddress) {
    glCompressedTexSubImage3DOESPROC glCompressedTexSubImage3DOES = (glCompressedTexSubImage3DOESPROC)tlsGetFunction(783);
    intptr_t data = (intptr_t)dataAddress;
    UNUSED_PARAM(clazz)
    glCompressedTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
}