Jump to content

Cylinder and Cones Not Loading Materials


Recommended Posts

It would seem that when using code that materials are not being loaded for cylinders and cones:

 

function App:Start()
    --Create a window
    self.window = Window:Create()
    self.context = Context:Create(self.window)
    self.world = World:Create()
    self.camera = Camera:Create()
    self.camera:SetRotation(35,0,0)
    self.camera:Move(0,0,-1.2)

    local light = DirectionalLight:Create()
    light:SetRotation(35,35,0)

       material = Material:Load("Materials/Developer/bluegrid.mat")

       box = Model:Box()
       box:SetMaterial(material)
       box:SetScale(0.1,0.1,0.1)
       box:SetPosition(0,0.55,-0.8)

       sphere = Model:Sphere()
       sphere:SetMaterial(material)
       sphere:SetScale(0.1,0.1,0.1)
       sphere:SetPosition(0.15,0.55,-0.8)

       --materials not loading for Cylinder or Cone
    cylinder = Model:Cylinder()
       cylinder:SetMaterial(material)
       cylinder:SetScale(0.15,0.65,0.15)
       cylinder:SetPosition(-0.6,0,0)

       cone = Model:Cone()
       cone:SetMaterial(material)
       cone:SetScale(0.15,0.65,0.15)
       cone:SetPosition(-1,0,0)

    return true
end
function App:Loop()

    if self.window:Closed() or self.window:KeyHit(Key.Escape) then return false end
    Time:Update()
    self.world:Update()
    self.world:Render()
    self.context:Sync()
    return true
end

SpEcIeS

Link to comment
Share on other sites

Does setting it recursivly work?

 

Nope - makes no difference.

post-14-0-85290900-1458556097.jpg

 

It appears like there is something wrong with the UV's as there is a hint of blue on the cone/cylinder. If you loaded the orangegrid.mat, you would see a hint of orange.

post-14-0-01848600-1458556414.jpg

  • Upvote 1

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

It looks like the code for generating these primitives does not create texture coordinates.

Bump

Will this be fixed in current beta ?

I have the same problem in C++ but not only cone & cylinder, texturing a box also fails.

in fact I can't get setmaterial to work at all. I can load a textured object, but not change the texture with setmaterial.

original topic here http://www.leadwerks.com/werkspace/topic/14358-cylinder-and-materials/

 

PS: if I use

 

material = Material::create();

material->Load('Materials\Developer\bluegrid.mat');

material->SetColor(1,0,0);

model->SetMaterial(material);

 

the model is displayed in red, but the texture is not visible

 

PS2 : I think this is why people create model duplicates with different textures (http://www.leadwerks.com/werkspace/topic/14572-physics-bug-when-creating-items/) to achieve what SetMaterial can't ... They try to workaround the issue

Windows 7 home - 32 bits

Intel Quad Q6600 - nVidia GTX 460 1GB - 2 GB RAM

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...