Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Learning Embarcadero 3d using your LowLevel3D sample code



Permlink Replies: 2 - Last Post: Feb 12, 2016 12:46 AM Last Post By: peter larson
David Patte

Posts: 7
Registered: 1/23/98
Learning Embarcadero 3d using your LowLevel3D sample code
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 3, 2014 7:20 PM
I recently discovered your low LowLevel3d sample project in
Studio/14.0/Samples/CPP/Mobile Samples/User Interface/LowLevel3d

Reading over this code has been very useful in helping me understand the expected structures when writing 3D code at a lower level. I was surprised, that in fact it compiled and ran well on both Win32 and Android.

But what has me confused is your function named TMyMaterial::DoInitialize(void)

It seems to me that it does two things, setting up a vertex shader, then setting up a fragment shader.

If I am not mistaken, for each shader, it uses 3 hardcoded byte strings in setting up the shader sources, and I am assuming that one is for DirectX9, one for DirectX10, and one for GLSL.

But I have a few questions about this process:
1) Am I correct in assuming that the DX9 and DX10 shaders are only for DirectX on Windows, whereas the GLSL shaders are for all other supported platforms (OSX,android and ios)?
2) How would I generate the hardcoded shader strings if I were to want to write my own shaders?
3) After the shader sources are built, the code then has a call to TShaderManager::RegisterShaderFromData. What is the purpose of this function? As it takes GLSL code as one of its inputs, how does it affect the shader sources structure just built? One problem I am having is that I have tried to modify the glsl shader code parameter in this function in order to test various scenarios, but rebuilding with my changes seems to have no effect at all, and the exes seem to still build and run without my glsl changes being recognized.

In order to do low level 3d coding with XE6 (or 7 when I 'recharge'), I need to understand these structures and functions, but I cannot find any documentation on how the various RegisterShader functions affect a TContextShaderSource array, and what the FPixelShader or FVectorShader expects to be set to.

Can someone point me to some documentation, or give me some insight in this regard? Thanks
David Patte

Posts: 7
Registered: 1/23/98
Re: Learning Embarcadero 3d using your LowLevel3D sample code
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 10, 2014 7:52 PM   in response to: David Patte in response to: David Patte
I have done further investigation of the code by looking at the object pascal source, which has answered many of my questions.

So, assuming that I will be writing my own shaders, I am now wondering how to generate the byte strings for FSources (DX9,DX10,mac,ios and android).

Given that i will write the original source shaders in glsl, what is the recommended process, or tools, to generate the FSources for the various platforms?

Thanks
peter larson

Posts: 1
Registered: 1/18/02
Re: Learning Embarcadero 3d using your LowLevel3D sample code
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 12, 2016 12:46 AM   in response to: David Patte in response to: David Patte
Did you ever get anywhere with this?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02