Switching Textures used by PFX at runtime.

This topic contains 2 replies, has 2 voices, and was last updated by  bootstrapper 3 years, 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #31625

    Hi there,

    I’m writing an app that requires my textures to update at regular intervals – perhaps 4 – 8 times per day.

    Is there support for dynamically loading a new texture and then updating an active PFX to use the new texture.

    If this is possible is there an example of it being done in any of the demos? Most of the demos I’ve seen that switch textures seem to have them all loaded upfront on different texture slots in the PFX. This isn’t possible for me because of size constraints and because I plan for the new texture file to be acquired from the web and updated at run-time.

    Any ideas?

    Andre.

    #38453

    dgu
    Member

    Hello

    During the rendering you can provide your own image (GLuint mytexture for instance ) that can be loaded dynamically or store in an pvr image array.

    in your code :

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, mytexture);

    in the pfx :
    UNIFORM sTexture TEXTURE0

    So as long your texture is binded using glBindTexture you can render it any scheduled time your want.

    regards
    david

    #38454

    Hi David,

    I hadn’t thought about just overwriting the texture unit with a new texture like this. So simple!

    I’ve done it and it works great, thanks for your help 🙂

    Andre.

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.