Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 38

Thread: Terrain-Texturing

  1. #11
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170
    I like speed-ups, especially a few 1000%

    and I altered the IMAGE_SaveBGRA-Function due some idea of Petr
    - to keep compatible with current format I just use a negative value for lWidth when I save the .DataBGRA using now
    File_Put(fNum, STRZIP$(sImageData))
    
    Last edited by ReneMiner; 01-05-2013 at 12:11.
    I think there are missing some Forum-sections as beta-testing and support

  2. #12
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    And this is the other one, IMAGE_BGR_to_BGRA:

    Function IMAGE_BGR_to_BGRA(ByVal sBGRData As String) As String
      Local lPos        As Long
      Local pByteIn     As DWord
      Local pByteOut    As DWord
      Local sImageData  As String
      
      '---Create a new buffer of 4 bytes for each color in BGR string
      sImageData = String$(Len(sBGRData)/3 * 4, Chr$(255))
      
      '---
      pByteIn   = StrPtr(sBGRData) 
      pByteOut  = StrPtr(sImageData) 
    
    
      For lPos = 0 To Len(sBGRData) - 1 Step 3
        Memory_Copy(pByteIn + lPos, pByteOut, 3)
        pByteOut += 4
      Next
       
      Function = sImageData
     
    End Function
    
    Please check results because I didn't make any test.
    Last edited by ErosOlmi; 01-05-2013 at 12:51.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #13
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170
    except the codeline that slipped up somehow to the first line (local lPos) - works perfect.
    I think there are missing some Forum-sections as beta-testing and support

  4. #14
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    oops: copy/paste problem. Fixed.

    In general, to get some speed is always preferred to avoid string concatenation and make in-place bytes changes.
    String concatenation is always a complex and memory/cpu consuming due to many allocation/deallocation steps needed every time it occurs.
    Last edited by ErosOlmi; 01-05-2013 at 12:54.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #15
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170
    Lucky me- the forum is working again - I feared my life is at end

    No- get serious again. I append here because it's about my terrain-texturing stuff which you can see attached to post #13 of this thread. We mastered successful the problem to animate the water in the other thread- but now I got another problem:

    My water was translucent before - means one could see the ground below water-layer. Now I added textures (not in download above) and now the textured ground below water-layer becomes covered by water - the water-animation still is perfect- but I can not look through the water any more. I think it has to do with TBGL_PushBlendFunc %GL_ONE, %GL_ONE and I already tried a lot of combinations there- what can I do so the textured ground becomes visible?
    I think there are missing some Forum-sections as beta-testing and support

  6. #16
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hehe, maybe you will have to get back to alpha in the end, with alpha premanipulated image - TGA can store alpha and TBGL can load 32bit TGAs.

    There is a nice tool to examine blending modes online:
    http://www.andersriggelsen.dk/glblendfunc.php


    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

  7. #17
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170
    I think I will use the simple BGRA-format because I can easily add alpha to any pixel as I want. I don't even need to convert the bmp to tga for that - see above: we got a few ways to manipulate and convert image-data already

    Maybe...surprise...got something to code in mind...'til later

    PS: are all those (your linked tool) switches valid? (for example i don't know %GL_ONE_MINUS_CONTANT_COLOR from TBGL)
    Last edited by ReneMiner; 07-05-2013 at 08:56.
    I think there are missing some Forum-sections as beta-testing and support

  8. #18
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi Rene,

    yes they are valid, but not supported on every OpenGL implementation. The equates are defined in thinBasic_glExt.inc, and you can use them with TBGL_BlendFunc and TBGL_PushBlendFunc in case %GL_ARB_imaging imaging extension is supported. To see, if %GL_ARB_imaging is supported, use TBGL_oglExtensionSupport function.


    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

  9. #19
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170
    Question into the other direction - opposite of TBGL_MakeTexture... is there a way to retrieve the Image-Data-String so I could for example TBGL_LoadTexture(bmp,dib,tga) instantly with native function and get something back like

    myBmp as String = TBGL_GetTextureData(TBGL_GetTextureHandle(textureIndex), %TBGL_DATA_BGRA or whatever possible...)

    as I can retrieve TBGL_GetTextureResolution?
    I think there are missing some Forum-sections as beta-testing and support

  10. #20
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    Hi Rene,

    it is possible, I will add TBGL_GetTextureData to TBGL in ThinBASIC 1.9.7.0.


    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

Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Sphere Texturing
    By zak in forum TBGL General
    Replies: 1
    Last Post: 10-06-2011, 18:40
  2. texturing model by one picture stretched
    By zak in forum TBGL General
    Replies: 3
    Last Post: 11-09-2010, 20:29
  3. M15 texturing - UV Coordinates
    By dcromley in forum M15 file format
    Replies: 5
    Last Post: 06-04-2009, 08:41
  4. 9 terrain matrix
    By kryton9 in forum Resources
    Replies: 13
    Last Post: 05-07-2007, 00:32

Members who have read this thread: 0

There are no members to list at the moment.

Tags for this Thread

Posting Permissions

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