setMaterial not working (i think)

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
void_main
Posts: 5
Joined: Wed Nov 12, 2003 11:50 am

setMaterial not working (i think)

Post by void_main »

Code: Select all

SMaterial m;
m.Lighting = false;
m.MaterialType = EMT_SOLID;
m.Texture1 = driver->getTexture("monster.bmp");

S3DVertex Vertices[8];

Vertices[0] = video::S3DVertex(50,50,50, 1,1,0, video::SColor(255,255,255,255), 0, 0); 
Vertices[1] = video::S3DVertex(50,50,-50, 1,0,0, video::SColor(255,255,255,255), 0, 0); 
Vertices[2] = video::S3DVertex(50,-50,50, 0,1,1, video::SColor(255,255,255,255), 0, 1); 
Vertices[3] = video::S3DVertex(50,-50,-50, 0,0,1, video::SColor(255,255,255,255), 0, 1); 
Vertices[4] = video::S3DVertex(-50,50,50, 0,0,1, video::SColor(255,255,255,255), 1, 0); 
Vertices[5] = video::S3DVertex(-50,50,-50, 0,0,1, video::SColor(255,255,255,255), 1, 0); 
Vertices[6] = video::S3DVertex(-50,-50,50, 0,0,1, video::SColor(255,255,255,255), 1, 1); 
Vertices[7] = video::S3DVertex(-50,-50,-50, 0,0,1, video::SColor(255,255,255,255), 1, 1); 

u16 indices[] = {0,4,6, 0,6,2, 1,3,7, 1,7,5, 0,2,3, 0,3,1, 4,5,7, 4,7,6, 2,6,7, 2,7,3, 0,1,5, 0,5,4}; 

then in my render code:
driver->setMaterial(m);
driver->drawIndexedTriangleList(&Vertices[0], 8, &indices[0], 12);
The cube is displaying correctly, but it's just white, no texture. Any ideas?[/code]
I was going to use "AccessViolation" as my nick, but I almost had a nervous breakdown just typing it.
guest1

Post by guest1 »

should work. The only thing I can think of, is SMaterial is a local variable and not a class variable, so in your initialization code, you set the material to the texture, but in the render code, you have a blank array called "m"
Post Reply