problem with GL_LUMINANCE GL_FLOAT opengl texture

Hello,

i tried to map a 2D luminance texture to CUDA memory.
When I use cudaGraphicsGLRegisterImage to register the texture I always get an error. With GL_RGBA and GL_UNSIGNED_BYTE everything works fine.

Can somebody tell me how to use the new functionality with GL_LUMINANCE / GL_FLOAT textures?

Thanks :rolleyes:

Are you sure the format of your CUDA array matches the format of the OpenGL texture? Please post complete code.

BTW, the semantics of the GL_LUMINANCE format have always been a bit weird, and in OpenGL 4.0 it has been deprecated. You might want to try the new simpler GL_RED format instead.

Thats what I’m using unfortunately not working:

[indent]void createTexture(GLuint tex_name, int size_x, int size_y,GLint format,GLenum typ,GLvoid HostPicture)

{

// Enable Texturing

glEnable(GL_TEXTURE_2D);

// create a texture

glGenTextures(1, tex_name);

glBindTexture(GL_TEXTURE_2D,*tex_name);



// set basic parameters

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

// buffer data

glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, size_x, size_y, 0,GL_LUMINANCE, GL_FLOAT, HostPicture);

//CUT_CHECK_ERROR_GL2();

GLenum gl_error = glGetError();

cutilSafeCall(cudaGraphicsGLRegisterImage(&cuda_tex_screen_resource, *tex_name,

				      GL_TEXTURE_2D, cudaGraphicsMapFlagsReadOnly);  //<-get error here

}[/indent]

I get the error in the last line, when using Lunminance and Float with RGBA it works. External Media

oops, had to delete my post.