Hi Pau,

Pau Moreno wrote:
Hi,

I've create an int matrix[16][256] and I need to pass it to the GPU.
So what I've done is create a osg::Image, but when I have to pass the
data to setImage, I have to do a cast to my data, because it needs an
unsigned char *.

The unsigned char * is just to get the start of your data, it won't throw away information of your data. E.g. we are passing floats and still just point this parameter at the start of the data.


My matrix contains signed ints so I cannot cast it to a unsigned
char, as I loose information. How can I do it?

The problem is not the unsigned char *, but the pixel format of the texture you are passing the data into. You will have to find an int pixel format that supports signed (I'm not sure one exists) or you will have to switch to 16/32 bit float pixel formats on the GPU. The osgprerender has a float path that can give you some hints.

How are you going to process the data? Do you want to do rendering or GPGPU work?

regards
jp


Thanks!

Cheers, Pau

------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=15932#15932





_______________________________________________ osg-users mailing
list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support.

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to