Re: [osg-users] Strange texture problem - can you help me?

2011-04-27 Thread Jochen Saginet
A test on my desktop PC with a ATI Radeon HD4870 and Catalyst 11.2 installed, 
showed up the same bad result as on my ATI mobility card. NVIDIA works great!
Can nobody approve this problem with an ATI card [Question]

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





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


Re: [osg-users] Strange texture problem - can you help me?

2011-04-26 Thread Jochen Saginet
Thanks Robert, for your quick answer. 
The problem seems to be ralated to TexMat and some ATI cards/drivers. 
As I described, there are two textures. One with a small blue Image (16x16px) 
that is clamped to border and one with a bigger red Image (256x256px) that will 
be repeated. 
When I use the same TexGen and TexMat for both textures and render them to a 
quad, the two textures are correctly overlayed (by blending). The corner of 
both texture-images are on the same place and you see no border color (black) 
of the blue texture.
But when I scale only the TexMat of one texture ( for example: the texture with 
the red Image is scaled by 16) and leave the other one as is, the two textures 
are shifted by each other.

See the result i get with a ATI-Card and zoom in the top-right corner:
[Image: http://www.abload.de/thumb/distortleqr.png ] 
(http://www.abload.de/image.php?img=distortleqr.png) 
Do you see the 2px black border of the blue texture? So the blue Texture is 
shifted 2pxdown and left.

Today i had the chance to test my program with a Nvidia card. No problem, when 
i scale one texture Matrix. 

Is that a known Bug with some ATI drivers/card?
I use an ATI Mobility Radeon HD 4250 graphic card with catalyst 9.7. I know 
it's an old version. Will try update tomorrow, and have a look if the problem 
still exists.

Cheers,
Jochen

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





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


Re: [osg-users] Strange texture problem - can you help me?

2011-04-26 Thread Robert Osfield
On Mon, Apr 25, 2011 at 11:26 PM, Jochen Saginet  wrote:
> Can nobody tell me, why the two textures texturRG and textureB are shifted 
> against each other?
> The texGen planes and texture Matrices of both are the same, only textureRG 
> is scaled by 16!!
> I can't find my mistake in thinking :(
>
> *push*

Pop.

I scanned over you post but there is way too much information to
digest and sift out what and what is not important.  I'm not going to
try and understand the details as I have way too much other work to
get through as no doubt have others.  You should strive to be succinct
otherwise you'll loose most of those who might be able to help.

I would suggest simplying the problem and then working your way up to
more complex. For a beginner to dive into texture matrices and
projective texturing it's a rather big leap.  Perhaps you have lots of
OpenGL experience, perhaps not, who knows how much knowledge we can
assume you to have?  You do, not use so that 's enough area you might
wish to convey areas that you might need assistance on.  Please
remember the OSG in essense an OpenGL scene graph so there is thin
layer between OSG classes and OpenGL which means it's often possible
to use OpenGL documentation and tutorials to help you forward - you
needn't rely soley on the OSG community.

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


Re: [osg-users] Strange texture problem - can you help me?

2011-04-25 Thread Jochen Saginet
Can nobody tell me, why the two textures texturRG and textureB are shifted 
against each other?
The texGen planes and texture Matrices of both are the same, only textureRG is 
scaled by 16!!
I can't find my mistake in thinking :(

*push*

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





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


[osg-users] Strange texture problem - can you help me?

2011-04-24 Thread Jochen Saginet
Hi,

I'm a total beginner in OSG and have a strange Problem that i couldn't solve 
and I don't know where it comes from. 
In my little program I create a texture with an Image texImgB(16x16px) and a 
second texture with a bigger Image texImgRG (256x256px). 

h**p://img15.imageshack.us/i/texturesv.png

I created a textureMatrix for each texture, so that the textures will be 
rendered to a Quad from the Perspective of a Viewer (vProjMat - 
ProjectionMatrix, vTransMat - Transformation Matrix). The only diffrence 
between both texture matrices is that I scale the matrix of the 
texImgRG-Texture by 16 in r,s coordinates. So the texImgRG gets 16x smaler than 
before:

h**p://img15.imageshack.us/i/correcte.png

Now the problem:
When i render both textures to the quad and blend them together, the texture 
with the Image texImgB is translated 2px down and left.
Thats the top-right corner of the picture i get from a camera ProjCam (pProjMat 
- ProjectionMatrix, pTransMat - TransformationMatrix) that looks exactly on the 
same face as the Viewer. 

h**p://img715.imageshack.us/i/cornerj.png

Why this? And how can i change my code, so that the texture-Images are not 
Translated to each other? 

Here is my code:

Code:

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include   //Bewegungen

#include 
#include 
#include 

#include 

#include 
#include 


static osg::Geometry* createQuad(   double breite = 4,  
//Breite der Bodenplatte
double 
hoehe = 3,   //Höhe der Bodenplatte
double 
auflBreite = 10, //Auflösung der Breite
double 
auflHoehe = 10)  //Auflösung der Höhe
{
double deltaBreite = (breite / auflBreite);
double deltaHoehe = (hoehe / auflHoehe);


osg::Geometry* quadGeometry = new osg::Geometry();
osg::Vec3Array* quadVertices = new osg::Vec3Array;
osg::Vec3Array* quadNormals = new osg::Vec3Array;
osg::Vec4Array* quadColors = new osg::Vec4Array;
osg::Vec2Array* quadTexcoords = new osg::Vec2Array;
osg::Vec2 dx_texcoord(1.0f/(float)(auflBreite),0.0f);
osg::Vec2 dz_texcoord(0.0f,1.0f/(float)(auflHoehe));

//Vertices über kartesische Koordinaten festlegen
float vx = 0;
float vy = 0;
float vz = 0;

for (int i=0; i<=auflBreite; ++i)
{
for (int j=0; j<=auflHoehe; ++j)
{
//Vektor-Koordinaten
vx = (deltaBreite * i)-(breite/2);
vy = 0;
vz = (deltaHoehe * j)-(hoehe/2);
quadVertices->push_back(osg::Vec3(vx,vy,vz));
quadNormals->push_back( osg::Vec3(0,1,0) );
quadTexcoords->push_back( osg::Vec2(dx_texcoord*i + 
dz_texcoord*j));
quadColors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
}
}
quadGeometry->setVertexArray( quadVertices );
quadGeometry->setTexCoordArray(0, quadTexcoords);
quadGeometry->setColorArray(quadColors);
quadGeometry->setColorBinding(osg::Geometry::BIND_OVERALL);
quadGeometry->setNormalArray( quadNormals );
quadGeometry->setNormalBinding( osg::Geometry::BIND_PER_VERTEX );


//Jewils 4 Vertices zu Primitive "Quad" verbinden
for (int i=0; ipush_back(i*(auflBreite+1)+j);
quadPrim->push_back(i*(auflBreite+1)+j+1);
quadPrim->push_back((i+1)*(auflBreite+1)+j+1);
quadPrim->push_back((i+1)*(auflBreite+1)+j);

quadGeometry->addPrimitiveSet(quadPrim);
}
}

return quadGeometry;
}



//Main-Funktion
int main( int argc, char **argv )
{
// ArgumentParser, verwaltet Übergebene Argumente
osg::ArgumentParser arguments(&argc,argv);


//
//Globale Einstellungen
//
//Projektor
double fovyDeg = 20;
//Öffnungswinkel (in Grad) des Projektions-Frustums
float aspectR = 4.0f/3.0f;  
//Aspect Ratio
float p_dist = 1.0f;
//Abstand des Projektors zum Screen
float near=0.1f;
//Clipping-Ebenen des Frustums (Nähe)
float far=100.0f;   
//Clipping-Ebenen des Frustums (Ferne)