|
From: Khaerul A. <kha...@gm...> - 2010-06-29 11:34:28
|
Hello my great friends!
I've been trying vpython today and my project target is to display a
series of image into faces... one image for each face, but now it's
not really the problem.
My problem is at the:
materials.texture(mapping='mode')
which I dont have any clue what value to fill in the 'mode' to pass
into the mapping argument, is there any decent resources/reference for
vpython that I can use?
Because after awhile searching the original website I can't find any
"API reference" or something like that.
In case you people want to see my code, here it is:
from visual import *
#using P.I.L (Python Imaging Library)
import Image
#create frame object
f = frame()
#create a red face
model = faces(frame = f)
model.append(pos = (-3,0,-3))
model.append(pos = (-3,0,3))
model.append(pos = (3,0,3))
model.append(pos = (-3,0,-3))
model.append(pos = (3,0,-3))
model.append(pos = (3,0,3))
model.make_normals()
model.make_twosided()
#get material from file
name = 'wgauss'
width = 1840
height = 321
im = Image.open('w-gauss_of_v1.1_0.50_04.png')
materials.saveTGA(name, im)
data = materials.loadTGA(name)
#set model's material
model.material = materials.texture(data=im, mapping='sign')
--
Thanks in advance for any (helpful) reply
|
|
From: Kadir H. <kha...@ya...> - 2010-06-29 14:15:24
|
Khaerul, mapping is either "rectangular", or "spherical". Please see section below: http://vpython.org/contents/docs/visual/materials.html Kadir ________________________________ From: Khaerul Adzany <kha...@gm...> To: vis...@li... Sent: Tue, June 29, 2010 1:36:26 PM Subject: [Visualpython-users] materials.texture(mapping?) Hello my great friends! I've been trying vpython today and my project target is to display a series of image into faces... one image for each face, but now it's not really the problem. My problem is at the: materials.texture(mapping='mode') which I dont have any clue what value to fill in the 'mode' to pass into the mapping argument, is there any decent resources/reference for vpython that I can use? Because after awhile searching the original website I can't find any "API reference" or something like that. In case you people want to see my code, here it is: from visual import * #using P.I.L (Python Imaging Library) import Image #create frame object f = frame() #create a red face model = faces(frame = f) model.append(pos = (-3,0,-3)) model.append(pos = (-3,0,3)) model.append(pos = (3,0,3)) model.append(pos = (-3,0,-3)) model.append(pos = (3,0,-3)) model.append(pos = (3,0,3)) model.make_normals() model.make_twosided() #get material from file name = 'wgauss' width = 1840 height = 321 im = Image.open('w-gauss_of_v1.1_0.50_04.png') materials.saveTGA(name, im) data = materials.loadTGA(name) #set model's material model.material = materials.texture(data=im, mapping='sign') -- Thanks in advance for any (helpful) reply ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first-- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Visualpython-users mailing list Vis...@li... https://lists.sourceforge.net/lists/listinfo/visualpython-users |
|
From: Kadir H. <kha...@ya...> - 2010-06-29 14:34:41
|
.. and also mapping = "sign" is available. ________________________________ From: Kadir Haldenbilen <kha...@ya...> To: Khaerul Adzany <kha...@gm...>; vis...@li... Sent: Tue, June 29, 2010 5:15:14 PM Subject: Re: [Visualpython-users] materials.texture(mapping?) Khaerul, mapping is either "rectangular", or "spherical". Please see section below: http://vpython.org/contents/docs/visual/materials.html Kadir ________________________________ From: Khaerul Adzany <kha...@gm...> To: vis...@li... Sent: Tue, June 29, 2010 1:36:26 PM Subject: [Visualpython-users] materials.texture(mapping?) Hello my great friends! I've been trying vpython today and my project target is to display a series of image into faces... one image for each face, but now it's not really the problem. My problem is at the: materials.texture(mapping='mode') which I dont have any clue what value to fill in the 'mode' to pass into the mapping argument, is there any decent resources/reference for vpython that I can use? Because after awhile searching the original website I can't find any "API reference" or something like that. In case you people want to see my code, here it is: from visual import * #using P.I.L (Python Imaging Library) import Image #create frame object f = frame() #create a red face model = faces(frame = f) model.append(pos = (-3,0,-3)) model.append(pos = (-3,0,3)) model.append(pos = (3,0,3)) model.append(pos = (-3,0,-3)) model.append(pos = (3,0,-3)) model.append(pos = (3,0,3)) model.make_normals() model.make_twosided() #get material from file name = 'wgauss' width = 1840 height = 321 im = Image.open('w-gauss_of_v1.1_0.50_04.png') materials.saveTGA(name, im) data = materials.loadTGA(name) #set model's material model.material = materials.texture(data=im, mapping='sign') -- Thanks in advance for any (helpful) reply ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first-- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Visualpython-users mailing list Vis...@li... https://lists.sourceforge.net/lists/listinfo/visualpython-users |
|
From: Khaerul A. <kha...@gm...> - 2010-06-29 20:27:25
|
Kadir, thank you for the hint! I think I didn't read the page thoroughly (shy)
Now I have another (related) problem, as you can see in my code there is:
width = 1840
height = 321
#an then resize
im = Image.open('w-gauss_of_v1.1_0.50_04.png')
im = im.resize((width,height), Image.ANTIALIAS)
there are the size of the bitmap i'm using and I created a bitmap from
a file an then re-size it, so after using a 'rectangular' as mapping
mode in my materials.texture() my image isn't showing as I expected.
So the real question is: how do you handle that kind of texture (not a
power-of-2 sized texture)? (because I've red it at the example in the
link that a texture has to have a power-of-2 size)
--
again, please, enlighten me
On 6/29/10, Kadir Haldenbilen <kha...@ya...> wrote:
> Khaerul,
>
> mapping is either "rectangular", or "spherical".
>
> Please see section below:
>
> http://vpython.org/contents/docs/visual/materials.html
>
> Kadir
>
>
>
>
>
> ________________________________
> From: Khaerul Adzany <kha...@gm...>
> To: vis...@li...
> Sent: Tue, June 29, 2010 1:36:26 PM
> Subject: [Visualpython-users] materials.texture(mapping?)
>
> Hello my great friends!
> I've been trying vpython today and my project target is to display a
> series of image into faces... one image for each face, but now it's
> not really the problem.
>
> My problem is at the:
>
> materials.texture(mapping='mode')
>
> which I dont have any clue what value to fill in the 'mode' to pass
> into the mapping argument, is there any decent resources/reference for
> vpython that I can use?
> Because after awhile searching the original website I can't find any
> "API reference" or something like that.
>
> In case you people want to see my code, here it is:
>
> from visual import *
>
> #using P.I.L (Python Imaging Library)
> import Image
>
> #create frame object
> f = frame()
>
> #create a red face
> model = faces(frame = f)
> model.append(pos = (-3,0,-3))
> model.append(pos = (-3,0,3))
> model.append(pos = (3,0,3))
> model.append(pos = (-3,0,-3))
> model.append(pos = (3,0,-3))
> model.append(pos = (3,0,3))
> model.make_normals()
> model.make_twosided()
>
> #get material from file
> name = 'wgauss'
> width = 1840
> height = 321
> im = Image.open('w-gauss_of_v1.1_0.50_04.png')
> materials.saveTGA(name, im)
> data = materials.loadTGA(name)
>
> #set model's material
> model.material = materials.texture(data=im, mapping='sign')
>
> --
> Thanks in advance for any (helpful) reply
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first-- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Visualpython-users mailing list
> Vis...@li...
> https://lists.sourceforge.net/lists/listinfo/visualpython-users
>
>
>
>
--
Khaerul Adzany,
Software Developer
Mobile Phone: +628562217552
Yahoo! Messenger: kha...@ya...
|
|
From: Bruce S. <bas...@nc...> - 2010-06-29 20:47:20
|
You just have to do what it says: Each dimension of the texture must be a
power of 2. The image will then be stretched and/or compressed to fill the
rectangle you put it on.
Bruce Sherwood
On Tue, Jun 29, 2010 at 2:27 PM, Khaerul Adzany <kha...@gm...>wrote:
> Kadir, thank you for the hint! I think I didn't read the page thoroughly
> (shy)
>
> Now I have another (related) problem, as you can see in my code there is:
>
> width = 1840
> height = 321
> #an then resize
> im = Image.open('w-gauss_of_v1.1_0.50_04.png')
> im = im.resize((width,height), Image.ANTIALIAS)
>
> there are the size of the bitmap i'm using and I created a bitmap from
> a file an then re-size it, so after using a 'rectangular' as mapping
> mode in my materials.texture() my image isn't showing as I expected.
> So the real question is: how do you handle that kind of texture (not a
> power-of-2 sized texture)? (because I've red it at the example in the
> link that a texture has to have a power-of-2 size)
>
> --
> again, please, enlighten me
>
>
>
|