Changeset 1216


Ignore:
Timestamp:
Apr 11, 2012, 2:27:58 PM (11 years ago)
Author:
sam
Message:

tutorial: fix the texture swizzling for the fractal viewer on Xbox 360.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/tutorial/tut03.cpp

    r1215 r1216  
    9999            m_dirty[i] = 2;
    100100        }
    101 #if defined __CELLOS_LV2__
     101#if defined __CELLOS_LV2__ || defined _XBOX
    102102        //m_center = f64cmplx(-.22815528839841, -1.11514249704382);
    103103        //m_center = f64cmplx(0.001643721971153, 0.822467633298876);
     
    133133            uint8_t green = g * 255.99f;
    134134            uint8_t blue = b * 255.99f;
    135 #if defined __CELLOS_LV2__
     135#if defined __CELLOS_LV2__ || defined _XBOX
    136136            m_palette[i] = u8vec4(255, red, green, blue);
    137137#elif defined __native_client__
     
    214214
    215215        ivec3 buttons = Input::GetMouseButtons();
    216 #if !defined __CELLOS_LV2__
     216#if !defined __CELLOS_LV2__ && !defined _XBOX
    217217        if (buttons[1])
    218218        {
     
    274274            }
    275275            m_radius *= zoom;
    276 #if !defined __CELLOS_LV2__
     276#if !defined __CELLOS_LV2__ && !defined _XBOX
    277277            m_center += m_translate;
    278278            m_center = (m_center - worldmouse) * zoom + worldmouse;
     
    419419            else
    420420            {
    421 #if defined __CELLOS_LV2__
     421#if defined __CELLOS_LV2__ || defined _XBOX
    422422                *m_pixelstart++ = u8vec4(255, 0, 0, 0);
    423423#else
     
    470470            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    471471            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
     472#elif defined _XBOX
     473            /* By default the X360 will swizzle the texture. Ask for linear. */
     474            g_d3ddevice->CreateTexture(m_size.x / 2, m_size.y * 2, 1,
     475                                       D3DUSAGE_WRITEONLY, D3DFMT_LIN_A8R8G8B8,
     476                                       D3DPOOL_DEFAULT, &m_tex, NULL);
    472477#else
    473478            g_d3ddevice->CreateTexture(m_size.x / 2, m_size.y * 2, 1,
     
    733738#if defined _XBOX || defined USE_D3D9
    734739            D3DLOCKED_RECT rect;
     740#   if defined _XBOX
     741            m_tex->LockRect(0, &rect, NULL, D3DLOCK_NOOVERWRITE);
     742#   else
    735743            m_tex->LockRect(0, &rect, NULL,
    736744                            D3DLOCK_DISCARD | D3DLOCK_NOOVERWRITE);
     745#   endif
    737746            for (int j = 0; j < m_size.y * 2; j++)
    738747            {
     
    859868int main(int argc, char **argv)
    860869{
    861     Application app("Tutorial 3: Fractal", ivec2(640, 480), 60.0f);
    862 
    863 #if defined _MSC_VER
     870    Application app("Tutorial 3: Fractal", ivec2(640, 480, 60.0f);
     871
     872#if defined _MSC_VER && !defined _XBOX
    864873    _chdir("..");
    865 #elif defined _WIN32
     874#elif defined _WIN32 && !defined _XBOX
    866875    _chdir("../..");
    867876#endif
Note: See TracChangeset for help on using the changeset viewer.