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

Thread: something that could become a 3d-editor

Share/Bookmark
  1. #1
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    47
    Posts
    1,214
    Blog Entries
    1
    Rep Power
    132

    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!
    Windows 10 on
    Desktop: Intel Core i5-3330 @3.0 GHz, 8 GB Ram, nVidia GeForce GT630 2 GB
    Laptop: Intel Core i3-4005U @1.7GHz, 8 GB Ram, nVidia GeForce 940M 2 GB


    The limit is Imagination

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,771
    Blog Entries
    3
    Rep Power
    690
    This is pretty impressive Rene, the GUI looks good!


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  3. #3
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    47
    Posts
    1,214
    Blog Entries
    1
    Rep Power
    132
    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.
    Windows 10 on
    Desktop: Intel Core i5-3330 @3.0 GHz, 8 GB Ram, nVidia GeForce GT630 2 GB
    Laptop: Intel Core i3-4005U @1.7GHz, 8 GB Ram, nVidia GeForce 940M 2 GB


    The limit is Imagination

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,771
    Blog Entries
    3
    Rep Power
    690
    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 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  5. #5
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    47
    Posts
    1,214
    Blog Entries
    1
    Rep Power
    132
    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?
    Windows 10 on
    Desktop: Intel Core i5-3330 @3.0 GHz, 8 GB Ram, nVidia GeForce GT630 2 GB
    Laptop: Intel Core i3-4005U @1.7GHz, 8 GB Ram, nVidia GeForce 940M 2 GB


    The limit is Imagination

  6. #6
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,771
    Blog Entries
    3
    Rep Power
    690
    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 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  7. #7
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    47
    Posts
    1,214
    Blog Entries
    1
    Rep Power
    132
    nice technique though, now I have some more idea what possibilities are offered. The main concern was how to display a texture which the user applies to his mesh, so he can just point to the tU,tV-position on the texture. So I probably won't draw the texture inside 3d-Scene but on a 2d-sprite flat in front -

    This will copy for example a part of the GUI like in my script above attached - onto a canvas and not just the 3d-content of the scene?

    Then I can create my own "Callbacks" (i.e. I have just to take care for mouse-input on canvas) - but there's still the unsolved problems about minimizing, I don't get it and those c++-microsoft-sites don't tell me nothing. Microsoft itself dropped all this anyway. Windows 8 is designed for touchscreen and even vb6.0 does not install properly any more. As a Windows 8 user you do not have access to your own hard-drive as you want. It protects them folders+files and does not give you access to clean up manually. User gets treated as a child that has no idea what it's doing. So maybe thinBasic could go it's own way also could invent it's own unique kind of UI - away from splitted GDI and DirectX or OpenGL. We could run a "TBUIGL"...

    and just for interest:

    Qs about the first script-part:

    Don't I have to detach canvas before the function ends?

    could I omit the Declare Sub glXYZ Lib "opengl32.dll"-lines if I use #INCLUDE "thinbasic_gl.inc" which I would use anyway? Or's that something different?

    Why's that "Import" instead of "Lib" in the third declaration? Typo?


    ...
    Would it be an idea to built-in this "Snapshot To Control"-method to TBGL?
    (so TBGL handles the Y-negafication of the camera-direction also)
    Last edited by ReneMiner; 17-02-2013 at 13:42.
    Windows 10 on
    Desktop: Intel Core i5-3330 @3.0 GHz, 8 GB Ram, nVidia GeForce GT630 2 GB
    Laptop: Intel Core i3-4005U @1.7GHz, 8 GB Ram, nVidia GeForce 940M 2 GB


    The limit is Imagination

  8. #8
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,771
    Blog Entries
    3
    Rep Power
    690
    Hi Rene,

    whole lotta of questions, isn't it? I will try to answer them in order...

    The main concern was how to display a texture which the user applies to his mesh, so he can just point to the tU,tV-position on the texture
    To just preview the texture, I would draw the texture to canvas control. Canvas_BitmapRender allows you to paint image from disk there.

    This will copy for example a part of the GUI like in my script above attached - onto a canvas and not just the 3d-content of the scene?
    Well, its up to you, you can modify the function to copy just a part of the window. The first two parameters of glReadPixels are x, y base, and the other two are width, height of copied area.

    Don't I have to detach canvas before the function ends?
    Up to you, it is not mandatory. Canvas_Attach is just a state switch.

    could I omit the Declare Sub glXYZ Lib "opengl32.dll"-lines if I use #INCLUDE "thinbasic_gl.inc" which I would use anyway? Or's that something different?
    The reason why I did it this way is because I discovered mistake in my OpenGL headers, it will be fixed in ThinBASIC 1.9.3.0

    Why's that "Import" instead of "Lib" in the third declaration? Typo?
    Import is alias of Lib, you can use both. I don't know why did I use Import here, I could use Lib too.

    Would it be an idea to built-in this "Snapshot To Control"-method to TBGL?
    I will think about it, it would need to have more flexible syntax I think, to allow copy of just portion of screen and such... Could you please make a feature suggestion in TBGL area so I don't forget about it?


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  9. #9
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    47
    Posts
    1,214
    Blog Entries
    1
    Rep Power
    132
    oops- was just editing when you already answered...

    So about the current thinbasic_gl.inc: I can still use the one I have in the meantime? What functions or methods are buggy?

    Edit: how about this >>> http://www.cegui.org.uk/wiki/index.php/Main_Page - could'nt that be some library...
    additional link about the same stuff >>> http://sourceforge.net/projects/cray...urce=directory
    additional similar stuff >>> http://sourceforge.net/projects/my-g...urce=directory
    Last edited by ReneMiner; 17-02-2013 at 17:12.
    Windows 10 on
    Desktop: Intel Core i5-3330 @3.0 GHz, 8 GB Ram, nVidia GeForce GT630 2 GB
    Laptop: Intel Core i3-4005U @1.7GHz, 8 GB Ram, nVidia GeForce 940M 2 GB


    The limit is Imagination

  10. #10
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,771
    Blog Entries
    3
    Rep Power
    690
    Hi Rene,

    the statements causing problems in 1.9.x series are those which had parameter defined as BYVAL x AS ANY -> It worked in older versions, but this syntax does not make any sense . Affected routines are:
    glDrawElements, glDrawPixels, glGetTexImage, glIndexPointer, glInterleavedArrays, glNormalPointer, glReadPixels, glTexCoordPointer, glTexImage1D, glTexImage2D, glTexSubImage1D, glTexSubImage2D, glVertexPointer

    It is an issue which has been in the headers since the beginning, but thanks to tolerant parser it was previously interpreted as BYVAL x AS DWORD. All these functions worked before ThinBASIC 1.9.x series (I used glGetTexImage in my article for example).

    The beta ThinBasic 1.9.3.0 will fix the headers so they will work as they should.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

Page 1 of 2 12 LastLast

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

Posting Permissions

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