![]() |
|
Help Building SVN, and adding functions to allegro |
Timorg
Member #2,028
March 2002
|
I have a few question about hacking allegro, and my circle thick function. (from this thread http://www.allegro.cc/forums/thread/591592/676194#target[/url]) Is this the correct way to build allegro from svn on linux? How do I build svn on mingw? I have sed and sort in my mingw/bin directory, I can beat on it, but I can't seem to work out the issues, I still get this issue http://www.allegro.cc/forums/thread/591110/667403#target, so I patch the latest stable version, and work from that. How do I add methods to the end of the vtable? I think thats all my questions for the moment, I think some of them overlap. -Tim ____________________________________________________________________________________________ |
GullRaDriel
Member #3,861
September 2003
![]() |
Under mingw32, AFAIK : misc/fixdll.sh "Code is like shit - it only smells if it is not yours" |
Evert
Member #794
November 2000
![]() |
Quote: I have a feeling that a "make depend" might be required somewhere, definitely if you "make veryclean" The configure stage should take care of running "make depend" for you, but it doesn't hurt to run it manually after configure. Quote: How do I add methods to the end of the vtable? You add the method to the end of the appropriate VTABLE struct. Quote: How do I set the driver method for circlethick? You add a function pointer pointing to your function to the declration of the driver. Quote: How do I init the vtable for circlethick? Add a vtable entry for it, in the driver struct, defined the function and make sure you update all drivers to the new format. Then add an inline function in draw.inl (I think) that wraps the call to the vtable function. That said, your function only calls other basic Allegro primitives, so I don't really see a reason why this needs to be in a vtable? If it's with an eye to hardware acceleration, then the vtable wrapper should check if an accelerated function is available and call that, or do what this function does instead. No need to put it in a vtable in that case either. |
Michael Jensen
Member #2,870
October 2002
![]() |
Yeah, unless you have a reason to, and it's not just on a whim, I don't think you should be mucking with the vtables, you could accidently break binary compatibility or something. Cool function though. But you use sqrt a lot... Is it slow? -- I wouldn't be suprised if it was faster than mine.
|
Timorg
Member #2,028
March 2002
|
It uses the mathematical equation for a circle, which is heavy on square root b and a are set to 0, to simplify the equation, and are applied before the shape is drawn. I need to use an integrative approach, which I hope to borrow from do_circle(...) ____________________________________________________________________________________________ |
Michael Jensen
Member #2,870
October 2002
![]() |
I believe it's possible to draw a filled circle without using square root -- I'm not sure how allegro does it though.
|
Timorg
Member #2,028
March 2002
|
This problem is much more complicated than it appears on the surface, I knew it wasn't going to be simple, but the allegro do_circle, uses 8 lines of symmetry, which causes problem, I am getting better results with only 4 lines, I can't find an algorithm that doesn't use symmetry at all, that would make the job simpler, but the circle would still be drawn in 4 parts, and the outer parts don't match the inner parts, so you need to keep them in line with each other, only step to the new line if the other has. I am determined to solve this. ____________________________________________________________________________________________ |
Michael Jensen
Member #2,870
October 2002
![]() |
Yes, the circle algorithm uses 8 lines of symmetry (my comment earlier was about the filled circle function btw, not the actual circle function -- you can draw a filled circle without using sqrt...) The 8 lines of symmetry approach is, AFAIK, the fastest way to make a computer compute the points in a circle. If you just need the points, use an array or something. And just add the points to it as generated by the 8 lines of symmetry algorithm to your array as it generates them. (What's wrong with the 8 lines of symmetry approach anyway?)
|
Timorg
Member #2,028
March 2002
|
{"name":"circle_problem.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/6\/e6d1cc9d24cbbbde07d4415a63545509.png","w":242,"h":195,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/6\/e6d1cc9d24cbbbde07d4415a63545509"} The dark green edge of the inner circle is drawn heading upwards, and the blue arrow is being drawn downwards, so unless you want to save all the points, or fill the area recursively, I have a solution to fill this particular example, but it breaks when the inner radius and outer radius are too close together. Edit: I have found a solution that works
The big question now is how do I add that to allegro I added AL_METHOD(void, circlethick, (struct BITMAP *bmp, int x, int y, int radius, int thickness, int color)); to gfx.h I then added the above function to gfx.c, I then tried to add "circlethick" to the vtables, and it didnt work, I tried "_circlethick" and "_soft_circlethick", no luck.
I don't even have a clue about how to add the function to the drivers? Which is probably what the problem is. Sorry for all the pita questions, but I will make a wiki page explaining how to add functions ____________________________________________________________________________________________ |
Michael Jensen
Member #2,870
October 2002
![]() |
again, what evert said: you're not accessing hardware directly, you're only calling primitives (hline is the only one I see), so why does it need to be added to a vtable/driver/etc?
|
Timorg
Member #2,028
March 2002
|
I am only going with what was said in the other thread, if you could explain how to add a function without doing all that, it would be great. ____________________________________________________________________________________________ |
Evert
Member #794
November 2000
![]() |
You don't need to modify the vtables to add functions to Allegro. |
|