Results 1 to 10 of 11

Thread: something that could become a 3d-editor

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,530
    Rep Power
    171

    something that could become a 3d-editor

    In the past I started some 3d-editor-environment all in one window, but there's nothing to edit yet. I copied it from my old computers harddrive to check out for some Sub in there and I won't use it furthermore. So it's just a snoop-in preview how it could look like.

    Guess I'm starting all over again since it's some time ago...

    If anyone needs an idea: have fun with it!
    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
    This is pretty impressive Rene, the GUI looks good!


    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,530
    Rep Power
    171
    Something else - had some idea just seconds before i fell asleep and had to jump up - switch the computer on and type that in. Won't open antoher thread now,

    The program up there should display a texture on a sprite if one uses "Explorer" and browses some images-folder on his/her drives.

    Now I would like to do similar but in some GUI with multiple windows. But I was wondering how I would display a texture-file-preview, or a small image of a mesh to load, or shape-tool where you can select cube,torus, pyramids and stuff to draw them in 3d - yeah I was wondering, how I would display all this in another than TBGL-Window because there is just one- so I thought that would just be like displaying an image in some picture-box or on the form,dialog, whatever. Now my thoughts were browsing a little bit that direction...

    We know how to render to texture,

    ...and there's a way to get the bitmap-data from that texture somehow...?

    Could this be a direction to think of how to use more than just one large or Main-TBGL-Window and use some Image/Static- or Button w/bmp-control-alike element that would display just a texture? Some reserved memory (the bitmap-space) of that control where TBGL can put the "picture" on demand?

    Surely it won't have the speed and i fear that it's not backbuffered - except you have some great idea how to double-buffer the control and synchronize it to OS - and its probably very slow - but it's not meant to display fast changing pictures- so could display static previews of almost anything, maps in games or scenes - anything that can be rendered to a texture - doesn't even have to be in the same scene as in TBGL-Window if using 3d...

    ...now I can go sleep... good night
    Last edited by ReneMiner; 16-02-2013 at 04:51.
    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
    Hi Rene,

    the one large TBGL window can have sub-sections defined using the viewports (TBGL_Viewport). Support for multiple TBGL windows is technically possible, but it won't happen soon.

    You could use this routine to copy contents of TBGL window to canvas:
    %GL_BGRA = &H080E1
    %GL_PACK_ALIGNMENT                   = &H00D05
    %GL_UNSIGNED_BYTE                    = &H01401
    Declare Sub glFlush Lib "opengl32.dll" Alias "glFlush"
    Declare Sub glPixelStorei Lib "opengl32.dll" Alias "glPixelStorei" (ByVal pname As DWord, ByVal param As Long)
    Declare Sub glReadPixelsCustom Import "OPENGL32.DLL" Alias "glReadPixels" ( ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long, ByVal format As DWord, ByVal nType As DWord, ByVal nPixels As DWord )                                                    
         
    Function RenderToCanvas(hWnd As DWord, ctrlID As DWord)
    
      DWord  nWidth, nHeight    
      
      Canvas_Attach(hWnd, ctrlID)
      Canvas_BitmapGet(nWidth, nHeight)
      
      String sBuffer = Repeat$(nWidth * nHeight * 4, $SPC)
      
      glFlush()
      glPixelStorei(%GL_PACK_ALIGNMENT, 1)
      glReadPixelsCustom(0, 0, nWidth, nHeight, %GL_BGRA, %GL_UNSIGNED_BYTE, StrPtr(sBuffer))                       
                    
      Canvas_BitmapSet(sBuffer, nWidth, nHeight)
        
    End Function
    

    Petr
    Last edited by Petr Schreiber; 16-02-2013 at 16:04.
    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,530
    Rep Power
    171
    thanx for this one.
    Is it also possible to display just a TBGL_Texture from memory on the Canvas but not the actual TBGL_Window-Content?
    Or would I have to swap the scenes?
    I think there are missing some Forum-sections as beta-testing and support

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

    yes, it is possible - call the function above once you draw the scene geometry, but without calling TBGL_DrawFrame. This way the screen of TBGL window will not be updated, but Canvas will be.
        TBGL_ClearFrame 
          
          ' -- Draw scene for canvas here
          
        RenderToCanvas(hCanvas, 0) ' -- This will update Canvas      
        
        ' -- Clear the buffers again 
        TBGL_ClearFrame 
                                     
          ' -- Draw the scene for TBGL window                                  
        
        TBGL_DrawFrame ' -- This will update TBGL window
    
    I just noticed the image in Canvas will be upside down, hehe. This is not that huge problem, because you could temporarily turn the camera in scene upside down, and the result will be oriented correctly.

    With the power of GPU, this is faster than manually rearanging the image lines on CPU.


    Petr
    Last edited by Petr Schreiber; 16-02-2013 at 19:06.
    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. My simple editor
    By Aurel in forum Alternative IDEs
    Replies: 38
    Last Post: 10-01-2011, 19:51
  2. Free Icon Editor
    By ErosOlmi in forum Software discussion
    Replies: 0
    Last Post: 31-01-2010, 22:40
  3. ThinAIR editor
    By RobertoBianchi in forum Announcements
    Replies: 2
    Last Post: 09-10-2008, 18:27
  4. What editor?
    By Michael Clease in forum Fixed or cleared errors in help material
    Replies: 7
    Last Post: 31-10-2007, 04:19
  5. [IDE] SED Editor
    By José Roca in forum Power Basic
    Replies: 5
    Last Post: 23-07-2007, 20:07

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
  •