arrays - glTexImage2D to Display Intensity Image -


i'm working display image in opengl using glteximage2d, having trouble data types...

the image i'm grabbing slice of larger 3d volume , volsize_pix struct gives dimensions of volume indexing:

unsigned _int8 *orthoplane; orthoplane = new unsigned _int8[volsize_pix.depth * volsize_pix.length]; int orthoplaneidx = 0; int halfway = (int)floor(volsize_pix.width / 2);  ///printf("halfway: %d, volsize_pix.length: %d\n", halfway, volsize_pix.length);  (int vx = 0; vx < volsize_pix.depth; vx++) {     (int vy = 0; vy < volsize_pix.length; vy++)         {             orthoplane[orthoplaneidx] = (unsigned _int8)floor(volume[vx][vy][halfway]);             orthoplaneidx++;         } } 

so, can see, it's intensity image, not rgb. i'm trying pass texture opengl display 2d image follows:

// load texture gluint tex2; glgentextures(1, &tex2); glactivetexture(gl_texture0); // tell opengl use generated texture name glbindtexture(gl_texture_2d, tex2); 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_linear); gltexparameteri(gl_texture_2d, gl_texture_mag_filter, gl_linear); glsizei width2 = volsize_pix.length; glsizei height2 = volsize_pix.depth; glteximage2d(gl_texture_2d, 0, gl_luminance, width2, height2, 0, gl_luminance, gl_unsigned_byte, (glvoid *)orthoplane); 

and reason, screen comes black.

the way i've been able see image if allocate rgb array orthoplane (using same intensity value r/g/b) floating point value. when try use unsigned _uint8, nothing. if keep float , try intensity, fails.

any ideas?


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -