|
Additive blended lines with Fblend |
Paul whoknows
Member #5,081
September 2004
|
I need a fast additive blended line function, and I think it would be possible to use some of the fblend's internal functions to do this.
I think it souldn't be so hard to modify some of its code to get a fblend_line_add(). However, I am not a Fblend expert, I am using this library since a few months. So is there any experienced Fblend user who can help me with this? ____ "The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner. |
Ceagon Xylas
Member #5,495
February 2005
|
Fblend has built in pixel functions too I believe. If nothing else, try replacing allegro's native line function's putpixel calls with fblend's. |
Thomas Fjellstrom
Member #476
June 2000
|
You know, a line really is a rectangle. -- |
James Stanley
Member #7,275
May 2006
|
Not... really... |
gnolam
Member #2,030
March 2002
|
That depends on if the lines are axis-aligned or not. -- |
Paul whoknows
Member #5,081
September 2004
|
Quote: You know, a line really is a rectangle. I am not sure about that. With rect() I can draw lines, but only horizontal and vertical ones. Not very useful in my case, that's why I need a true line_additive() function. ____ "The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner. |
Jonatan Hedborg
Member #4,886
July 2004
|
Maybe openlayer/allegroGL is what you want?
|
Paul whoknows
Member #5,081
September 2004
|
My game supports OpenGL and software drivers. I need an additive blender line() function only for the software driver(Allegro + Fblend). ____ "The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner. |
Bob
Free Market Evangelist
September 2000
|
Considering that most of the time drawing the line won't be in the blending routines, I think you can just use Allegro's do_line() and be done with it. -- |
Ceagon Xylas
Member #5,495
February 2005
|
I, myself said: Fblend has built in pixel functions too I believe. After looking through the code I found it doesn't. So never mind that idea. |
Paul whoknows
Member #5,081
September 2004
|
Quote: Considering that most of the time drawing the line won't be in the blending routines, I think you can just use Allegro's do_line() and be done with it. The line algorithm is not the problem, the problem is that I need a put_pixel_additive/16/32/MMX() function, just like rect_add(). I thought that Fblend used some kind of 'put_pixel_add()' in the function rect_add(), so I wanted to use that to make my line_add() function, but as Ceagon Xylas said, there is no such a function. Bob, can you tell me if is there a way to obtain a 'put_pixel_add()' function from Fblend? ____ "The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner. |
Thomas Fjellstrom
Member #476
June 2000
|
You won't beable to use MMX/SSE properly on lines that aren't horizontal. The data just isn't in the same area, so you'd have to do it pixel by pixel. which is what you get from do_line and a custom function that does the reading and writing of bitmap data. -- |
Matt Smith
Member #783
November 2000
|
I suppose in theory you could write a breshenham line routine that decomposes to short horizontal or vertical lines, but it's barely worth it. |
Thomas Harte
Member #33
April 2000
|
Quote: You won't beable to use MMX/SSE properly on lines that aren't horizontal. Surely it'd still be helpful though? You're taking two (r, g, b) vectors, multiplying each by a scalar and then adding them together. [My site] [Tetrominoes] |
Matt Smith
Member #783
November 2000
|
Good point, but for simplicity you'd prolly have to assume that the RGB is in the bottom 24 bits, which won't be 100% reliable. I suppose 2 versions would be OK, as you are passing a callback to do_line() anyway, so no need to test inside the my_putpixel(). I'm not doing this. I've had my fill of asm lately |
Paul whoknows
Member #5,081
September 2004
|
Right now I am using this: set_add_blender(255,255,255, 127); drawing_mode(DRAW_MODE_TRANS,NULL,NULL,NULL); //draw primitive here (lines, circles, rect, etc.) drawing_mode(DRAW_MODE_SOLID,NULL,NULL,NULL); If you know a faster way of doing this, please let me know. ____ "The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner. |
|