Quote Originally Posted by paul_nicholls
Hi all,
I am using the 1.0 version headers of JEDI-SDL (but not the new branch version a few weeks old) so I can use the SDL dlls (currently using version 1_2_.

I am running it under Delphi 5 Professional.

It was all working nicely, but now I am trying to do some shader stuff and am getting an access violation crash in the 'nvoglnt.dll' when I try to run the code below to load and compile shader code:

[code]Function TGL_ARB_Shader.LoadAndCompileShaderSource(AFil eName: String): Boolean;
Var
ShaderSource : TStringList;
Source : String;
]

I have deduced that it is blowing up on the 'glShaderSourceARB()' call line

All the procedures and function have been initialized ok, I have checked if they are assigned as part of the debugging.

Any ideas as to why it is blowing up there?

Do I need to get and possible beta test the new code that supports SDL 1_2_7 to make this work?

cheers,
Paul.
Hi all, I have now gotten it working, it was a coding error on my part

I wasn't passing in the correct parameters into the glShaderSourceARB() call...D'OH!

The corrected code is below:

Code:
Function  TGL_ARB_Shader.LoadAndCompileShaderSource(AFileName: String): Boolean;
Var
    ShaderSource  : TStringList;
    Source        : String;
    LinkStatus    : GLint;
    CompileStatus : GLint;
    SourceLength  : Integer;
Begin
    Result := False;

    If (Not FileExists(AFileName)) Then
        Exit;

    ShaderSource := TStringList.Create;

    Try
        ShaderSource.LoadFromFile(AFileName);

        If (ShaderSource.Text = '') Then
            Exit;

        Source := ShaderSource.Text;

        SourceLength := Length(Source);

        glShaderSourceARB(FHandle,1,@Source,@SourceLength);

        glCompileShaderARB(FHandle);

        glGetObjectParameterivARB(FHandle,GL_OBJECT_LINK_STATUS_ARB   , @LinkStatus);
        glGetObjectParameterivARB(FHandle,GL_OBJECT_COMPILE_STATUS_ARB, @CompileStatus);

        Result := (LinkStatus = 1) And (CompileStatus = 1);
    Finally
        ShaderSource.Free;
    End;
End;
I hope this helps someone else!!

I have to thank vgo for the the source code that was posted in the thread:

http://www.pascalgamedevelopment.com...hadersourcearb

cheers,
Paul.