<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Issue with displaying a textured quad</title>
<description> I&amp;#039;m working on building my first Wii game and I&amp;#039;m having a very, very confusing issue with texturing a quad. I&amp;#039;m relatively certain that I figured out how to include the texture file itself and to get it to be compiled with the binary at build time, but at run-time, it&amp;#039;s all screwed up (for lack of a better way to say it). Below are two screen shots; one of what *should* be appearing on screen and one of what I&amp;#039;m seeing.

Working: http://www.webetry.com/misc/WorkingTexture.png
Broken: http://www.webetry.com/misc/BrokenTexture.png

The code that is being run at render time is as follows:


// Before starting rendering
guMtxIdentity(mGXmodelView2D);
guMtxTransApply (mGXmodelView2D, mGXmodelView2D, 0.0F, 0.0F, -5.0F);
GX_LoadPosMtxImm(mGXmodelView2D, GX_PNMTX0);


// Begin Draw, set mode to Quads
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);

// Top Left
GX_Position2f32(quadCoords[0][0], quadCoords[0][1]);
GX_TexCoord2f32(texCoords[0][0], texCoords[0][1]);

// Top Right
GX_Position2f32(quadCoords[1][0], quadCoords[1][1]);
GX_TexCoord2f32(texCoords[1][0], texCoords[1][1]);

// Bottom Right
GX_Position2f32(quadCoords[2][0], quadCoords[2][1]);
GX_TexCoord2f32(texCoords[2][0], texCoords[2][1]);

// Bottom Left
GX_Position2f32(quadCoords[3][0], quadCoords[3][1]);
GX_TexCoord2f32(texCoords[3][0], texCoords[3][1]);

// End Draw
GX_End();


// After rendering
GX_DrawDone();

GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
GX_SetAlphaUpdate(GX_TRUE);
GX_SetColorUpdate(GX_TRUE);
GX_CopyDisp(mFrameBuffers[mFrameBufferIndex], GX_TRUE);

VIDEO_SetNextFramebuffer(mFrameBuffers[mFrameBufferIndex]);

if(mFirstFrameBuffer)
{
VIDEO_SetBlack(FALSE);
mFirstFrameBuffer = 0;
}
VIDEO_Flush();
VIDEO_WaitVSync();
mFrameBufferIndex ^= 1;

The weird grayscale thing going on with the image makes me wonder if it&amp;#039;s a format issue. In my .scf file, I have colfmt set to 6 for PNG. That is correct, right?

