I am having problems getting glEGLImageTargetTexture2DOES to map a native pixmap/EGLImage to a texture.
glEGLImageTargetTexture2DOES is returning error 0x500 GL_INVALID_ENUM
and according to the spec, http://www.khronos.org/registry/gles/extensions/OES/OES_EGL_image.txt
this error is generated when the first parameter is not GL_TEXTURE_2D – which it is in my program.
Cmem creation like this:
EGLint contextConfig=0;
int bufferSize; // 32
width = widthRhs;
height = heightRhs;
params.type = CMEM_HEAP;
params.flags = CMEM_CACHED; //CMEM_NONCACHED; //CMEM_CACHED;
params.alignment = 0x32;
cMemPixmap.virtualAddress = (long) CMEM_alloc (widthheight4, ¶ms);
cMemPixmap.physicalAddress = CMEM_getPhys((void*)cMemPixmap.virtualAddress);
cMemPixmap.ePixelFormat = SGXPERF_ARGB8888;
cMemPixmap.eRotation = 0;
cMemPixmap.width = width;
cMemPixmap.height = height;
cMemPixmap.stride = width * 4;
cMemPixmap.sizeInBytes = width * height * 4;
if(cMemPixmap.physicalAddress & 0xFFF){
printf(“PVR2DMemWrap may have issues with this non-aligned address!n”);
}
Texture mapping like this:
glEnable(GL_TEXTURE_2D);
glGenTextures(1, &texId);
glBindTexture(GL_TEXTURE_2D, texId);
PFNEGLCREATEIMAGEKHRPROC peglCreateImageKHR =
(PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress("eglCreateImageKHR");
if(peglCreateImageKHR == NULL){
printf("eglCreateImageKHR not found!n");
}
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC pglEGLImageTargetTexture2DOES =
(PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress("glEGLImageTargetTexture2DOES");
if(pglEGLImageTargetTexture2DOES == NULL){
printf("glEGLImageTargetTexture2DOES not found!n");
}
EGLint createAttribs[]={
EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
EGL_NONE
};
//create an egl image
EGLImageKHR eglImage = peglCreateImageKHR(GraphicsSystem::EGLSystem::eglDisplay,
EGL_NO_CONTEXT,
EGL_NATIVE_PIXMAP_KHR,
&surface->cMemPixmap,
NULL);
if((err = eglGetError()) != EGL_SUCCESS){
printf("Error after peglCreateImageKHR!, error = %xn", err);
} else {
printf("peglCreateImageKHR Success! n");
}
pglEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)eglImage);
if((err = glGetError()) != 0){
printf("Error after glEGLImageTargetTexture2DOES!, error = %xn", err);
}
Driver info etc, on start of app:
EGL_VERSION = 1.4 build 1.4.14.2616
EGL_VENDOR = Imagination Technologies
EGL_EXTENSIONS = EGL_KHR_image EGL_KHR_image_base EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_vg_parent_image EGL_IMG_context_priority
EGL_CLIENT_APIS = OpenGL_ES OpenVG
GL_EXTENSIONS =
GL_OES_rgb8_rgba8
GL_OES_depth24
GL_OES_vertex_half_float
GL_OES_texture_float
GL_OES_texture_half_float
GL_OES_element_index_uint
GL_OES_mapbuffer
GL_OES_fragment_precision_high
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_EGL_image
GL_OES_required_internalformat
GL_OES_depth_texture
GL_OES_get_program_binary
GL_OES_standard_derivatives
GL_EXT_multi_draw_arrays
GL_EXT_texture_format_BGRA8888
GL_IMG_shader_binary
GL_IMG_texture_compression_pvrtc
GL_IMG_texture_stream2
GL_IMG_texture_npot
GL_IMG_texture_format_BGRA8888
GL_IMG_read_format
GL_IMG_program_binary
-- Any idea why it's not working?
Jamie