hello!

I m new with openSG.so i apply a 640*480 texture on a 64*40 plane....so i must
respecify the texture coordinates(the 640*480 image will be "transformated" 
by openSG in a 1024*512 image...I think).But the result is an image wich is
symetric by a diagonal of my plane...The image is red with a yellow line on the
top,so in the result,the line is on the diagonal.

Can someone tell me what i made wrong?


GeometryPtr Plan= makePlaneGeo (64,48,1,1);
(...)

img = Image::create();
img->set(Image::OSG_RGBA_PF,640,480,1, 1, 0, 0, tab_rgba);
 

texc   = TextureChunk::create();
blendc = BlendChunk::create();
cmat = ChunkMaterial::create();                         
                                

 
 
 beginEditCP(texc);
        texc->setImage     (img);
        texc->setScale   (false);
        
 endEditCP(texc);
 

 beginEditCP(blendc);
      blendc->setSrcFactor  ( GL_SRC_ALPHA           );
      blendc->setDestFactor ( GL_ONE_MINUS_SRC_ALPHA );
 endEditCP(blendc);
 

 beginEditCP(cmat);
      cmat->addChunk(texc);
      cmat->addChunk(blendc);
    
 endEditCP(cmat);


  //So,I respecify the texture coordinates
//because the 640*480 image will be "transformated" 
//by openSG in a 1024*512 image...iI think

GeoTexCoords2fPtr texcoords = GeoTexCoords2f::create();
 beginEditCP(texcoords);
    texcoords->addValue(Vec2f(0,0));
    texcoords->addValue(Vec2f(640.0/1024.0,480.0/512.0));
     texcoords->addValue(Vec2f(0,480.0/512.0));
       
     texcoords->addValue(Vec2f(640.0/1024.0,0));
   
    
     
     
 endEditCP(texcoords);

                                
beginEditCP(Plan);
        Plan->setTexCoords(texcoords);
        Plan->setMaterial(cmat);
                                        
endEditCP(Plan);

(...)


thank you in advance

Olivier



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to