How to create/configure RenderTarget and TextureConfig to support pixel art games

20 views
Skip to first unread message

Andrey Kleshchenko

unread,
Feb 22, 2018, 5:13:57 PM2/22/18
to PlayN
Hello,

Found few interesting geme screenshots in twitter recently and retuned to idea create something like that in PlayN.
I'm talking about these tweets (sorry, can't get link to the target GIF): 

So, the Idea is - create small pixel-art style game where all graphics will be extremly small, created by pixels, where all will be rendered in square (maybe rect) zoomed screen. Like on previous GIFs. I know they are videos :) Also targeting mobile devices firtsly. 

My problems:
1. I didn't find a way to configure or re-create existing RenderTarget to disply static fixed game screen size on any device.
Default RenderTarget is listening default scaling. To create new I need Texture. To create Texture I need default Graphics which used predefined scaling again.


2. Default auto scaling working very bad for pixel art textures on Android. See attached images from Nexus and Amazon Fire talet.


3. Default auto scaling doesn't work on desktop - it is always 1. It is expected, but I need fixed viewport size with 'scaling' on desktop too.

4. If texture scaling it damaged (just zoom my screenshots) as pixel art texture.
I've overried default texture config to use GL_NEAREST,GL_NEAREST filters but it desn't help.

Ideally I need something like FitViewport (https://github.com/libgdx/libgdx/wiki/Viewports#fitviewport) in Libgdx.
Can anyone exmlain how i can reach it with PlayN? How can I extend/configure own viewport?

Thanks!

Andrey Kleshchenko

unread,
Feb 26, 2018, 4:09:01 AM2/26/18
to PlayN
Issues with pixelart textures rendering (4) fixed. I've totally forgot that it need to enable repeat X,Y in texture config.
So, 3 I can override with some math to get consistency with mobile devices where I also need to set 'basic' resolution somehow. Still thinking about what basic resolution choose. In result It will work out of the box - with default scaling.
Or i can go with TextureSurface with custom render target for main drawing. Also need to find correct approach to calculate viewport size.. 
Reply all
Reply to author
Forward
0 new messages