Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3508 Members - Latest Member: NevilleKemp

26. May 2012, 03:10:16 pm
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)setTexCoordData and setTextureCoordinate
Pages: [1]
Print
Author Topic: setTexCoordData and setTextureCoordinate  (Read 375 times)
elijah
Enjoying the stay
*
Offline Offline

Posts: 72


View Profile
« on: 30. August 2010, 02:03:58 pm »

Can somebody explain what is the difference between this two functions. Don't they represents the same thing for multiple textures.
In the MultiTextureTest, I replaced the

geom.setTexCoordData( 1, geom.getTexCoordsData( 0 ) ); to
geom.setTextureCoordinates( 1, 0, gc.getTextureCoordinates2f() );

and the both look the same.

Code:
    {
        final int features = Geometry.COORDINATES | Geometry.TEXTURE_COORDINATES ;

        GeometryConstruct gc = Cube.createGeometryConstructTA( 0.3f, features, false, 2 );
        TriangleArray geom = new TriangleArray( gc.numVertices() );
       
        geom.setCoordinates( 0, gc.getCoordinates() );
       
        geom.setTextureCoordinates( 0, 0, gc.getTextureCoordinates2f() );
       
       //geom.setTexCoordData( 1, geom.getTexCoordsData( 0 ) );       
        geom.setTextureCoordinates( 1, 0, gc.getTextureCoordinates2f() );
       
        return ( new Shape3D( geom, app ) );
    }
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 30. August 2010, 04:43:16 pm »

The difference is memory consumption and the ability to modify the tex-coords of TU 0 and TU 1 without affecting each others.

geom.setTexCoordData( 1, geom.getTexCoordsData( 0 ) ); to

This assigns the float buffer of TU 0 to TU 1 (no copy).

geom.setTextureCoordinates( 1, 0, gc.getTextureCoordinates2f() );

This copies the data from the passed buffer to TU 1.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic