No textures Showing up in OGRE Rendering View

Problems building or running the engine, queries about how to use features etc.
Post Reply
Winterborne
Gnoblar
Posts: 1
Joined: Tue Apr 08, 2008 1:38 am

No textures Showing up in OGRE Rendering View

Post by Winterborne » Tue Apr 08, 2008 1:52 am

Alright , I've been having this problem for weeks. When I run the file from the debug folder, everything's white, with small triangles of texture flashing in the distance.

Here's the deal:

I started with the Demo_Terrain.h file in the Demo Downloads from the OGRE website. I Build the file and it succeeds with no errors. I go to the debug folder and run the application. Everything works fine except for the texture problem mentioned above.

I'm using Visual C++ Express Edition and the correct corresponding OGRE on Vista. I've checked all the code pertaining to the terrain.cfg file and the textures and compared with another classmates working files. Everything pertaining to the textures are the same. I've tried with and without the model I have inserted into the file and I have the same result. No textures are displayed, with the terrain texture doing that crazy flashing thing, but is besides that, white.

Can anyone give me any help on this? Here's the terrain.h code I have so far:
#include "ExampleApplication.h"
SceneNode *PewNode;
Entity *Pew;
Entity *Test;

RaySceneQuery* raySceneQuery = 0; //ask Bruce??

// Event handler to add ability to alter curvature
class TerrainFrameListener : public ExampleFrameListener
{
public:
TerrainFrameListener(RenderWindow* win, Camera* cam)
: ExampleFrameListener(win, cam)
{
// Reduce move speed
mMoveSpeed = 50;

}

bool frameStarted(const FrameEvent& evt)
{
if( ExampleFrameListener::frameStarted(evt) == false )
return false;

// clamp to terrain
static Ray updateRay;
updateRay.setOrigin(mCamera->getPosition());
updateRay.setDirection(Vector3::NEGATIVE_UNIT_Y);
raySceneQuery->setRay(updateRay);
RaySceneQueryResult& qryResult = raySceneQuery->execute();
RaySceneQueryResult::iterator i = qryResult.begin();
if (i != qryResult.end() && i->worldFragment)
{
mCamera->setPosition(mCamera->getPosition().x,
i->worldFragment->singleIntersection.y + 10,
mCamera->getPosition().z);
}

return true;

}

};



class TerrainApplication : public ExampleApplication
{
public:
TerrainApplication() {}

~TerrainApplication()
{
delete raySceneQuery;
}

protected:


virtual void chooseSceneManager(void)
{
// Get the SceneManager, in this case a generic one
mSceneMgr = mRoot->createSceneManager("TerrainSceneManager");
}

virtual void createCamera(void)
{
// Create the camera
mCamera = mSceneMgr->createCamera("PlayerCam");

// Position it at 500 in Z direction
mCamera->setPosition(Vector3(400,25,400));
// Look back along -Z
mCamera->lookAt(Vector3(420,25,420));
mCamera->setNearClipDistance( 1 );
mCamera->setFarClipDistance( 1000 );

}

// Just override the mandatory create scene method
void createScene(void)
{
Plane waterPlane;

// Set ambient light
mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));

// Create a light
Light* l = mSceneMgr->createLight("MainLight");
// Accept default settings: point light, white diffuse, just set position
// NB I could attach the light to a SceneNode if I wanted it to move automatically with
// other objects, but I don't
l->setPosition(20,80,50);

// Fog
// NB it's VERY important to set this before calling setWorldGeometry
// because the vertex program picked will be different
ColourValue fadeColour(0.93, 0.86, 0.76);
mSceneMgr->setFog( FOG_LINEAR, fadeColour, .001, 500, 1000);
mWindow->getViewport(0)->setBackgroundColour(fadeColour);

std::string terrain_cfg("terrain.cfg");
mSceneMgr -> setWorldGeometry( terrain_cfg );
// Infinite far plane?
if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE))
{
mCamera->setFarClipDistance(0);
}

// Define the required skyplane
Plane plane;
// 5000 world units from the camera
plane.d = 5000;
// Above the camera, facing down
plane.normal = -Vector3::UNIT_Y;

// Set a nice viewpoint
mCamera->setPosition(707,2500,528);
mCamera->setOrientation(Quaternion(-0.3486, 0.0122, 0.9365, 0.0329));
//mRoot -> showDebugOverlay( true );

raySceneQuery = mSceneMgr->createRayQuery(
Ray(mCamera->getPosition(), Vector3::NEGATIVE_UNIT_Y));

