Results 1 to 10 of 10

Thread: OOP sample

  1. #1
    Member DirectuX's Avatar
    Join Date
    Oct 2018
    Location
    France
    Posts
    417
    Rep Power
    55

    Exclamation OOP sample

    Maybe related to my other posts about udt and oop ,

    while studying the oop samples, I found that thinBasic\SampleScripts\OOP\VariadicArrayAndType.tbasic sample has an error code 102 "Expected equal sign for UDT full buffer assignment or an UDT element name." at line 23.

    but I didn't catch the meaning of the description.

    Uses "Console"
    
    Type SubType 
      data As String  
      
      Function _Create(ByVal data As String)
        Me.data = data
        PrintL "Subtype created" In 12
      End Function
     
      Function _Destroy()
        Me.data = ""
        PrintL "Subtype destroyed" In 12
      End Function
     
    End Type
    
    Type Base
      s As SubType
     
      Function _Create(ByVal data As String)
        PrintL "Base created" In 10
        Me.s._Create(data)
      End Function
     
      Function _Destroy()
        Me.s._Destroy
        PrintL "Base destroyed" In 10
      End Function
    
    End Type
    
    PrintL f((116, 104, 105, 110, 66, 97, 115, 105, 99)) In 11
    
    WaitKey
    
    Function f( x(Any) As Byte) As String
     
      Dim b As Base(Memory_Get(VarPtr(x(1)), UBound(x)))
      
      Function = b.s.data 
          
      b._Destroy  
      PrintL "should print empty quotes now" & $DQ & b.s.data & $DQ In 8
      PrintL
      PrintL "result as follows:"
      
    End Function
    
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

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

    thanks a lot for reporting it. I think some recent change in parsing does not allow to call underscored methods.

    Definitely worth further investigation, with fix or adjusted example as a result.


    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
    Member matthew's Avatar
    Join Date
    Mar 2007
    Location
    England
    Age
    47
    Posts
    489
    Rep Power
    66
    Yes I think it does appear to be a problem with underscored methods. I recently got a new computer and wanted to try out the OpenGL reporting tool from this thread and got the same error. I'm using the newest version of thinBasic v1.11.2.0.
    Operating System: Windows 10 Home 64-bit
    CPU: Intel Celeron N4000 CPU @ 1.10GHz
    Memory: 4.00GB RAM
    Graphics: Intel UHD Graphics 600

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

    I fixed the issue with the OpenGL report tool, please re-download.

    As thinBASIC introduced underscore methods as system ones (destructor/constructor - _create, _destroy), I think it would be wise to reserve them really to thinBASIC and not use them in normal code to avoid further collisions in the future.


    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
    Member matthew's Avatar
    Join Date
    Mar 2007
    Location
    England
    Age
    47
    Posts
    489
    Rep Power
    66
    Thanks Petr, it works fine now. I've uploaded the report here if anyone's interested. The new computer isn't anything special, just a cheap laptop but I'm quite surprised at what it can do.
    Operating System: Windows 10 Home 64-bit
    CPU: Intel Celeron N4000 CPU @ 1.10GHz
    Memory: 4.00GB RAM
    Graphics: Intel UHD Graphics 600

  6. #6
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736
    Intel does a great job on feature support & technical papers in the last years, in my opinion. Congratulations on new PC - I wish you many pleasant projects

    GL_ARB_DIRECT_STATE_ACCESS is the extension I would like to play more this year - and your GPU supports it


    Petr
    Last edited by Petr Schreiber; 01-01-2020 at 15:15.
    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. #7
    Member DirectuX's Avatar
    Join Date
    Oct 2018
    Location
    France
    Posts
    417
    Rep Power
    55
    Quote Originally Posted by Petr Schreiber View Post
    GL_ARB_DIRECT_STATE_ACCESS is the extension I would like to play more this year - and your GPU supports it
    GL_ARB_direct_state_access
    In unextended OpenGL, most mutation of state contained in objects is through
    an indirection known as a binding. Objects are attached to a context (either
    directly or indirectly via a container) and then commands to modify or
    query their state are issued on that context, indirecting through its
    attachments and into the underlying object. This is known as `bind-to-edit'.

    This extension derives from the GL_EXT_direct_state_access extension, which
    added accessors for most state on most objects, allowing it to be queried
    and modified without the object needing to be bound to a context. In cases
    where a single property of an object is to be modified, directly accessing
    its state can be more efficient than binding the object to the context and
    then indirecting through it. Further, directly accessing the state of
    objects through their names rather than by bind-to-edit does not disturb
    the bindings of the current context, which is useful for tools, middleware
    and other applications that are unaware of the outer state but it can also
    avoid cases of redundant state changes. (...)
    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

  8. #8
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736
    Unlimited p.o.w.e.r - I have seen demos where it brought really crazy performance benefits.


    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. #9
    Member DirectuX's Avatar
    Join Date
    Oct 2018
    Location
    France
    Posts
    417
    Rep Power
    55

    Wink

    Quote Originally Posted by Petr Schreiber View Post
    Unlimited p.o.w.e.r
    Petr, we all know where that gets ...

    ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64

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


    ...but the performance benefits are worth it.


    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

Similar Threads

  1. TBEM sample - Add an event
    By Michael Hartlef in forum TBEM module - thinBasic Event Manager module
    Replies: 0
    Last Post: 18-10-2008, 19:07
  2. Sample playback
    By Michael Clease in forum TBASS
    Replies: 9
    Last Post: 04-11-2007, 22:25
  3. 3D ind 2D sample
    By Michael Hartlef in forum TBGL Scripts and Projects
    Replies: 8
    Last Post: 29-10-2007, 08:08
  4. ODE Sample #02.01
    By ErosOlmi in forum ODE - Open Dynamics Engine
    Replies: 1
    Last Post: 10-08-2007, 22:50
  5. ODE Sample #02.02
    By ErosOlmi in forum ODE - Open Dynamics Engine
    Replies: 2
    Last Post: 10-08-2007, 16:06

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
  •