I created a simple model in Blender and exported it as a .x file successfully imported it into my GDK program. I have a PNG image
that I also created to use as a texture on that model.
For some reason I can't seem to get the texture to load onto the loaded model. I can apply that texture to a sphere or any other shape with the GDK but not the model itself. I'm sure I'm missing some small programming detail but I can't figure it out.
Here's the code. The model and the PNG file are in the same media folder.
#include "DarkGDK.h"
#include "dinput.h"
struct Stars {
float XPos;
float YPos;
int ColorCode;
} Star[2500];
float Distance3D(float x1, float y1, float z1, float x2, float y2, float z2);
float Distance2D(float x1, float y1, float x2, float y2);
void DarkGDK ( void )
{
dbSyncOn ();
dbSyncRate (0);
dbAutoCamOff();
dbSetWindowPosition(100, 100);
dbSetDisplayModeVSync (1024,600,32,1);
dbBackdropOn ();
dbColorBackdrop (dbRgb(0,0,30));
dbPositionCamera ( 0, 0, -10 );
dbLoadObject("galaxy_1.x", 111);
//dbMakeObjectSphere(111, 25, 15, 15);
dbPositionObject(111, 0, 0, 10);
dbLoadImage("galaxy_tex2.png", 1);
dbSetObjectLight(111, 0);
dbTextureObject(111, 1);
dbXRotateObject(111, 45);
int o, i;
while ( LoopGDK ( ) )
{
dbText(0, 0, dbStr(dbScreenFPS()));
dbSync ( );
}
return;
}
float Distance3D(float x1, float y1, float z1, float x2, float y2, float z2)
{
float dx = x1-x2;
float dy = y1-y2;
float dz = z1-z2;
float dist = dbSQRT((dx*dx) + (dy*dy) + (dz*dz));
return dist;
}
float Distance2D(float x1, float y1, float x2, float y2)
{
float dx = x1-x2;
float dy = y1-y2;
float dist = dbSQRT((dx*dx) + (dy*dy));
return dist;
}
Home is where my souped-up computer is...