Results 1 to 10 of 10

Thread: TBGL_EntitySetTexture

  1. #1
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Rep Power
    160

    TBGL_EntitySetTexture

    I want to use different parts of my texture but at the moment I am stuck with using the whole texture or create multiple displayslists with the appropriate co-ords.

    I can't see how you could add some options but maybe a new keyword instead

    How about

    TBGL_LoadTexturelist TextureFile, TextureIndexStart,TextureCount,SubX,SubY, TextureFiltering [, AnisotropicLevel [, TransparentColor ]

    same functions as TBGL_LoadTexture but

    TextureIndexStart = Starting Texture
    TextureCount = number of textures
    SubX = Size of tile X Axis
    SubY = Size of tile Y Axis

    what do you think ?

    Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
    Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370

  2. #2
    thinBasic MVPs Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Germany
    Age
    59
    Posts
    3,300
    Rep Power
    349

    Re: TBGL_EntitySetTexture

    Quote Originally Posted by Michael Clease
    I want to use different parts of my texture but at the moment I am stuck with using the whole texture or create multiple displayslists with the appropriate co-ords.

    I can't see how you could add some options but maybe a new keyword instead

    How about

    TBGL_LoadTexturelist TextureFile, TextureIndexStart,TextureCount,SubX,SubY, TextureFiltering [, AnisotropicLevel [, TransparentColor ]

    same functions as TBGL_LoadTexture but

    TextureIndexStart = Starting Texture
    TextureCount = number of textures
    SubX = Size of tile X Axis
    SubY = Size of tile Y Axis

    what do you think ?

    Hi Michael,

    do you need this for 3D models or for 2D sprites? Later one is allready developed (in a variation) and will be available with the next TGBL update.

    Cheers
    Michael

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,157
    Rep Power
    736

    Re: TBGL_EntitySetTexture

    Hi Michael,

    Michael said it

    If you need it for something else, would you like this command to create multiple independent textures from one bigger?
    In which order - row/column?


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  4. #4
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Rep Power
    160

    Re: TBGL_EntitySetTexture

    What I am suggesting can be used for both 3D and 2D and its not for sprites.

    would you like this command to create multiple independent textures from one bigger?
    yes, column,row (x,y)

    Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
    Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370

  5. #5
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,157
    Rep Power
    736

    Re: TBGL_EntitySetTexture

    Thank you Mike,

    it should be relatively easy to do, thanks for the suggestion.

    I have one idea - what about doing it like:

    TBGL_LoadTexturesFromTiles fileName, startIndex, numberOfColumns, numberOfRows, TextureFiltering [, AnisotropicLevel [, TransparentColor ]
    Why this way? Imagine you have texture, with 16x32 "subtextures".
    When you change the resolution of bitmap ( but still having 16x32 subtextures ), using your original proposal you would have to recalculate tile sizes in pixels again.
    My syntax is not resolution dependant, all dirty calculations will be done inside command and coder does not have to care.


    Let me know,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  6. #6
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Rep Power
    160

    Re: TBGL_EntitySetTexture

    That looks good. thanks.

    Was I right about Displaylist entities and changing co-ords is not possible?

    Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
    Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370

  7. #7
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,157
    Rep Power
    736

    Re: TBGL_EntitySetTexture

    Hi Mike,

    yes you were 100% correct.

    This problem is very interesting generally, as all solutions have quite strong both pros and cons:
    Multiple objects textured by image from bigger texture
    + easy to implement
    + one texture binded for multiple "graphics"
    - might have performance hit in recalculating the coordinates
    - filtering artifacts can occur ( I call it pixel bleeding but I guess that is not proper term )
    - does not allow repeating

    To do it now via immediate mode ( BeginPoly/EndPoly ) is overkill for lot of objects, using M15 commands could be ok.

    Multiple objects textured by multiple textures
    + easy to implement
    + no filtering problems
    + texture can be repeated
    - binding different texture for different object can mean performance hit on graphic hardware side

    Doable using any approach.


    Petr




    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  8. #8
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,157
    Rep Power
    736

    Re: TBGL_EntitySetTexture

    Developed,

    will be present in next release.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  9. #9
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    52
    Posts
    945
    Rep Power
    111

    Re: TBGL_EntitySetTexture

    hi all, dear michael (2x), petr ...
    and I like this good idea, very useful

    thank you! for...

    Multiple objects textured by image from bigger and multiple texture
    I hope we can handle with new texture functions easier in 2d and 3d world... would be nice for working with tbgl/ui module and for example human bodies, rooms, objects, landscapes, tiles, water and more daily fantasy inputs

    bye, Lionheart
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  10. #10
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,157
    Rep Power
    736

    Re: TBGL_EntitySetTexture

    Developed, will present in next release
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •