Beta release 3.1b

Information and change log about the latest ZGameEditor release.

Moderator: Moderators

Post Reply
User avatar
Kjell
Posts: 1880
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hej Ville,
VilleK wrote:- 'normalMatrix' passed to shaders (but it does not seems I create it correctly, Kjell please check my committed sources)
It's definitely not correct at the moment yes .. but i think it can be easily fixed :roll:

Code: Select all

NormalM : array[0..3,0..3] of single;
.. should be 0..2, right?

K
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Great! This update made some extensions working again, including ZGESensors! I'm looking forward to normalMatrix used in GLES 2.0... after fixing suggested by Kjell...
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Kjell: Doh! Of course, now it works. Thanks.

Rado1: That sensors work again must be because I (by mistake) kept the change that disallows gl-calls on startup. I'm guessing the callback does not work because it is initiated from another thread. You could add more logging to the init function, testing if looper or sensorEventQueue is null etc. to help debug this. Anyway for now it should work (my workaround is till there) but we should try to fix it later.

Beta updated, please download again.
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Small update:
- Shader has a new BeforeLinkExpression property. This is needed for OpenGL scripting because some call can only be made between compile and link.
- ShaderVariable has a new VariableRef property. Use this to link a Variable component to a shader variable. It supports float, vec2, vec3, vec4 and mat4 types so you no longer needs to split a vec2 into two separate shader variables.

http://www.zgameeditor.org/files/ZGameEditor_beta.zip
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

VilleK wrote:- Shader has a new BeforeLinkExpression property. This is needed for OpenGL scripting because some call can only be made between compile and link.
Ville, could you please give us an example of usage BeforeLinkExpression property?
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Rado1 wrote:Ville, could you please give us an example of usage BeforeLinkExpression property?
Sure, I'm working on a new effect for the Zge Visualizer. It uses OpenGL 4.0 features to update particle positions via transform feedback. The glTransformFeedbackVaryings call can only be made between compile and link.

This is how my BeforeLinkExpression looks like:

Code: Select all

int progHandle = this.Handle;  //Get the handle of the shader
string[4] outputNames;
outputNames[0]="Position";
outputNames[1]="Velocity";
outputNames[2]="StartTime";
outputNames[3]="Color";
glTransformFeedbackVaryings(progHandle, 4, outputNames, GL_SEPARATE_ATTRIBS);
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Thanks Ville for the example.

I have another question: how is it possible to use orthographic camera in ES2/GL3 mode? When I tried to use it, nothing displayed.
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Rado1 wrote:I have another question: how is it possible to use orthographic camera in ES2/GL3 mode? When I tried to use it, nothing displayed.
It should work but it is quite possible there is a bug because I haven't tested it properly. Are you sure you are setting the camera properties to valid values for orthographic? Does the same camera show something in GL compatible mode?
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

I tested the orthographic camera mode again and the reason why all scene objects disappeared from my project was that the Ortographic mode behaves like Perspective and the distance from objects was too far.

I think it's a bug. Please check the attached project.
Attachments
test.zgeproj
test of orthographic camera
(2.16 KiB) Downloaded 647 times
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Perhaps Kjell can help, anything wrong with this Ortho-implmentation?:

Code: Select all

procedure TGLDriverProgrammable.Ortho(const left, right, bottom, top, zNear,
  zFar: GLfloat);
var
  M : TZMatrix4f;
  P : PZMatrix4f;
  p_fn,m_nf,p_rl,m_rl,p_tb,m_tb,m_lr,m_bt : single;
begin
  p_fn := zfar + znear;
  m_nf := znear - zfar; // ~ -m_fn

  p_rl := right + left;
  m_rl := right - left;
  p_tb := top + bottom;
  m_tb := top - bottom;

  m_lr := -m_rl;
  m_bt := -m_tb;

  M[0] := Vector4f(2/m_rl,       0,          0,       p_rl/m_lr);
  M[1] := Vector4f(0,            2/m_tb,     0,       p_tb/m_bt);
  M[2] := Vector4f(0,            0,          2/m_nf,  p_fn/m_nf);
  M[3] := Vector4f(0,            0,          0,       1);

  Self.MPtrs[ Self.MMode ]^ := M;
  MDirty[Self.MMode] := True;
end;
User avatar
Kjell
Posts: 1880
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hmm,
VilleK wrote:anything wrong with this Ortho-implmentation?
Even though it's a bit sloppy for its specific usage ( see attached for a leaner function ), there's nothing wrong with it. The problem must be caused by something else.

K
Attachments
Ortho.zgeproj
(1.69 KiB) Downloaded 606 times
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Ortho.zgeproj works fine for Compatible mode, but even after the latest ZGE beta update (from this noon), the ortho camera is still not working for GL3 (tested on the previously sent test.zgeproj). Ville, Kjell, others, do you have the same problem? Could it be fixed in ZGE or is there some workaround?
User avatar
Kjell
Posts: 1880
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Rado1,

Didn't know there was a new build ( it hasn't been checked in on the repository ) .. anyway, doesn't look like the orthographic camera problem has been fixed yet.

If you don't want to wait you could always generate & upload the projection matrix yourself ( bit of a hassle though ).

K
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Kjell wrote:If you don't want to wait you could always generate & upload the projection matrix yourself ( bit of a hassle though ).
Kjell, could you please give me some hints or example how to do it? Or could you have a look at the ZGE sourcecode to fix it? Thanks.
User avatar
Kjell
Posts: 1880
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Rado1,
Rado1 wrote:Kjell, could you please give me some hints or example how to do it?
Just PM'ed you a example.
Rado1 wrote:Or could you have a look at the ZGE sourcecode to fix it?
I briefly looked through the source, but couldn't find the culprit. It's probably something small / silly though.

K
Post Reply