tabvaranjr

tabvaranjr

Hands-on Rust: Rendering issues with entities

Hi there! I’ve finished the book last Friday. Good work! It’s a very good introduction to Rust and I really enjoyed it.

I have noticed that some entities are rendering incorrectly. Take a good look at the sprites at page 254 and compare them with the sprites at pages 98 and 99 (beta 5 of the book). For instance, the potion lacks liquid and the scroll lacks its ribbon. I can reproduce this issue in Fedora Linux and Windows 10.

I’m pretty new to Rust but I’m quite experienced with OpenGL so I took a look at your shaders.

Here’s a magnified frame where you can clearly see the issue. You can also notice that orcs are missing their legs and their shadows.

Here’s the fragment shader used to render the tiles of the BTermBuilder::with_simple_console_no_bg() console:

The selected line is the interesting part.

Here’s a sample of the sprite texture:

I’ve sampled a texel of the potion at the right (see “Pixel Context”; the texel is the one within the square) and its RGBA value is in the red box, below the player and the letter A (pardon my lack of skills with GIMP). As you can see in the blue box, the G value is lower than 0.1, so the fragment shader discards the whole fragment. Here’s our problem.

Simply removing the selected line in the fragment shader fixes the issue. Yay!

However, you also have to adjust the terminal8x8.png font map and set the alpha of the black pixels to 0. Otherwise, you’ll get a black screen. I’ve uploaded my modified map in my repo.

Now, I can send you a PR for bracket-terminal but I’m not quite sure of the side effects for other programs than the ones in the book. I mean, this line was probably there for a reason.

Cheers!

Popular Prag Prog topics Top

jimmykiang
This test is broken right out of the box… — FAIL: TestAgent (7.82s) agent_test.go:77: Error Trace: agent_test.go:77 agent_test.go:...
New
iPaul
page 37 ANTLRInputStream input = new ANTLRInputStream(is); as of ANTLR 4 .8 should be: CharStream stream = CharStreams.fromStream(i...
New
simonpeter
When I try the command to create a pair of migration files I get an error. user=> (create-migration "guestbook") Execution error (Ill...
New
edruder
I thought that there might be interest in using the book with Rails 6.1 and Ruby 2.7.2. I’ll note what I needed to do differently here. ...
New
AleksandrKudashkin
On the page xv there is an instruction to run bin/setup from the main folder. I downloaded the source code today (12/03/21) and can’t see...
New
jskubick
I’m under the impression that when the reader gets to page 136 (“View Data with the Database Inspector”), the code SHOULD be able to buil...
New
brunogirin
When trying to run tox in parallel as explained on page 151, I got the following error: tox: error: argument -p/–parallel: expected one...
New
dtonhofer
@parrt In the context of Chapter 4.3, the grammar Java.g4, meant to parse Java 6 compilation units, no longer passes ANTLR (currently 4....
New
ggerico
I got this error when executing the plot files on macOS Ventura 13.0.1 with Python 3.10.8 and matplotlib 3.6.1: programming_ML/code/03_...
New
mcpierce
@mfazio23 I’ve applied the changes from Chapter 5 of the book and everything builds correctly and runs. But, when I try to start a game,...
New

Other popular topics Top

AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
New
siddhant3030
I’m thinking of buying a monitor that I can rotate to use as a vertical monitor? Also, I want to know if someone is using it for program...
New
AstonJ
Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face: Perhaps if there’s enough peop...
New
Exadra37
Oh just spent so much time on this to discover now that RancherOS is in end of life but Rancher is refusing to mark the Github repo as su...
New
OvermindDL1
Woooooooo! This is such a huge release for it, and 2 years incoming! In short, the library is now using an updated hyper backend (not j...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
PragmaticBookshelf
Author Spotlight James Stanier @jstanier James Stanier, author of Effective Remote Work , discusses how to rethink the office as we e...
New
PragmaticBookshelf
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New

Latest in PragProg

View all threads ❯