Ben,

http://www.manning.com/selman/onlinebook/Htmls/3DJava_Ch14.htm

Sincerely,

Daniel Selman

Author - "Java 3D Programming"
http://www.manning.com/selman

-----Original Message-----
From: Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED]]On Behalf Of Ben Moxon
Sent: Friday, June 14, 2002 6:46 AM
To: [EMAIL PROTECTED]
Subject: All my textures face the same way


How can I make my textures face "out" of my objects- they all seem to just
want to point along the Z- direction so any faces I create that are at 90
degrees to this just don't show properly at all.

Basically, I've got my object created like this:

 int[] stripCounts= new int[2];
            stripCounts[0]=4;
            stripCounts[1]=4;
 int[] contourCount=new int[2];
            contourCount[0]=1;
            contourCount[1]=1;
  Point3f[] pts=new Point3f[8];
         // front
            pts[0]=A;
            pts[1]=B;
            pts[2]=C;
            pts[3]=D;
         // back
            pts[4]=D;
            pts[5]=C;
            pts[6]=B;
            pts[7]=A;

  GeometryInfo gi = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
        gi.setCoordinates(pts);
        gi.setStripCounts(stripCounts);
        gi.setContourCounts(contourCount);

I know I need to set my texture arrays next, but I can't work out enough
from the docs and various books I have around to make them work. I can
create an array of floating points that loads fine as a texture co-ordinate
set, like this:

float[] textco = { 0.0f, 0.0f, 1.00f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,
                           1.0f, 1.0f, 0.00f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f};
gi.setTextureCoordinateParams(1, 2);
gi.setTextureCoordinates( 0, textco );

The problem is that I don't actually understand where these points are
mapping to- I am still a bit new to the language of 3d programming ( I'm
fine with the concepts, but I don't always know the names ) so I'm finding
it very tricky to actually match one to the other.

 For a set of points like:

A = (0.0, 1.0, 0.0)
B = (0.0, 2.0, 0.0)
C = (0.0, 2.0, 4.0)
D = (0.0, 1.0, 4.0)

I just get a cross section of the texture right along the face.

I know this is probably another a really obvious question but how does the
co-ordinate mapping work?

thanks,

-ben


---------------------------------------
Ben Moxon
newview communications limited
[t] 01483 845394
[e] [EMAIL PROTECTED]
[w] www.newview.co.uk

=========================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to