If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

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.

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...

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.

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)

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?

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.