PewNode=mSceneMgr->getRootSceneNode()->createChildSceneNode();
Entity *Pew = mSceneMgr->createEntity("Pew", "Pew1.mesh");
PewNode->attachObject(Pew);
PewNode->scale(.05,.02,.02);
PewNode->setPosition(750,10,750);
PewNode->pitch(Degree(90));
//PewNode->roll(Degree());

PewNode=mSceneMgr->getRootSceneNode()->createChildSceneNode();
Entity *Test = mSceneMgr->createEntity("Test", "Pew.mesh");
PewNode->attachObject(Test);
PewNode->scale(1,1,1);
PewNode->setPosition(700,0,700);
PewNode->pitch(Degree(90));
//PewNode->roll(Degree());

}
// Create new frame listener
void createFrameListener(void)
{
mFrameListener= new TerrainFrameListener(mWindow, mCamera);
mRoot->addFrameListener(mFrameListener);
}

};
And here's the terrain.cfg code:
# The main world texture (if you wish the terrain manager to create a material for you)
WorldTexture=terrain_detail.jpg

# The detail texture (if you wish the terrain manager to create a material for you)
DetailTexture=terrain_texture.jpg

#number of times the detail texture will tile in a terrain tile
DetailTile=3

# Heightmap source
PageSource=Heightmap

# Heightmap-source specific settings
Heightmap.image=flat_terra.raw

# If you use RAW, fill in the below too
# RAW-specific setting - size (horizontal/vertical)
Heightmap.raw.size=513
# RAW-specific setting - bytes per pixel (1 = 8bit, 2=16bit)
Heightmap.raw.bpp=1

# How large is a page of tiles (in vertices)? Must be (2^n)+1
PageSize=513

# How large is each tile? Must be (2^n)+1 and be smaller than PageSize
TileSize=65

# The maximum error allowed when determining which LOD to use
MaxPixelError=3

# The size of a terrain page, in world units
PageWorldX=1500
PageWorldZ=1500
# Maximum height of the terrain
MaxHeight=100

# Upper LOD limit
MaxMipMapLevel=5

#VertexNormals=yes
#VertexColors=yes
#UseTriStrips=yes

# Use vertex program to morph LODs, if available
VertexProgramMorph=yes

# The proportional distance range at which the LOD morph starts to take effect
# This is as a proportion of the distance between the current LODs effective range,
# and the effective range of the next lower LOD
LODMorphStart=0.2

# This following section is for if you want to provide your own terrain shading routine
# Note that since you define your textures within the material this makes the
# WorldTexture and DetailTexture settings redundant

# The name of the vertex program parameter you wish to bind the morph LOD factor to
# this is 0 when there is no adjustment (highest) to 1 when the morph takes it completely
# to the same position as the next lower LOD
# USE THIS IF YOU USE HIGH-LEVEL VERTEX PROGRAMS WITH LOD MORPHING
#MorphLODFactorParamName=morphFactor

# The index of the vertex program parameter you wish to bind the morph LOD factor to
# this is 0 when there is no adjustment (highest) to 1 when the morph takes it completely
# to the same position as the next lower LOD
# USE THIS IF YOU USE ASSEMBLER VERTEX PROGRAMS WITH LOD MORPHING
#MorphLODFactorParamIndex=4

# The name of the material you will define to shade the terrain
#CustomMaterialName=TestTerrainMaterial
All of the texture files are in the right places. Any help? I'm desperate at this point and am willing to try just about anything short of downgrading my OS (not enough money to get a copy of XP :( )
0 x

User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
Contact:

Post by Jabberwocky » Tue Apr 08, 2008 5:03 am

Do the ogre sample programs run properly?

Does your ogre.log contain any errors? It might be helpful to post that here as well.
0 x
Image

User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
Contact:

Post by Jabberwocky » Tue Apr 08, 2008 5:04 am

Also, your camera's far clip distance is pretty low. Try making it 100,000 or so.
0 x
Image

gk
Halfling
Posts: 40
Joined: Tue Jan 31, 2006 3:19 pm

ATI card

Post by gk » Sat Apr 26, 2008 7:14 pm

Are you using an ATI card and the OpenGL render plugin?

Try:
a) Using older drivers, Catalyst 7.10 / 7.11
OR
b) Use the Direct3D9 render system instead of OpenGL

I think this is a bug concerning Ogre and any new ATI driver. I know ATI OpenGL drivers aren't famed for their quality but this bug occurs with the 'new improved' opengl driver.

Does this warrant attention from the OGRE developers?
0 x

Post Reply