Re: [osg-users] Save texture changes via fragment shader

2010-10-18 Thread Aitor Ardanza
Hi Delport, Yes, I have implemented this already ... I have: - Complex model vertex picking. - Texture coordinates of the vertex I need the texture coordinates of the picked vertex area, projected in the model to paint the area, like this: [Image:

Re: [osg-users] Save texture changes via fragment shader

2010-10-18 Thread J.P. Delport
Hi, On 18/10/10 09:19, Aitor Ardanza wrote: Hi Delport, Yes, I have implemented this already ... I have: - Complex model vertex picking. - Texture coordinates of the vertex I need the texture coordinates of the picked vertex area, projected in the model to paint the area, like this: [Image:

Re: [osg-users] Save texture changes via fragment shader

2010-10-15 Thread J.P. Delport
Hi, On 14/10/10 17:26, Aitor Ardanza wrote: Sorry for my explanation, but my level of English is not very good ... I would need two textures, an original model and a modified one, which are applied to the model. I assume you have the original texture (O) loaded from file. Prerender RTT

Re: [osg-users] Save texture changes via fragment shader

2010-10-15 Thread Aitor Ardanza
Yeah, I understand it... but I can't work on a quad, because I need to compare the position of the picking and the vertex in the vertex shader, and depending on the distance between them make a new texture Doing on a quad, the resulting image would be the next: [Image:

Re: [osg-users] Save texture changes via fragment shader

2010-10-15 Thread J.P. Delport
OK, so we've finally arrived at your problem :) On 15/10/10 14:31, Aitor Ardanza wrote: Yeah, I understand it... but I can't work on a quad, because I need to compare the position of the picking and the vertex in the vertex shader, and depending on the distance between them make a new texture

Re: [osg-users] Save texture changes via fragment shader

2010-10-14 Thread J.P. Delport
Hi, a few things... On 07/10/10 11:33, Aitor Ardanza wrote: Frederic Bouvier wrote: // load texture as an image imgTexture = osgDB::readImageFile(model/BAKE_OVERRIDE.jpg); // if the image is successfully loaded if (imgTexture) { imgTexture-allocateImage(3500, 3500, 1, GL_RGBA,

Re: [osg-users] Save texture changes via fragment shader

2010-10-14 Thread Aitor Ardanza
I don't know if this method helps me get what I want ... RTT give me an image of the model from configured camera, but I need to take an image, like model texture, painting only specific areas defined in the fragment shader: Code: uniform vec2 textCoord; uniform sampler2D baseMap; uniform vec3

Re: [osg-users] Save texture changes via fragment shader

2010-10-14 Thread J.P. Delport
Hi, I'm still not sure what you want to save... Just the texture data? You can get an osg::Image for any or all of the RTT textures. Have a look at osgmultiplerendertargets.cpp example. Read below the line: // we can also read back any of the targets as an image, modify this image and push

Re: [osg-users] Save texture changes via fragment shader

2010-10-14 Thread Aitor Ardanza
J.P. Delport wrote: Hi, You can get an osg::Image for any or all of the RTT textures. Have a look at osgmultiplerendertargets.cpp example. Read below the line: // we can also read back any of the targets as an image, modify this image and push it back Yeah, I've been playing and I

Re: [osg-users] Save texture changes via fragment shader

2010-10-14 Thread J.P. Delport
Hi, what comes out of the RTT camera is just a texture (or textures). What's in the texture depends on what the camera is looking at (for no shader), what it's looking at plus some processing on the output pixels (fragment shader) or completely on shader code (ignore the scene and just use

Re: [osg-users] Save texture changes via fragment shader

2010-10-14 Thread Aitor Ardanza
Sorry for my explanation, but my level of English is not very good ... I would need two textures, an original model and a modified one, which are applied to the model. Thanks for your patience! Cheers, Aitor -- Read this topic online here:

Re: [osg-users] Save texture changes via fragment shader

2010-10-13 Thread Aitor Ardanza
some help with this? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32697#32697 ___ osg-users mailing list osg-users@lists.openscenegraph.org

Re: [osg-users] Save texture changes via fragment shader

2010-10-07 Thread Aitor Ardanza
Frederic Bouvier wrote: // load texture as an image imgTexture = osgDB::readImageFile(model/BAKE_OVERRIDE.jpg); // if the image is successfully loaded if (imgTexture) { imgTexture-allocateImage(3500, 3500, 1, GL_RGBA, GL_UNSIGNED_BYTE); Why are you reallocating space for an

Re: [osg-users] Save texture changes via fragment shader

2010-10-06 Thread Aitor Ardanza
I only found example of render to texture of the camera ... How I had to do to have multiple render targets? like: Code: fragment shader void main(void) { gl_FragData[0] = vec4(1.0, 0.0, 0.0, 1.0); gl_FragData[1] = vec4(0.4, 0.4, 0.0, 1.0); } Thank you! Cheers, Aitor

Re: [osg-users] Save texture changes via fragment shader

2010-10-06 Thread Aitor Ardanza
I do not get it to work I follow these steps: Code: // load texture as an image imgTexture = osgDB::readImageFile(model/BAKE_OVERRIDE.jpg); // if the image is successfully loaded if (imgTexture) { imgTexture-allocateImage(3500, 3500, 1, GL_RGBA, GL_UNSIGNED_BYTE); // create a

Re: [osg-users] Save texture changes via fragment shader

2010-10-06 Thread Frederic Bouvier
// load texture as an image imgTexture = osgDB::readImageFile(model/BAKE_OVERRIDE.jpg); // if the image is successfully loaded if (imgTexture) { imgTexture-allocateImage(3500, 3500, 1, GL_RGBA, GL_UNSIGNED_BYTE); Why are you reallocating space for an image loaded from file ?

Re: [osg-users] Save texture changes via fragment shader

2010-10-05 Thread Aitor Ardanza
I asked this question in gamedev forum, and they would suggest the following: You can not do it like you have in your example. You need to set up an FBO with multiple render targets, and bind your editedMap as one of the targets. But I dont have idea how can I do this... How can I configure

[osg-users] Save texture changes via fragment shader

2010-09-29 Thread Aitor Ardanza
Hi, I'm trying to implement a simple model painter. I detect the intersection with the mouse and loaded model, and I applied a red color to the area: [Image: http://img818.imageshack.us/img818/9672/painting.jpg ] You can see the selected point on the texture image. I edit the texture image