PDA

View Full Version : TBGL_GBufferDefineFromArray - can I do custom vertex types?



ReneMiner
30-10-2012, 13:48
it says:
TBGL_GBufferDefineFromArray( gbHandle, kind , items, VertexArray() [, ColorArray(), NormalArray(), TexCoordArray())

( a "]" bracket is missing somehow)

Now my question is: If I don't use colors, but use Position, Normals and TexCoords - does TBGL recognize what arguments I omit?

If I save the data later to m15-Format - is there some switch to tell which vertex-format has been used?

'thinEdge datafile{1.0.0.6/7} just differ in normals, can I make my own vertex-format so TBGL will read my meshes?

As I see, I can setup vertex-buffer with RGBA-Colors, but m15 seems just to support RGB?

I don't find Materials. Are there any?

Sample \thinBasic\SampleScripts\TBGL\GBuffers\GBuffers_SimpleShape.tBasic just shows a white screen. Has there something inside TBGL been changed so it does not work correctly any more?


EDIT: (don't want to open another thread for this)

called within main-loop each frame

Function is_any_Key() As Long

Local lCount As Long

is_any_Key = FALSE

For lCount = 1 To 255
If TBGL_GetWindowKeyState(hWnd, lCount) Then
tbgl_SetWindowTitle( hWnd, str$(lCount))
is_any_Key = TRUE
Next lCount

End Function

now if i use alt/alt Gr- keys there are returned 5 different values: 17, 18, 162, 164 and 165 - why is that?
I do this because %VK_KEY-constants-list does not tell which keys are assumed with some keys (or I don't understand their meaning from name)


Edit2:
There's some mistake in TBGL_GBufferDefineFromArray-Description:
The table of parameters says for Vertx-Array
"Array of vertices defined as TBGL_tVertex3F for 3D or TBGL_tVertex2F for 2D", also in the following lines.

But I can only find TBGL_tVector3F - and it wouldn't make sense to pass a whole Vertex-type to each parameter though...

Petr Schreiber
30-10-2012, 21:00
Brr,

- so many typos in help file? I will fix it for next release!

- you can't currently ommit color in this situation, I will consider it for future

- M15 file format is what it is, for specific problems you might want to develop own format to better match your needs.

- Materials are defined separately using TBGL_*Material* functions, as described in TBGL help file / Functions list / Materials. They are not part of M15.

- The example SampleScripts\TBGL\GBuffers\GBuffers_SimpleShape.tBasic runs okay here.

- The behavior of TBGL_GetWindowKeyState is based on Win32 native function GetAsyncKeyState



Petr

ReneMiner
31-10-2012, 01:00
I decided to use Display-Lists...
just one question about this: Is there a function like TBGL_ListExists?
Will it crash if I delete a non-existing list or do I have to create a default-list?
Same question for Entity-Exists? How can I find out if there is an Entity to delete? Do I have to remember if it was created?

Edit : also some good news, it works... TBGL is great stuff, makes me happy :dance1:
Edit2: I can draw already... time to get some sleep. ( at 6:18 )
Edit3: another request for textures, I need to know something like

TBGL_TextureGetFreeID()
TBGL_TextureExists()

in general:
all objects should have an TBGL_ObjectExists() to use enable foolproof use of all objects . So I can ask if I can use that thing instead of tracking them- it's quite obfuscating to program it - because I have to take care of this in any Sub or Function in my code and needs lots of variables to store if an element has been created, deleted or whatever.
(for objects like entities that are assigned to a certain scene TBGL_EntityExists() could also return FALSE if does not exist and SceneID if exists...)

The other way would be that any created object acts like this (would be a real effort):

new equate "%TBGL_ANY" = -1 or 0 that I can use if I don't care about that ID, I'll store it somewhere anyway...

for example

myEntityID = TBGL_EntityCreateModelSlot(sceneID, %TBGL_ANY , ParentID, ModelID)
myTextureID = TBGL_LoadTexture TextureFile,%TBGL_ANY, TextureFiltering [, AnisotropicLevel [, TransparentColor ]

...

myObjectID = TBGL_CreateSomeObject([parameters,] %TBGL_ANY [,more parameters...])
Success = TBGL_CreateSomeObject([parameters,] myObjectID [,more parameters... ])

if myObjectID already exists it should be replaced

so if I use %TBGL_ANY as parameter the functions will return the ID of the created object, which I can use to perform something with it.

if I use some positive number (as it is now) it should return just TRUE if succesful created, or FALSE if creation failed. This would make the object-handling much easier.


But canUseIt = TBGL_ObjectExists(myObject) on any object would be a real improvement.

Petr Schreiber
31-10-2012, 19:14
The getFree* were once in my roadplan, but they are not here yet as it more complicated to implement than it looks at first sight (to not break old code). Idea with TBGL_ANY sounds reasonable.

Please do post your suggestions where they belong, that is to support (http://www.thinbasic.com/community/project.php?projectid=3) section. That is the best way to keep track of it. Keeping it one feature per suggestion is needed, otherwise it results in ... mess :)

I also recommend keeping one thread for each question, otherwise it is unmaintainable and the thread has low eductational value for other viewers as it goes from one topic to another.


Petr

ReneMiner
31-10-2012, 19:31
ok. Question is done already. Not solved but I chose another way...