Are there any quirks as far as image encoding, compression or color profiles that I need to be aware of when exporting graphical assets to use?</description><link>http://forum.wiibrew.org/read.php?11,74581,74581#msg-74581</link><lastBuildDate>Tue, 17 Mar 2026 01:10:00 +0100</lastBuildDate>
<generator>Phorum 5.2.23</generator>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74581,74591#msg-74591</guid>
<title>Re: Issue with displaying a textured quad</title><link>http://forum.wiibrew.org/read.php?11,74581,74591#msg-74591</link><description><![CDATA[ Or maybe you could have a big texture map. Or load each texture only before it us drawn.]]></description>
<dc:creator>owen</dc:creator>
<category>Coding</category><pubDate>Wed, 24 Dec 2014 12:49:56 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74581,74589#msg-74589</guid>
<title>Re: Issue with displaying a textured quad</title><link>http://forum.wiibrew.org/read.php?11,74581,74589#msg-74589</link><description><![CDATA[ Yeah, the texture image size is definitely a multiple of 2 (64x64). It&#039;s actually coming from a sheet that contains frames for multiple animations.<br /><br />As I change the sprite&#039;s state, the texture is updating accordingly, it&#039;s just oddly skewed. When I do a measurement against a screen capture, it seems as though the quad&#039;s height is what&#039;s wrong/shorter than it should be. I thought at first maybe it was the data driving it -- I have data files that are compiled at build time -- but even when I hard-code the dimensions, it&#039;s still not square. :(<br /><br />Screenshot of the "smushed" texture: <a href="http://www.webetry.com/misc/SmushedTexture.png" rel="nofollow">http://www.webetry.com/misc/SmushedTexture.png</a><br />Screenshot of the texture w/ correct proportions: <a href="http://www.webetry.com/misc/WorkingTexture.png" rel="nofollow">http://www.webetry.com/misc/WorkingTexture.png</a><br /><br />It&#039;s a different problem altogether, but something I noticed is when I try to load multiple textures using separate GX_LoadTexObj() calls, they get screwed up; I end up back with the weird black and white jumble in my first post. My uneducated guess is that if I want to use multiple sprite sheets, I need to use different GX_MAPX flags in GX_LoadTexObj(). Is that correct?<br /><br />I dug through gx.h and noticed it has GX_MAP0 to GX_MAP7, so there&#039;s a limit to how many I can use at once basically?<br /><br />Sorry for all the questions, fighting the learning curve. :)]]></description>
<dc:creator>DaveB1980</dc:creator>
<category>Coding</category><pubDate>Wed, 24 Dec 2014 06:28:55 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74581,74588#msg-74588</guid>
<title>Re: Issue with displaying a textured quad</title><link>http://forum.wiibrew.org/read.php?11,74581,74588#msg-74588</link><description><![CDATA[ All I can say is the texture size should be a multiple of 2. Other than that you can look up the grrlib source code to get some hints as to why it&#039;s squished.]]></description>
<dc:creator>owen</dc:creator>
<category>Coding</category><pubDate>Wed, 24 Dec 2014 04:27:00 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74581,74586#msg-74586</guid>
<title>Re: Issue with displaying a textured quad</title><link>http://forum.wiibrew.org/read.php?11,74581,74586#msg-74586</link><description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>owen</strong><br />i think you set the GX stuff before you push the vertex info.<br /><br />similar to how the lights are done in this post; [<a href="http://forum.wiibrew.org/read.php?11,74547,74559#msg-74559" rel="nofollow">forum.wiibrew.org</a>]</div></blockquote>
Thanks for the replies, Owen. Very helpful!<br /><br />So, I did some more experimentation today and took another closer look at the gxSprites example. As it turned out, the primary issue was that I wasn&#039;t loading the texture correctly. While all of the preparation was right, I misunderstood the part about having to load the texture into memory when needed. Once I changed things around and got that right, it started rendering.<br /><br />The issue I have run into now is my texture is squashed; it&#039;s either too short or too wide. I didn&#039;t change any of the viewport or projection settings from gxSprites so I&#039;m not sure what&#039;s causing it. Any ideas or suggestions?]]></description>
<dc:creator>DaveB1980</dc:creator>
<category>Coding</category><pubDate>Wed, 24 Dec 2014 04:21:43 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74581,74584#msg-74584</guid>
<title>Re: Issue with displaying a textured quad</title><link>http://forum.wiibrew.org/read.php?11,74581,74584#msg-74584</link><description><![CDATA[ i think you set the GX stuff before you push the vertex info.<br /><br />similar to how the lights are done in this post; [<a href="http://forum.wiibrew.org/read.php?11,74547,74559#msg-74559" rel="nofollow">forum.wiibrew.org</a>]]]></description>
<dc:creator>owen</dc:creator>
<category>Coding</category><pubDate>Wed, 24 Dec 2014 03:05:36 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,74581,74581#msg-74581</guid>
<title>Issue with displaying a textured quad</title><link>http://forum.wiibrew.org/read.php?11,74581,74581#msg-74581</link><description><![CDATA[ I&#039;m working on building my first Wii game and I&#039;m having a very, very confusing issue with texturing a quad. I&#039;m relatively certain that I figured out how to include the texture file itself and to get it to be compiled with the binary at build time, but at run-time, it&#039;s all screwed up (for lack of a better way to say it). Below are two screen shots; one of what *should* be appearing on screen and one of what I&#039;m seeing.<br /><br />Working: <a href="http://www.webetry.com/misc/WorkingTexture.png" rel="nofollow">http://www.webetry.com/misc/WorkingTexture.png</a><br />Broken: <a href="http://www.webetry.com/misc/BrokenTexture.png" rel="nofollow">http://www.webetry.com/misc/BrokenTexture.png</a><br /><br />The code that is being run at render time is as follows:<br /><br /><pre class="bbcode">
    // Before starting rendering
    guMtxIdentity(mGXmodelView2D);
    guMtxTransApply (mGXmodelView2D, mGXmodelView2D, 0.0F, 0.0F, -5.0F);
    GX_LoadPosMtxImm(mGXmodelView2D, GX_PNMTX0);


    // Begin Draw, set mode to Quads
    GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
    
    // Top Left
    GX_Position2f32(quadCoords[0][0], quadCoords[0][1]);
    GX_TexCoord2f32(texCoords[0][0], texCoords[0][1]);

    // Top Right
    GX_Position2f32(quadCoords[1][0], quadCoords[1][1]);
    GX_TexCoord2f32(texCoords[1][0], texCoords[1][1]);
    
    // Bottom Right
    GX_Position2f32(quadCoords[2][0], quadCoords[2][1]);
    GX_TexCoord2f32(texCoords[2][0], texCoords[2][1]);
    
    // Bottom Left
    GX_Position2f32(quadCoords[3][0], quadCoords[3][1]);
    GX_TexCoord2f32(texCoords[3][0], texCoords[3][1]);
    
    // End Draw
    GX_End();


    // After rendering
    GX_DrawDone();
    
    GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
    GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
    GX_SetAlphaUpdate(GX_TRUE);
    GX_SetColorUpdate(GX_TRUE);
    GX_CopyDisp(mFrameBuffers[mFrameBufferIndex], GX_TRUE);
    
    VIDEO_SetNextFramebuffer(mFrameBuffers[mFrameBufferIndex]);
    
    if(mFirstFrameBuffer)
    {
        VIDEO_SetBlack(FALSE);
        mFirstFrameBuffer = 0;
    }
    VIDEO_Flush();
    VIDEO_WaitVSync();
    mFrameBufferIndex ^= 1;</pre><br />The weird grayscale thing going on with the image makes me wonder if it&#039;s a format issue. In my .scf file, I have colfmt set to 6 for PNG. That is correct, right?<br /><br />Are there any quirks as far as image encoding, compression or color profiles that I need to be aware of when exporting graphical assets to use?]]></description>
<dc:creator>DaveB1980</dc:creator>
<category>Coding</category><pubDate>Tue, 23 Dec 2014 04:52:14 +0100</pubDate></item>
</channel>
</rss>