Revision 380 Oolite-PC No Fullscreen

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

User avatar
aegidian
Master and Commander
Master and Commander
Posts: 1161
Joined: Thu May 20, 2004 10:46 pm
Location: London UK
Contact:

Post by aegidian »

Try using the following in PlayerEntity.m to reset the characters texture.

Code: Select all

[[universe textureStore] reloadTextures]; // clears the cached references
[hud setPlayer:self]; // resets the reference to the asciitext texture
"The planet Rear is scourged by well-intentioned OXZs."

Oolite models and gear? click here!
dajt
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 364
Joined: Tue Aug 17, 2004 7:05 am
Location: Orange, NSW, Australia

Post by dajt »

Okay, some good news on this one.

I've added that code into the place the OpenGL context is initialised and it certainly sorts out the text. I've #ifdef'd WIN32 so Linux won't be affected.

I'm still having trouble with the ship textures though. Say you launch from the station and switch between fullscreen/windowed mode. The station and docking port disappear and the flashers become blocks. Everything else looks okay, and I think any new ships that turn up will be okay because their texture will be reloaded. It seems any ship already present will have a problem. Although the planet seems to look okay - why would that be?

Is there a way to tell all entities their textures have gone and need to be reloaded?
Regards,
David Taylor.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

The planet isn’t textured.
User avatar
Selezen
---- E L I T E ----
---- E L I T E ----
Posts: 2530
Joined: Tue Mar 29, 2005 9:14 am
Location: Tionisla
Contact:

Post by Selezen »

I thought planets were procedurally textured?

If that's the case, would the planets not look fine even though the graphical textures haven't loaded?
User avatar
aegidian
Master and Commander
Master and Commander
Posts: 1161
Joined: Thu May 20, 2004 10:46 pm
Location: London UK
Contact:

Post by aegidian »

Selezen wrote:
I thought planets were procedurally textured?
Procedurally coloured, but not textured (unless you specify a texture).

It's a nice two-colour subdivision procedure that gets some noise and gradations added to complete the alien-planet look.

Dajt, you should look at the initialiseTextures routine in Entity.m for ideas as to how to invalidate the textures for each entity and force them to be reloaded.

Or wait for/collaborate with Ahruman's new texture handling routines.
"The planet Rear is scourged by well-intentioned OXZs."

Oolite models and gear? click here!
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Flushing textures should be trivial when the new texture and model code in place. With the texture code only, it’s merely relatively easy… I’ll look into setting it up. :-)
dajt
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 364
Joined: Tue Aug 17, 2004 7:05 am
Location: Orange, NSW, Australia

Post by dajt »

I've added a method to the Entity class which looks like this:

Code: Select all

- (void) reloadTextures
{
#ifdef WIN32
    int fi;

    for (fi = 0; fi < n_faces; fi++)
        faces[fi].texName = 0;

	[self initialiseTextures];
	[self generateDisplayList];
#endif
}
I've not made the method itself conditional, only it's contents, because some other platform may need it.

Now this nearly works, but not quite. It reloads some textures but not all. For example, the spinning cobra gets it's skin back, but no details like the front window. The station lights still come up as blocks... I thought it might be subentities causing it, but I did a ShipEntity specific version that reset the subentities as well and it didn't fix the problem. Stars and planets look bad too.

EDIT: Corba doesn't get it's skin back, but because the base model is grey I thought it did. This could be a clue as to why some models get no/incorrect textures.

So progress is being made, but no prize yet.
Last edited by dajt on Wed Apr 12, 2006 6:37 am, edited 1 time in total.
Regards,
David Taylor.
User avatar
aegidian
Master and Commander
Master and Commander
Posts: 1161
Joined: Thu May 20, 2004 10:46 pm
Location: London UK
Contact:

Post by aegidian »

Yes, particles like flashers have a separate texName variable that will need to be reset somehow, best to write a different reloadTextures for the ParticleEntity class.
"The planet Rear is scourged by well-intentioned OXZs."

Oolite models and gear? click here!
dajt
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 364
Joined: Tue Aug 17, 2004 7:05 am
Location: Orange, NSW, Australia

Post by dajt »

Making good progess on this now. Understanding more about texture names and display lists helps.

It seems to work pretty well for Windows now except models sometimes get the wrong textures wrapped around them, or no texture at all.

But it is certainly to the point you can keep playing and most problems sort themselves out after the next witchspace jump.

All the code is conditional for Win32 except for the Entity::reloadTextures as mentioned above, which is present but empty for non-Win32 platforms.

The latest checkin to the trunk fixes planets, stars, nebulae, particles, and ship subentities.
Regards,
David Taylor.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

You may be overcomplicating things. Due to a strange design decision in OpenGL, it is entirely valid to reuse the old texture names in the new context without calling glGenTextures(), as long as you redo the set-up. (This will probably be deprecated, but still useable, in OpenGL 3.0.)
dajt
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 364
Joined: Tue Aug 17, 2004 7:05 am
Location: Orange, NSW, Australia

Post by dajt »

That is what is causing the problem... for some reason on Windows the texture data is corrupted and reusing the old texture names just shows rubbish.

It must be something to do with the Windows drivers, because it doesn't happen on the same PC running Linux.

You have to at least clear the texture names in the entity instances and TextureStore to force new versions to be loaded, and I figured if I'm doing this I may as well delete the corrupt textures and free their video memory.
Regards,
David Taylor.
User avatar
Ponder
Dangerous
Dangerous
Posts: 64
Joined: Fri Mar 31, 2006 2:03 pm
Location: Cardiff, UK

Post by Ponder »

One thing to note: the Kleptohud target stays corrupt at present.
Image
Post Reply