Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: TBGL_TextureRepeatMode

  1. #1
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170

    TBGL_TextureRepeatMode

    As title says: I want to know how to enable the texture-repeat-mode so I can set mesh with tU/tV- values below 0.0 and above 1.0, so it works somewhat like shown below:

    0,1-------------- 1,1  0,2------------- 2,2
    |                  |    |  TEX     TEX   | 
    |      T E X       |    |                |
    |                  |    |  TEX     TEX   |
    0,0------------- 1,0   0,0------------- 2,0
    
    TBGL-Help says, that would be enabled by default but it does not seem to work. Is there an OpenGL-crank to wind?
    Last edited by ReneMiner; 29-03-2013 at 16:02.
    I think there are missing some Forum-sections as beta-testing and support

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

    why do you think it does not work by default, here little example:
    Uses "TBGL"               ' -- Module for 3D graphics
    Uses "File"
    
    Dim hWnd As DWord 
    Dim sTexture As String = APP_SourcePath+"Textures\Test.Bmp"
    
    ' -- Creates window and returns handle by which we can identify it
    hWnd = TBGL_CreateWindowEx("Texturing example, press ESC to quite", 640, 480, 32, %TBGL_WS_WINDOWED) 
    TBGL_ShowWindow 
    
    ' -- Loads texture to slot 1 with MIPMAP filtering  
    If FILE_Exists(sTexture) = FALSE Then
      MsgBox hWnd, "Could not find the following texture:" + $CRLF + sTexture
      TBGL_DestroyWindow
      Stop  
    Else
      TBGL_LoadTexture sTexture, 1, %TBGL_TEX_MIPMAP
    End If  
    
    ' -- Enables aplication of textures to objects
    tbgl_UseTexturing %TRUE
    
    ' -- We will apply texture 1
    tbgl_BindTexture 1
    
    TBGL_ResetKeyState() ' -- Resets status of all keys 
    
    ' -- Main loop
    While TBGL_IsWindow(hWnd) 
      
      ' -- Erases previous frame
      tbgl_ClearFrame 
        
        ' -- Sets camera to look from 0,0,5 to 0,0,0
        tbgl_Camera 0, 0, 5, _
                    0, 0, 0
      
        ' -- Creates quads, shapes with 4 vertices
        TBGL_BeginPoly %GL_QUADS        
          tbgl_TexCoord2D 0, 0        ' -- Texture coordinate, lower left corner
          tbgl_Vertex -1, -1,  0
                  
          TBGL_TexCoord2D 2, 0        ' -- Texture coordinate, lower right corner        
          tbgl_Vertex  1, -1,  0
          
          TBGL_TexCoord2D 2, 2        ' -- Texture coordinate, higher right corner                
          tbgl_Vertex  1,  1,  0        
                  
          TBGL_TexCoord2D 0, 2        ' -- Texture coordinate, higher left corner                        
          tbgl_Vertex -1,  1,  0                
        tbgl_EndPoly
    
      ' -- Finishes drawing
      tbgl_DrawFrame 
    
      ' -- If ESC key is pressed, it will jump out of loop
      If TBGL_GetWindowKeyState( hWnd, %VK_ESCAPE) Then Exit While 
    
    Wend 
    
    ' -- Destroys window
    TBGL_DestroyWindow
    

    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

  3. #3
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170
    On my Entity it looks like this:
    Half of the surface is empty - actually you see the whole texture until center (1.0) and blank from center to the right border. The TBGL_SetTextureRepeatMode(tried all swiches) does not change anything about that.

    (my Entities are "wearing" TBGL_Material where the texture is a part of, so I don't use TBGL_BindTexture but TBGL_PushMaterial before creating displaylist)
    Attached Images Attached Images
    I think there are missing some Forum-sections as beta-testing and support

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    If there something strange, in your neighbourhood, who you gonna call? Well, Petr in this case - but he needs a minimal example for tests, because this behavior is not normal.


    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

  5. #5
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170
    Sorry, I won't upload here. Top-Secret

    PM does not accept attachements any more?
    So I'll be waiting until I meet you in chat to send you a "small" example for testing.
    Maybe it's my "outdated" hardware's fault and it will work fine on your pc
    I think there are missing some Forum-sections as beta-testing and support

  6. #6
    Sorry, I won't upload here. Top-Secret
    Another typical user. Begs everyone for help, blames the language and any extensions that might be used and then when they discover their errors, they are unwilling to share so others can learn from their mistakes.

    Personally I think your rude and could care less about anything other than your issues.

    Most good programmers first try to find working examples of what they are trying to do before using a tool they know nothing about. I don't feel sorry for you in the least and you deserve all the pain you inflect on yourself.
    Last edited by John Spikowski; 30-03-2013 at 18:17.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  7. #7
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170
    So - this supposed to be a helpful post to my problem John?

    I have not discovered the error yet- because -strange however it is - this morning I still was angry about my material and textures not applying correctly and I don't know what exactly I've changed now - but as you can see- now it works...

    If I discover stuff in thinBasic that does not seem to work as I think it has to, then I ask questions like these. So found a lot of stuff that needed some make-over or fixing already - but also a lot of false alerts I gave because lack in flexibility of thinking - but how comes?
    Because I'm actually using thinBasic 8 days a week and 30 hours per day and create something with thinBasic. I have lot's of more questions - theirs answers I find often on other places, so I don't ask them here. I've learned a lot about behaviours that are unique in thinBasic - but also it's possibilities - and not to mention the incredible speed of it while the files are so small...

    And about willing to share: As soon as my program is finished you might have a look at it and I promise you'll stay and stare open-mouth and begging for pardon. The program consists of several units - quite very large - but still undone and I intend to continue writing it which will take at least 3 or 4 more months to be in a releaseble stage.

    And I'm not willing to anyone make some profit from it - that's right! - when it's about the financials - so that's why I keep it "secret" until it comes to an official release. Otherwise, I fear someone will steal my intellectual property and will not just make profit but also protect it from free-use-for-all. That's why it will have to wait until it's done - and as said, Petr would be a person that could have a look at it right now because he's 100% on thinBasic's side and plays big parts behind the curtain, but not you.
    Attached Images Attached Images
    I think there are missing some Forum-sections as beta-testing and support

  8. #8
    I promise you'll stay and stare open-mouth and begging for pardon.
    That promise better be you landing on my front yard with a UFO and inviting me for a ride otherwise you will come up short.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  9. #9

  10. #10
    It's a toss up which is more entertaining, Rene's ego or his unrealistic expectations.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

Page 1 of 2 12 LastLast

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
  •