--Chapter 5: A Burst of Color—

NOTE: This is actually going to be a VERY SHORT chapter. There isn’t much to explain.

Another thing about Citro3D color that’s fully editable is the color. The values are RBGA (not to be mistaken with RGBA) and they can be fully utilized in code so let’s jump straight in!

Let’s take the code from the last chapter and learn it better:

Immediate Mode:

C3D_ImmSendAttrib(1.0f, 0.0f, 0.0f, 1.0f); // v1=color

C3D_ImmSendAttrib(0.0f, 1.0f, 0.0f, 1.0f);

C3D_ImmSendAttrib(0.0f, 0.0f, 1.0f, 1.0f);

Regular Mode:

C3D_FixedAttribSet(1, 1.0, 1.0, 1.0, 1.0);

I removed the position values in order for us to just understand the color. The first value (second in normal mode) would be the R, which is the red value. The second one (third in normal mode) would be the B value, which is the blue value. The third value (fourth in normal mode) would be the G value, or the green value. And the last one (fifth in normal mode) would be the A value, or the alpha (transparency) value. You can change each of these values to get a different color. Since each vertex is a different color, each vertex will have its own color and spread until they meet in the middle of the sides and the middle of the triangle itself to blend with each other. Color is defined as v1 in the vertex shader (can be v0-v15, but this is an example). The maximum values for each color value is 1 but you can define it using the tenths place (0.4, 0.6, etc.).

That’s it for color. Next, you’ll be learning about Geometery shaders.

results matching ""

    No results matching ""