Author Topic: convert frame buffer to ascii  (Read 11279 times)

0 Members and 1 Guest are viewing this topic.

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
convert frame buffer to ascii
« 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.
« Last Edit: February 25, 2008 by ninogenio »
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: convert frame buffer to ascii
« Reply #1 on: February 25, 2008 »
Its that old familiar sunset but done old school lol this will really benefit from color conversion

Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: convert frame buffer to ascii
« Reply #2 on: February 25, 2008 »
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.
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17412
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: convert frame buffer to ascii
« Reply #3 on: February 25, 2008 »
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.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: convert frame buffer to ascii
« Reply #4 on: February 25, 2008 »
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.
« Last Edit: February 26, 2008 by ninogenio »
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: convert frame buffer to ascii
« Reply #5 on: February 26, 2008 »
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.
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: convert frame buffer to ascii
« Reply #6 on: February 26, 2008 »
Those colours are miles better I knew this had a lot of potential keep up the good work nino

Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: convert frame buffer to ascii
« Reply #7 on: February 26, 2008 »
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.
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17412
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: convert frame buffer to ascii
« Reply #8 on: February 26, 2008 »
Now you're on the right track. This looks miles better :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: convert frame buffer to ascii
« Reply #9 on: February 26, 2008 »
Just lovely, nino.  :clap:
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: convert frame buffer to ascii
« Reply #10 on: February 26, 2008 »
cheers guys i really hope i can do something nice with it now.
Challenge Trophies Won:

Offline frea

  • C= 64
  • **
  • Posts: 61
  • Karma: 2
    • View Profile
Re: convert frame buffer to ascii
« Reply #11 on: February 29, 2008 »
it crashed when i tried to quit.
I could hardly see the sunset, but i am an ignorant in terms of ascii art :).
Nananan.

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: convert frame buffer to ascii
« Reply #12 on: February 29, 2008 »
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
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17412
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: convert frame buffer to ascii
« Reply #13 on: February 29, 2008 »
Are you going to enter something into the next tdmc then? ;)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: convert frame buffer to ascii
« Reply #14 on: March 01, 2008 »
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 ;)
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: convert frame buffer to ascii
« Reply #15 on: March 01, 2008 »
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
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17412
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: convert frame buffer to ascii
« Reply #16 on: March 01, 2008 »
I believe that is legal and widely done Taj.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: convert frame buffer to ascii
« Reply #17 on: March 02, 2008 »
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.
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: convert frame buffer to ascii
« Reply #18 on: March 02, 2008 »
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
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: convert frame buffer to ascii
« Reply #19 on: March 02, 2008 »
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.
« Last Edit: March 02, 2008 by ninogenio »
Challenge Trophies Won: