c261dec56365

Clarify video memory
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 21 Dec 2016 12:00:08 -0500
parents 6709f89d86a8
children ce548c40237a
branches/tags (none)
files content/blog/2016/12/chip8-graphics.markdown

Changes

--- 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: