Git Product home page Git Product logo

Comments (5)

john-wigg avatar john-wigg commented on August 15, 2024

I don't remember the exact reasons I had at the time but I believe I found the viewport to be a bit more flexible initally. It allowed me e.g. to overlap and compose multiple textures inside the viewport. I could also access the viewport texture from any sprite and did not need to worry about positioning since the viewport would always cover the entire screen.

However, I did not really end up making use of these advantages since the final (drawable) texture covered the entire screen anyways. So I guess you're right, it's not really needed here. I tried not putting too much of an emphasis in the tutorial though, since I'm aware that there are advantages and disatvantages to using a viewport.

I will close this later if you don't have any more questions.

EDIT: Wrong account, oops :D

from 2dgrassshaderdemo.

zhaishengfu avatar zhaishengfu commented on August 15, 2024

for viewport, i only see disadvantages. you say
'I found the viewport to be a bit more flexible initally' and
'access the viewport texture from any sprite'
this can be done by sprite directly , considering any scale, pivot and position

and you say
'the final (drawable) texture covered the entire screen'
this is the problem!. when you have camera2D and the screen is changeable, and you want the grass to be static, the viewport will be big problem. that is , it will change with the Camera2D.

from 2dgrassshaderdemo.

CaptainProton42 avatar CaptainProton42 commented on August 15, 2024

As I said, I just found the viewport to work better for me when I initially started doing this. I still see some advantages to using a viewport (such as only having to worry about a single texture at all times). Your approach then is of course completely valid and may be better suited for your needs (especially for Camera2D since I did not really take this into account when making this demo).

from 2dgrassshaderdemo.

zhaishengfu avatar zhaishengfu commented on August 15, 2024

ok understand 👍

from 2dgrassshaderdemo.

CaptainProton42 avatar CaptainProton42 commented on August 15, 2024

I'll close this then, feel free to open a new issue if you have more remarks.

from 2dgrassshaderdemo.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.