Skip to main content
gamedev.net
🔒 Locked

Basic texture problem

Started by Barrywei 1 reply 500+ views
Original Post
Barrywei
Barrywei
Here is the code: in c# ------------------------------------------------ Mesh newmesh=null; Texture mytexture=null; public void Initialization() { ... //first built a mesh newmesh=Mesh.Box(device,10,10,10); ... //texture load from a file,I'm sure the filename and the path are correct mytexture=TextureLoader.FromFile(device, @"SEXTXT19.jpg"); device.setTexture(0,mytexture); ... //some code of material,light,world,view,projection matrxi set .. } public void Render() { ... device.BeginScene(); newmesh.DrawSubset(0); device.EndScene(); ... } -------------------------------------------------------- The problem is the result of the present box is not covered with the picture(SEXTXT19.jpg) i gave. The color of the box is always the picture's main color. If i use another picture,the color of the box is going to change as well. why?
Mastaba
Mastaba
I'm not very familiar with managed Direct3D, but are you sure the mesh has texture coordinates assigned when it is created that way?
Barrywei
Barrywei
I look up the mesh class in several books,none of them tell me how to texture on it.It seems that mesh.box(etc)just gives a model without texture coordinate,it's a easy way just for making a model.
eh~~~

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.