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

Aktuelle Zeit: So Jun 09, 2024 04:00

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



Ein neues Thema erstellen Auf das Thema antworten  [ 35 Beiträge ]  Gehe zu Seite Vorherige  1, 2, 3
Autor Nachricht
 Betreff des Beitrags:
BeitragVerfasst: So Jul 19, 2009 22:15 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
I was not aware of that. But code is now fixed. Check the latest version from svn.

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


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Jul 20, 2009 12:12 
Offline
DGL Member
Benutzeravatar

Registriert: Di Mai 18, 2004 16:45
Beiträge: 2622
Wohnort: Berlin
Programmiersprache: Go, C/C++
At the moment i work on a real vektor based implementation of FreeType Fonts and svg.
http://www.delphigl.com/forum/viewtopic.php?t=8534
FreeType use quadric bezier curves which are really easy compared to cubic.

_________________
"Wer die Freiheit aufgibt um Sicherheit zu gewinnen, der wird am Ende beides verlieren"
Benjamin Franklin

Projekte: https://github.com/tak2004


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Jul 20, 2009 18:18 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
@TAK2004: I had a look on you shaders but at first looks i dont understand it yet. But you feed a triangle with texture coords and the fragment shader then knows how to draw the spline?

That would be much faster then my current proces of triangulation. And not to mention the high triangle count i get with complex shapes. But you mention a precalcuation step?
The article states the triangulation is still needed as pre process step (but at low detail only?)).

Could the texture coords be used as an paramter to the quadratic bezier line from, to and control point (relative coords) or am i going haywire on that theory.

Code:
  1.  
  2. //quadratic bezier line ( (1-i)^2*pa+2*i(1-i)*pb+i^2*pc )
  3. procedure TPath.DrawQSpline( AFrom, ATo, AControlPoint: TPoint );
  4.   var di, i: double;
  5.       p1,p2: TPoint;
  6.   begin
  7.     di := 1.0 / FSplinePrecision;
  8.     i := di;
  9.     p2 := AFrom;
  10.     while i<=1.0 do
  11.     begin
  12.       if i-di/2 > 1.0-di then
  13.         i := 1.0;
  14.       p1 := p2;
  15.       p2.X := (AFrom.X-2*AControlPoint.X+ATo.X)*sqr(i) + (2*AControlPoint.X-2*AFrom.X)*i + AFrom.X;
  16.       p2.Y := (AFrom.Y-2*AControlPoint.Y+ATo.Y)*sqr(i) + (2*AControlPoint.Y-2*AFrom.Y)*i + AFrom.Y;
  17.       if not EqualPoints( p1, p2 ) then
  18.         NewStroke( p1, p2 );  //line
  19.       i := i + di;
  20.     end;
  21.   //pc := p2; ?
  22.  
  23.   NewStroke( p2, ATo);
  24. end;
  25.  
  26.  

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


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Jul 20, 2009 19:00 
Offline
DGL Member
Benutzeravatar

Registriert: Di Mai 18, 2004 16:45
Beiträge: 2622
Wohnort: Berlin
Programmiersprache: Go, C/C++
The first step is to get the type of curve(line,quadratic bezier, serpetine,loop or cusp).
This need some math and knowledge(first half of paper) and the second part is drawing and calculation of uv coords.
The second step is to react on the type, like convert data to a normal glLine, work with a quadratic bezier, work with cubic bezier.
Cubic bezier give u 3 different version, serpetine,loop and cusp, which you can find on the begin of the paper with the lines l k m n s.
Serpetine is easy, calculate the stuff, loop you have to find the double point, break down the beziercurve into two and calculate the stuff and third i didn't implement yet(i think there are 2 double points=4 bezier curves but not sure).
You have to calculate k and check the sign of the determinant D2 to switch it.
After that you calculate s,m,n and get the new Texcoords.

The shader calculate the with the short formular the distance to the nearest point of the cubic bezier curve.
That means, you get the lines k(u) l(v) and m(w) (n was eliminated through the conditions explained in the paper).
This and the sign can be used to decide which side is to draw and which texel can discard.

At the moment i have 300lines of code for the stuff but its not complete.
Some points of the paper i don't unterstand too.

_________________
"Wer die Freiheit aufgibt um Sicherheit zu gewinnen, der wird am Ende beides verlieren"
Benjamin Franklin

Projekte: https://github.com/tak2004


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Aug 24, 2009 22:04 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
I am back on my old way and even got circular gradients working. Alpha with an circular gradient is a work in progress.


Dateianhänge:
glvggrad.jpg
glvggrad.jpg [ 49.05 KiB | 4888-mal betrachtet ]

_________________
http://3das.noeska.com - create adventure games without programming
Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 35 Beiträge ]  Gehe zu Seite Vorherige  1, 2, 3
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 7 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.010s | 16 Queries | GZIP : On ]