# HG changeset patch # User Steve Losh # Date 1482339608 18000 # Node ID c261dec563656c6decd681c4a46248a8e00ff39e # Parent 6709f89d86a8ba3832ec2f793dea37ab09c943b7 Clarify video memory diff -r 6709f89d86a8 -r c261dec56365 content/blog/2016/12/chip8-graphics.markdown --- a/content/blog/2016/12/chip8-graphics.markdown Wed Dec 21 11:53:34 2016 -0500 +++ b/content/blog/2016/12/chip8-graphics.markdown Wed Dec 21 12:00:08 2016 -0500 @@ -87,6 +87,13 @@ a multidimensional array to make the indexing a bit nicer, but by using a simple flat array we'll be able to pass it directly to OpenGL later. +OpenGL is going to want this array to be in "X-major" order, so the array will +need to look like: + + [(x₀, y₀), (x₁, y₀), (x₂, y₀), ..., + (x₀, y₁), (x₁, y₁), (x₂, y₁), ..., + ...] + We'll add a couple of helper functions to make the indexing of this array a bit less painful: @@ -99,7 +106,8 @@ new-value)) ``` -Now we can simply say `(vref chip 5 15)` to get the pixel at (5, 15). +Now we can simply say `(vref chip 5 15)` to get the pixel at (5, 15) instead of +manually calculating out the `aref`. We'll add one more field to `chip` before moving on, a "dirty" flag: