Ok - I'm "Building" Skybox - versus just loading.
You'll have to Disect this - but this builds a skybox - to get to the specifics - load images with texture flag as false seems to help and so does this set of Settings (Which should be easy to see what I'm doing even though its my own oop wrapper)
// set object Ted_Skybox,1,0,1,0,0,0,0
// This means: Set Object Objid,
// wire,trans,cull,filter, light, fog
//objSkyBox->Set(true,false,true,false,false,false);
objSkyBox->Set(false,true,false,true,true,true);
Now for the Whole Routine I Use for the SkyBox "Apply Method"
//-------------------------------------------------------------------------------------------------
// DbPro Sample had 800 as Starting Size
JGC_OBJECT *JGC_TEDSKY::Apply(JFC_DL *p_ErrorDL, JGC_OBJECTDL *p_ObjDL, JGC_IMAGEDL *p_ImgDL, JGC_CAMERA *p_Cam){
//-------------------------------------------------------------------------------------------------
bool bResult=false;
JGC_IMAGE *imgFr;
JGC_IMAGE *imgLe;
JGC_IMAGE *imgBa;
JGC_IMAGE *imgRi;
JGC_IMAGE *imgUp;
JGC_IMAGE *imgDn;
JGC_OBJECT *objSkyBox;
JGC_CAMERA *oCam;
JFC_STRING *sjCurDir=new JFC_STRING();
sjCurDir->Set(dbGetDir());
if(this->SkyDir->Length()>0){
sjCurDir->Set(dbGetDir());
dbSetDir(this->SkyDir->s);
TED_Sky_Up->Set("6.png");
TED_Sky_Dn->Set("5.png");
TED_Sky_Le->Set("4.png");
TED_Sky_Ri->Set("2.png");
TED_Sky_Fr->Set("1.png");
TED_Sky_Ba->Set("3.png");
};
// c1=height of triangle
// c2=base of triange
// h=long line - hypotoneuse
//float fCamRange=p_Cam->Range_GetFar()/2;
//float c1=fCamRange*(this->TED_Sky_Height*0.01);
//float h=fCamRange;
//float c2=dbSQRT( dbSQRT(h)-dbSQRT(c1) );
float fSize=(p_Cam->Range_GetFar() * 2.0f ) * 0.66f;
int iMesh=0;
bool bTextureFlag=false;
// Load Front Image
if(bResult=p_ImgDL->LoadImage(this->TED_Sky_Fr->Get(),bTextureFlag)){
imgFr = (JGC_IMAGE*)p_ImgDL->Item;
((JFC_DLITEM*)p_ImgDL->Item)->Str->ConCat("SkyBox Front");
}else{
p_ErrorDL->AppendItem("Error Loading Front Image:");
((JFC_DLITEM*)p_ErrorDL->Item)->Str->ConCat(this->TED_Sky_Fr->Get());
((JFC_DLITEM*)p_ErrorDL->Item)->Str->ConCat(" Working Dir:");
((JFC_DLITEM*)p_ErrorDL->Item)->Str->ConCat(sjCurDir->s);
};
if(bResult){
if(bResult=p_ImgDL->LoadImage(this->TED_Sky_Le->Get(),bTextureFlag)){
imgLe = (JGC_IMAGE*)p_ImgDL->Item;
((JFC_DLITEM*)p_ImgDL->Item)->Str->ConCat("SkyBox Left");
}else{
p_ErrorDL->AppendItem("Error Loading Left Image:");
((JFC_DLITEM*)p_ErrorDL->Item)->Str->ConCat(this->TED_Sky_Le->Get());
};
};
if(bResult){
if(bResult=p_ImgDL->LoadImage(this->TED_Sky_Ba->Get(),bTextureFlag)){
imgBa = (JGC_IMAGE*)p_ImgDL->Item;
((JFC_DLITEM*)p_ImgDL->Item)->Str->ConCat("SkyBox Back");
}else{
p_ErrorDL->AppendItem("Error Loading Back Image:");
((JFC_DLITEM*)p_ErrorDL->Item)->Str->ConCat(this->TED_Sky_Ba->Get());
};
};
if(bResult){
if(bResult=p_ImgDL->LoadImage(this->TED_Sky_Ri->Get(),bTextureFlag)){
imgRi = (JGC_IMAGE*)p_ImgDL->Item;
((JFC_DLITEM*)p_ImgDL->Item)->Str->ConCat("SkyBox Right");
}else{
p_ErrorDL->AppendItem("Error Loading Right Image:");
((JFC_DLITEM*)p_ErrorDL->Item)->Str->ConCat(this->TED_Sky_Ri->Get());
};
};
if(bResult){
if(bResult=p_ImgDL->LoadImage(this->TED_Sky_Up->Get(),bTextureFlag)){
imgUp = (JGC_IMAGE*)p_ImgDL->Item;
((JFC_DLITEM*)p_ImgDL->Item)->Str->ConCat("SkyBox Up");
}else{
p_ErrorDL->AppendItem("Error Loading Up Image:");
((JFC_DLITEM*)p_ErrorDL->Item)->Str->ConCat(this->TED_Sky_Up->Get());
};
};
if(bResult){
if(bResult=p_ImgDL->LoadImage(this->TED_Sky_Dn->Get(),bTextureFlag)){
imgDn = (JGC_IMAGE*)p_ImgDL->Item;
((JFC_DLITEM*)p_ImgDL->Item)->Str->ConCat("SkyBox Down");
}else{
p_ErrorDL->AppendItem("Error Loading Down Image:");
((JFC_DLITEM*)p_ErrorDL->Item)->Str->ConCat(this->TED_Sky_Dn->Get());
};
};
//make base object and first limb
if(bResult){
objSkyBox = p_ObjDL->MakePlain(fSize, fSize); // Dbpro Sample had :make object plain Ted_Skybox, size#, size#, 1
fSize=fSize/2;
iMesh=iGetNewID(cnMesh,1);
dbMakeMeshFromObject(iMesh,objSkyBox->ID);
//p_ObjDL->DeleteItem();// Delete Plain
dbDeleteObject(objSkyBox->ID);
dbMakeObjectTriangle(objSkyBox->ID,0, 0, 0, 0, 0, 0, 0, 0, 0);//make object triangle Ted_Skybox, 0, 0, 0, 0, 0, 0, 0, 0, 0
//front limb
objSkyBox->LimbHide(0);
objSkyBox->LimbAdd(1,iMesh);
objSkyBox->LimbTexture(1,imgFr->ID);
objSkyBox->LimbOffset(1,0,0,fSize);
objSkyBox->LimbRotate(1,0,180,0);
//add limbs for sides
objSkyBox->LimbAdd(2,iMesh);
objSkyBox->LimbAdd(3,iMesh);
objSkyBox->LimbAdd(4,iMesh);
objSkyBox->LimbAdd(5,iMesh);
objSkyBox->LimbAdd(6,iMesh);
//remove unneeded mesh
dbDeleteMesh(iMesh);
//right limb
objSkyBox->LimbTexture(2,imgRi->ID);
objSkyBox->LimbOffset(2, 0-fSize, 0, 0);
objSkyBox->LimbRotate(2,0,90,0);
//back limb
objSkyBox->LimbTexture(3,imgBa->ID);
objSkyBox->LimbOffset(3, 0, 0, 0-fSize);
objSkyBox->LimbRotate(3,0,0,0);
//left limb
objSkyBox->LimbTexture(4,imgLe->ID);
objSkyBox->LimbOffset(4, fSize, 0, 0);
objSkyBox->LimbRotate(4,0,270,0);
//top limb
objSkyBox->LimbTexture(5,imgUp->ID);
objSkyBox->LimbOffset(5, 0, fSize, 0);
objSkyBox->LimbRotate(5,270,0,180);
//bottom limb
objSkyBox->LimbTexture(6,imgDn->ID);
objSkyBox->LimbOffset(6, 0, 0-fSize, 0);
objSkyBox->LimbRotate(6,90,0,180);
// these were commented out in DBPro Example
//`set skybox properties
//`tempscale# = sqrt((Ted_cam_Range#^2)/2)
//float tempscale=this->TED_Sky_Height*8;// = 800;
// set object Ted_Skybox,1,0,1,0,0,0,0
// This means: Set Object Objid,
// wire,trans,cull,filter, light, fog
//objSkyBox->Set(true,false,true,false,false,false);
objSkyBox->Set(false,true,false,true,true,true);
//objSkyBox->Scale(tempscale, this->TED_Sky_Height, tempscale);
//objSkyBox->Scale(tempscale*4,tempscale,tempscale*4);
objSkyBox->Scale(100, this->TED_Sky_Height, 100);
objSkyBox->TurnLeft(90.0f); // make sun match ted sun angle default and sun in corner
objSkyBox->FixObjectPivot();
//objSkyBox->ZRead_Off();
//objSkyBox->ZWrite_Off();
};
if(SkyDir->Length()>0){
dbSetDir(sjCurDir->s);
};
delete sjCurDir;
if(bResult){
return objSkyBox;
}else{
return 0;
};
};
//-------------------------------------------------------------------------------------------------
Hope you get ideas from this - note - You may or may not want Cull Flag and Fog flag set - I think culling should be true - dunno - TGC working of culling doesn't (to me sometimes depending what help you read) jive with MSDN explaination of Culled backfaces... )
(I think you want SkyBox backfaces culled - as you can't see em if you're "in" the skybox anyway.)