Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Mi Jul 16, 2025 05:44

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 5 Beiträge ] 
Autor Nachricht
BeitragVerfasst: Mo Dez 14, 2009 14:57 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
I am puzzled again with the new delphi string and the likes :-(
On calling a shader with parameters the actual parameter is never set.
Code:
  1. procedure TGLSLProgram.SetF(aname: string; arg: GLFloat);
  2. begin
  3.   glUniform1fARB(glGetUniformLocationARB(FProgramObject, @aname ), arg);
  4. end;


But when is use the variable name directly here:
Code:
  1. procedure TGLSLProgram.SetF(aname: string; arg: GLFloat);
  2. begin
  3.   glUniform1fARB(glGetUniformLocationARB(FProgramObject, 'test' ), arg);
  4. end;


Then it does works.

But for now i am unable to provide a working type. String / AnsiString / PChar / PAnsiChar but none seem to work :-(

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
BeitragVerfasst: Mo Dez 14, 2009 15:08 
Offline
DGL Member
Benutzeravatar

Registriert: Do Dez 29, 2005 12:28
Beiträge: 2249
Wohnort: Düsseldorf
Programmiersprache: C++, C#, Java
I'm not a Delphi user, but google found this link which looks helpful:
http://compaspascal.blogspot.com/2008/1 ... ed-by.html

Maybe rawbytestring or utf8string?

_________________
Yeah! :mrgreen:


Nach oben
 Profil  
Mit Zitat antworten  
BeitragVerfasst: Mo Dez 14, 2009 15:51 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Hmm, that only confuses me more ... (if only there was a way delphi2009 could behave like delphi always did on only support fancy string when needed)

Looking at the type of the command i came up with this:
Code:
  1. procedure TGLSLProgram.SetF(aname: PGLcharARB; arg: GLFloat);
  2. begin
  3.   glUniform1fARB(glGetUniformLocationARB(FProgramObject, aname ), arg);
  4. end;
And that works :-)

But i dont like using PGLcharARB in a class it want to use string or ansistring there. But again this does NOT work:
Code:
  1. procedure TGLSLProgram.SetF(aname: string; arg: GLFloat);
  2. begin
  3.   glUniform1fARB(glGetUniformLocationARB(FProgramObject, PGLcharARB(aname) ), arg);
  4. end;
Sigh ....

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
BeitragVerfasst: Mo Dez 14, 2009 16:02 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Ok final working version:
Code:
  1. procedure TGLSLProgram.SetF(aname: string; arg: GLFloat);
  2. begin
  3.   glUniform1fARB(glGetUniformLocationARB(FProgramObject, PGLcharARB(ansistring(aname)) ), arg);
  4. end;

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
BeitragVerfasst: Mo Dez 14, 2009 17:13 
Offline
DGL Member
Benutzeravatar

Registriert: Do Sep 02, 2004 19:42
Beiträge: 4158
Programmiersprache: FreePascal, C++
Yep, the problem is, that the newer delphis use WideString instead of AnsiString when you just say "String". So if you explicitly need an AnsiString, you should tell this to Delphi. Probably even in the method declaration.

greetings

_________________
If you find any deadlinks, please send me a notification – Wenn du tote Links findest, sende mir eine Benachrichtigung.
current projects: ManiacLab; aioxmpp
zombofant networkmy photostream
„Writing code is like writing poetry“ - source unknown


„Give a man a fish, and you feed him for a day. Teach a man to fish and you feed him for a lifetime. “ ~ A Chinese Proverb


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 5 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 6 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.007s | 16 Queries | GZIP : On ]