Dark Bit Factory & Gravity
PROGRAMMING => Freebasic => Topic started by: ninogenio on February 25, 2008
-
right i figure im going to have to do as all the tmdc boffins do and do framebuffer to ascii window convertion.
so iv ported a few routines from the tfx lib to freebasic to make it happen, more specifically from the tmdc5inv demo. i dont know if iv ported them correctly but it works rather pleasingly.
ive included an exe source and test image. the source is a bit all over the place as im still messing.
up next is block color convertions
have fun.
-
Its that old familiar sunset but done old school lol this will really benefit from color conversion
-
yeah probably not the best image to show of the conversion but if changed with a close up of a face it's amazing how good the conversion is.
-
This would probably work better with images that are moving I think Nino.
I did recognise it as a sunset but only after I stared at it for some seconds.
-
like i said not the best picture to try it out on.
if you guys want just drop one of your own pics in, it's quite easy.
i was posting the source incase anyone might want anything from it and seeing as it is rendered to the double buffered window it would be quite easy to replace it with a moving demo effect.
-
right ive now got block color going and ironed out a few bugs in the normal ascii conversion which makes it look better now.
use right arrow key to flick back and forth between the two test images and the up arrow key to go between block color and normal ascii.
guess i better do something with it now.
-
Those colours are miles better I knew this had a lot of potential keep up the good work nino
-
cheers mate,
with these conversion routines porting full rgb demo effects should be much simpler with a more polished look. one thing to note for anyone going to use this is that the frame buffer is in bgr format other than that you still have to be carefull as to wich colors you use as some look better than others.
-
Now you're on the right track. This looks miles better :)
-
Just lovely, nino. :clap:
-
cheers guys i really hope i can do something nice with it now.
-
it crashed when i tried to quit.
I could hardly see the sunset, but i am an ignorant in terms of ascii art :).
-
yeah it will crash if you try to quit using the cross, it should quit with esc.
this will be of better use in moving demos ive already done some test's and im very pleased. the image loader thing was just a little test to see if it was working. but yeah you'r right the sunset look's a bit pants :p
-
Are you going to enter something into the next tdmc then? ;)
-
tbh shockwave im not all that intrested in entering any comps other than the ones we run here,
i dont program to get my self noticed i do it purely for the learning, i always wanted to know how ascii was done so here i am figuaring it out. once i feel i have a grasp on it i will probably move to something else :) thats what ive always done.
i will be entering something ascii into the new dbf comp though ;)
-
This is interesting stuff.
It occurred to me, is it legal in ascii competitions to create an opengl (or D3D) window, behind the ascii window, render to the opengl window, capture the framebuffer and then convert using routines like ninos and render that to the ascii window? Or is that a big no-no for ascii compos?
Taj
-
I believe that is legal and widely done Taj.
-
yep perfectly aceptable,
ive even seen animation sequences done in a gif like format of 3d objects and then converted. if your intrested in seing your idea come to fruition taj. i can port a c example you have and run it through the converter for you if you like.
-
Oh bloody hell that would be brilliant! Yes please. I'd love to try out this stuff "for free". I had a look at your code and it already is quite small - I guess with some work it might even be possible to do an ascii 4k.
Taj
-
well yeah this could be brought down by a mile in size even in freebasic.
if the 4k was going to be of block colors only then the massive look up table could be done away with for a start, as well as over half the conversion code.
if your going to post a gl example for me to convert there is a couple of things id like to ask.
please keep the colors relativly simple and make the gl capture buffer 160 in x and 100 pixels in y.
other than that anything is possible really we may have to tweek the gl colors a bit to get them looking nice. but thats no problem.
-
dont you mean 80 x? 160 bytes but its 1 byte colour 1 byte ascii for typical dos consoles
-
nah mate,
although your totally right about it being 1 byte for ascii 1 byte for color and the resolution being 80 x for the ascii console window buffer.
the full bgr frame buffer should be double the size of the ascii window. the 2x dump function does a bit of aa during the conversion.
-
Nino, (or anyone else) . . .
Im having all sorts of problems compiling this . .
Here is the debug info
Command executed:
"C:\FreeBasic\fbc.exe" "I:\DBF Stuff\framconv\framconv\FBIDETEMP.bas"
Compiler output:
I:/DBF Stuff/framconv/framconv/AsciiFrameWork.Bi(32) error 136: Default types or suffixes are only valid in -lang deprecated or qb in 'Declare Function AsRgb( ByVal FCol As Integer , ByVal BCol As Integer )'
I:/DBF Stuff/framconv/framconv/AsciiFrameWork.Bi(38) error 41: Variable not declared, Y in 'For Y = 0 To (Buffer->Size.X) * (Buffer->Size.Y)'
I:/DBF Stuff/framconv/framconv/AsciiFrameWork.Bi(55) error 136: Default types or suffixes are only valid in -lang deprecated or qb in 'Function AsRgb( ByVal FCol As Integer , ByVal BCol As Integer )'
I:/DBF Stuff/framconv/framconv/FrameBufferConv.Bi(71) error 41: Variable not declared, StartcChar in 'pchar += StartcChar * 12'
I:/DBF Stuff/framconv/framconv/FrameBufferConv.Bi(71) warning 12(0): Implicit variable allocation, StartcChar
I:/DBF Stuff/framconv/framconv/FrameBufferConv.Bi(240) error 41: Variable not declared, y in 'For y = 0 To Ysize'
I:/DBF Stuff/framconv/framconv/FrameBufferConv.Bi(242) error 41: Variable not declared, targetpos in 'targetpos = y * 80'
I:/DBF Stuff/framconv/framconv/FrameBufferConv.Bi(245) error 41: Variable not declared, X in 'For X = 0 To xsize'
I:/DBF Stuff/framconv/framconv/FrameBufferConv.Bi(301) error 77: Recursive DEFINE not allowed, found 'MIN' in 'Dim As integer MinV = MIN(R,MIN(G,B))'
I:/DBF Stuff/framconv/framconv/FrameBufferConv.Bi(303) error 41: Variable not declared, MaxV in 'If ((MaxV - MinV) < &h3f) Then'
I:/DBF Stuff/framconv/framconv/FrameBufferConv.Bi(303) warning 12(0): Implicit variable allocation, MaxV
I:/DBF Stuff/framconv/framconv/FrameBufferConv.Bi(306) error 41: Variable not declared, col in 'col = 15'
I:/DBF Stuff/framconv/framconv/FrameBufferConv.Bi(306) error 123: Too many errors, exiting
Results:
Compilation failed
System:
FBIde: 0.4.6
fbc: FreeBASIC Compiler - Version 0.18.3 (12-28-2007) for win32 (target:win32)
OS: Windows NT 6.0 (build 6000)
Phew - can anybody help?
DrewPee
ps. Nice effect though - ran the .exe and that is fantastic!!!!!!
Drew
-
It's failing to compile because you have a more up to date version of Freebasic than Nino.
-
yeah sorry drew but the old freebasic more than covers what i need so i never updated.
the problems you posted should be easily fixed though and in fact i already fixed most in my comp entry its simply that iv been to lasy to declare the variables in most cases ie
I:/DBF Stuff/framconv/framconv/AsciiFrameWork.Bi(38) error 41: Variable not declared, Y in 'For Y = 0 To (Buffer->Size.X) * (Buffer->Size.Y)'
just put dim as integer y above that line and as for this error.
I:/DBF Stuff/framconv/framconv/AsciiFrameWork.Bi(32) error 136: Default types or suffixes are only valid in -lang deprecated or qb in 'Declare Function AsRgb( ByVal FCol As Integer , ByVal BCol As Integer )'
thats telling you i have declared a function but specified no return type so you could change it to.
Declare Function AsRgb( ByVal FCol As Integer , ByVal BCol As Integer ) As Integer
and this warning
I:/DBF Stuff/framconv/framconv/FrameBufferConv.Bi(301) error 77: Recursive DEFINE not allowed, found 'MIN' in 'Dim As integer MinV = MIN(R,MIN(G,B))'
is telling you that min cannot be used inside min in the new freebasic so try this instead.
Dim As Integer Temp = MIN(G,B)
Dim As integer MinV = MIN(R,Temp)
And so on and so forth it should be quite easy to patch this up though.
-
Could just try
fbc -lang deprecated ninosfile.bas
Jim
-
or you could try as jim said but i found -lang deprecated to be unstable or not to work in some cases.