Jump to content

[SOLVED] Color of pixel when pick.


photo

Recommended Posts

Posted

Hi,

 

I have some difficulty for found a color pixel of my object when I pick on it :

 

I have a plane with diffuse, I want when i pick on it grab the color of the pixel.
 

My first problem, It's for access to the texture of the material, I try to use getImageTextureImage

Image test = new Image();
test.create2D(128,128,IMAGE_FORMAT_RGB8);
mat.getImageTextureImage(mat.findTexture("diffuse"),test); 

I have an error message : GLTexture::getImage(): unknown texture format DXT5

 

I keep the diffuse image inside my class for use it without pass by material,  I use engine.world.getIntersection who return and ret[4] with the uv coordinates,

I convert for have the pixel of my images, but the color is wrong : 

 

Obstacle impacted ... at 0.032473 

Coord UV 0.62822 0.440767 0 0

Coord Pixel 80x56

Color 0 0 0 1

 

some suggestion ?

 

Thanks

 

Tony

 

PS : It's possible to do similar things (pick color pixel) on ObjectSky ??

 

 

 

Posted

Please load an Image from the corresponded file and decompress it from DXT format via Image::decompress() function. After that you can call Image::get2D() function.

Posted

Hi Frustum,

 

Sorry I am not sure to understand, I don't have the image file, I download a bigger image and when i generate the material I use copy for take some part of the image. But I don't keep this image part.

It's for that I was trying to access via getImageTextureImage.

 

Can you explain me more please ?

 

Tony

Posted

getImageTextureImage() function can't return the DXT compressed format. There is no such function in OpenGL API. This function can only get uncompressed (R/RG/RGB/RGBA) image data from video memory.

×
×
  • Create New...