Ok How do I make it so I can texture the object in GDK and use that texture with my shader, do I leave the resource name blank or what?
I leave it blank and I can apply the two texture to a sphere made with dbMakeObjectSphere, but I cant apply it to my custom objects.
void MakeObjectFromStruct(int o)
{
dbMakeMemblock(2,139999);
int num=2;
dbWriteMemblockDword(2,0*4,0x002 + 0x010 + 0x040 + 0x100 );// : `FVF format
dbWriteMemblockDword(2,1*4,9*4 );//`FVF size
dbWriteMemblockDword(2,2*4,1590);//number of vertices
for(int i=0; i<512; i++)
{
if(obj[o].tri[i].on)
{
triverts(o,i,num);
}
}
dbMakeMeshFromMemblock(11,2);
dbDeleteMemblock(2);
obj[o].obj=Find();
dbMakeObject(obj[o].obj,11,0);
dbDeleteMesh(11);
dbPositionObject(obj[o].obj,obj[o].x,obj[o].y,obj[o].z);
dbSetObjectNormals(obj[o].obj);
dbTextureObject(obj[o].obj,0,1);dbTextureObject(obj[o].obj,1,2);
dbSetObjectEffect(obj[o].obj,1);
//dbSetObjectCull(obj[o].obj,0);
//dbColorObject(obj[o].obj,dbRgb(13,13,13));
}
void triverts(int o,int i,int& num)
{
//### MESH DATA ###
//vertex 1
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].xx[0]) ;//vertex x coordinate
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].yy[0]) ;//: `vertex y coordinate
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].zz[0]) ;//: `vertex z coordinate
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].nx[0] );// `normal x coordinate
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].ny[0] );//normal y coordinate
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].nz[0] );// `normal z coordinate
num++; dbWriteMemblockDword( 2,num*4,0 );// `diffuse color
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].u[0] );// `U coordinate
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].v[0] );// `V coordinate
//`vertex 2
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].xx[1]) ;// `vertex x coordinate
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].yy[1]) ;//`vertex y coordinate
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].zz[1]) ;// `vertex z coordinate
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].nx[1]);
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].ny[1]);
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].nz[1]);
num++; dbWriteMemblockDword( 2,num*4,0);
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].u[1]);
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].v[1]);
//`vertex 3
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].xx[2]);// `vertex x coordinate
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].yy[2]);// `vertex y coordinate
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].zz[2]) ;//`vertex z coordinate
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].nx[2]);
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].ny[2]);
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].nz[2]);
num++; dbWriteMemblockDword( 2,num*4,0 );
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].u[2]);
num++; dbWriteMemblockFloat( 2,num*4,obj[o].tri[i].v[2]);
}
My object code.