Sam, If I'm understanding you correctly what you really need is to figure the relative proportions for the "artwork". So get the width and height of the original texture and build yourself a "canvas" with the correct proportions to apply the texture to. You might decide on a fixed width and then just use the proportion to calculate the height of your "canvas".
- John Wright Starfire Research Sam Hocking wrote: > > Thanks anyway David. This is new territory for me too! > > I can handle resizing the image to powers of 2 to prevent throwing the > exception and getting them in a scale suitable for the scene, but trying to > build shapes that mimic being the canvas / picture dimensions is tricky. I > think i'll have to go the getWidth(), getHeight() methods of Texture2D > route, and use these to create the box x.y dimensions on-the-fly. > > Thanks again > > Sam > > -----Original Message----- > From: Discussion list for Java 3D API > [mailto:[EMAIL PROTECTED]]On Behalf Of David Rush > Sent: 14 April 2002 17:14 > To: [EMAIL PROTECTED] > Subject: Re: [JAVA3D] texture mapping? > > Sam, > > No you are right the filters do not alter the shape in any way. They work > by either using point sampling of neighbouring texels and using that colour, > or by interpolating among neighbouring texels, depending on which mode you > choose. > > Hmmm I'm not too sure how to go about that really I'm not an expert myself. > But I still thnk that your biggest problem will come with the dimensions of > the images. If they are not of the correct dimensions, an error will > result. This means images must be cropped/resized to be a power of 2 in > width/height prior to creating the texture. This is an even bigger problem > if you don't know the sizes of the images in advance, and especially if > resizing is a problem. > > Sorry I can't be of more help, > David > > -----Original Message----- > From: Discussion list for Java 3D API > [mailto:[EMAIL PROTECTED]]On Behalf Of Sam Hocking > Sent: 14 April 2002 17:03 > To: [EMAIL PROTECTED] > Subject: Re: [JAVA3D] texture mapping? > > Hi David, > > Will setMag/MinFilter resize the *shape* to fit the image dimension that > will map onto it though? From what i can gather it doesn't. > > An easier way for me to explain it might be to assume i have one image which > is a portrait and one a landscape, i want the shape each will be mapped > onto, to be portrait or landscape in the same dimensions. However the > dimensions of each image are not known because they get dynamically loaded > from a database. > > Essentially, artists are submitting digital artwork that then gets mapped to > a virtual piece of canvas (a simple flat box shape!) hanging in a room. > however i don't know the size of this image and i cant resize each image > because it is art, not just a texture that doesn't matter so much! > > Thanks for the response > > Regards > > Sam > > -----Original Message----- > From: Discussion list for Java 3D API > [mailto:[EMAIL PROTECTED]]On Behalf Of David Rush > Sent: 14 April 2002 16:27 > To: [EMAIL PROTECTED] > Subject: Re: [JAVA3D] texture mapping? > > Hello Sam, > > You probably know already but remember your images must be a power of 2 in > width and height otherwise you'll get an exception. How the texture maps to > the shape is determined by the texture coordinates of the shape. The image > will distort to meet the texture coordinates, so the size of the shape > shouldn't matter. > > Java 3D provides minification/magnification filters to eliminate these > effects. Use the setMagFilter(int magFilter) and setMinFilter(int > minFilter) methods of Texture2D to set them respectively. > > Regards, > David Rush > > -----Original Message----- > From: Discussion list for Java 3D API > [mailto:[EMAIL PROTECTED]]On Behalf Of Sam Hocking > Sent: 13 April 2002 19:17 > To: [EMAIL PROTECTED] > Subject: [JAVA3D] texture mapping? > > Hi, > > I'm pretty new to Java3D side of Java (few months) but thanks for your help > recently. > > I'm having trouble using TextureLoader to load digital artwork in jpg format > to then map to various box shapes (i.e. picture frames) in the scene. > > However, i need these box shapes to be created with the same x, y dimensions > as the image texture that will map onto them. i.e the image can not be > distorted to fit the shape, but the shape has to distort to fit the image? > Is there a way i can do this, reasonably simply? I've looked at getWidth(), > getHeight() methods of Texture2D, which i could use to then build the box's > geometry, but just wondered if you experienced people here know of a better > solution or maybe there's a class that does this already? > > Also, is there any ratio i can use between Java3D's units of measurement and > pixel measurements of an image?? I.e. i don't really want minification of > the image because i've created it larger than it has to be for the > transformations it goes through. > > Thanks in advance > > Sam > > =========================================================================== > 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". > > =========================================================================== > 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". > > =========================================================================== > 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".