Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Drawing graphics... the old way  (Read 2637 times)

0 Members and 1 Guest are viewing this topic.

alien8

  • Newbie
  • *
  • Posts: 16
  • 8 bits rocks!
    • View Profile
    • Email
Drawing graphics... the old way
« on: October 23, 2015, 06:22:36 pm »
Hello Again, and thank for this cool community
Is there a way to make graphics in a old fashion way e.g. directly integrating the typical matrix of pixels into the source?
I try to explain... I know about the several objects provided by SFML/graphics (namely sprites, textures, CircleShape...)
But I wanted to know if there is a more straight way to "emulate" putpixel, in order to be able to make the code more common with the old way, because I'm making an "old flavor" arcade and I think it's better to stay the more old way possible on the one hand, and another, to reuse some resources that load graphics from a bit/graphics-array, not the typical *.png or graphics file in general.
Also i wanted to know your opinion about these types of strategies about graphics use nowadays... :) ;)
It looks like there is no debate about that good old way
THANKS Very much.
Alien 8

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Drawing graphics... the old way
« Reply #1 on: October 23, 2015, 06:48:23 pm »
You can "draw" to an sf::Image with the setPixel function, then upload it to VRAM with sf::Texture::loadFromImage() and finally draw it with a sprite or a vertex quad.
Or you can maintain your own pixel array and call sf::Texture::update() every frame.

SFML uses OpenGL and is thus by definition GPU accelerated, thus you'll always need to deal with a texture and a quad at some point.

Personally I don't see a reason to stick with "old fashion code" for modern system just because the game will be and "old flavor" arcade game. In my opinion you either go all in and built a game the old fashion way for old systems (either through emulation or on real hardware) or you target new hardware and adapt the code to work in sync with the new system.
Code didn't just change because the "old fashion" got old or outdated, but it constantly changes because the systems underneath start working differently. In the past you didn't work with GPUs and everything was done on the CPU, so you wrote software renderer that placed pixels and did crazy calculations, but nowadays you get all of that for "free" in your GPU.

If you really want to write a software renderer, you shouldn't use SFML which only knows how to render with your GPU. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

alien8

  • Newbie
  • *
  • Posts: 16
  • 8 bits rocks!
    • View Profile
    • Email
Re: Drawing graphics... the old way
« Reply #2 on: October 23, 2015, 07:07:39 pm »
Yes, I imagined that way.
I also discovered the only other related thread:
http://en.sfml-dev.org/forums/index.php?topic=2955.0

I don't know, I think it's more of a psychological state of mind... nostalgia for the gone days, that makes me want to work on my first really serious arcade with that constraint.

Thanks for speedy reply..         Oh and in order to try to  increase the debate, where do members get your  resources? pixel joint? (http://pixeljoint.com/) open game art? (http://opengameart.org/)... selfmade maybe?
« Last Edit: October 23, 2015, 07:09:11 pm by alien8 »
Alien 8

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Drawing graphics... the old way
« Reply #3 on: October 24, 2015, 04:36:10 pm »
You should be aware that working against the design of graphics cards makes things tremendously slower. I'm not sure if an unresponsible/heavyweight arcade game is cool to play "for the nostalgia..."

Faster than a sf::Image which is uploaded every frame would be a sf::RenderTexture, to which you render vertex arrays using sf::Points mode.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: