This is pretty impressive Rene, the GUI looks good!
Petr
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
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
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
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
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
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.
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.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
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
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.
I think there are missing some Forum-sections as beta-testing and support
Hi Rene,
whole lotta of questions, isn't it? I will try to answer them in order...
To just preview the texture, I would draw the texture to canvas control. Canvas_BitmapRender allows you to paint image from disk there.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
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.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?
Up to you, it is not mandatory. Canvas_Attach is just a state switch.Don't I have to detach canvas before the function ends?
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.0could 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?
Import is alias of Lib, you can use both. I don't know why did I use Import here, I could use Lib too.Why's that "Import" instead of "Lib" in the third declaration? Typo?
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?Would it be an idea to built-in this "Snapshot To Control"-method to TBGL?
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
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.
I think there are missing some Forum-sections as beta-testing and support
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 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Bookmarks