PDA

View Full Version : Same texture, but different..


aznan
04-25-2008, 10:03 AM
I want to have a model with one texture that can be swapped with another using model.texture("new_tex.jpg"). When swapping back I noticed that the new "first" texture was much darker than the original.

I have attached a scene with two cubes which demonstrates the problem.

What is happening?

aznan
04-28-2008, 10:39 AM
I tried adding a cube without any textures, thinking maybe the original texture blended with the new original, but then it turned completely black. I also tried playing around with model.appearance() and texblend, but to no avail.

Doesn't anyone have a clue as to what is going on?

farshizzo
04-28-2008, 10:51 AM
The cube uses negative values for the texture coordinates. This means you need to enable wrapping on the texture. Try using the following code when adding the texture:tex = viz.addTexture("red2.gif",wrap=viz.REPEAT)Vizards default wrap mode is viz.CLAMP_TO_EDGE, which does not allow for texture coordinates outside the range of [0,1].

aznan
04-29-2008, 02:29 AM
Yup, that was it. Thanks a bunch!