|
From: <cad...@li...> - 2006-04-10 02:07:48
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns=3D"http://www.w3.org/1999/xhtml"> <head><style type=3D"text/css"><!-- body {background:#ffffff;font-family:Verdana,Helvetica,Arial,sans-serif;} h3 {margin:15px 0;padding:0;line-height:0;} #msg {margin: 0 0 2em 0;} #msg dl, #msg ul, #msg pre {padding:1em;border:1px dashed black;margin: 1= 0px 0 30px 0;} #msg dl {background:#ccccff;} #msg pre {background:#ffffcc;} #msg ul {background:#cc99ff;list-style:none;} #msg dt {font-weight:bold;float:left;width: 6em;} #msg dt:after { content:':';} #patch h4 {padding: 0 10px;line-height:1.5em;margin:0;background:#ccffff;= border-bottom:1px solid black;margin:0 0 10px 0;} #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patc= h .binary {border:1px solid black;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} --></style> <title>[311] tiki/src/gl/texture.cpp: Tiki: twiddle Dreamcast textures lo= aded from files</title> </head> <body> <div id=3D"msg"> <dl> <dt>Revision</dt> <dd>311</dd> <dt>Author</dt> <dd>sam.steele</dd> <dt>Date</dt> <dd>2006-04-08 11:54:33 -0700 (Sat, 08 Apr 2006)</dd> </dl> <h3>Log Message</h3> <pre>Tiki: twiddle Dreamcast textures loaded from files</pre> <h3>Modified Paths</h3> <ul> <li><a href=3D"#tikisrcgltexturecpp">tiki/src/gl/texture.cpp</a></li> </ul> </div> <div id=3D"patch"> <h3>Diff</h3> <a id=3D"tikisrcgltexturecpp"></a> <div class=3D"modfile"><h4>Modified: tiki/src/gl/texture.cpp (310 =3D> 31= 1)</h4> <pre class=3D"diff"> <span class=3D"info">--- tiki/src/gl/texture.cpp 2006-04-06 23:28:37 UTC = (rev 310) +++ tiki/src/gl/texture.cpp 2006-04-08 18:54:33 UTC (rev 311) </span><span class=3D"lines">@@ -49,7 +49,11 @@ </span><span class=3D"cx"> m_w =3D m_h =3D 0; m_fmt =3D None; if (!initial && m_txrdata && m_txrdata !=3D oldptr) </span><span class=3D"add">+#if TIKI_PLAT !=3D TIKI_DC </span><span class=3D"cx"> delete[] m_txrdata; </span><span class=3D"add">+#else + //glDeleteTexture frees the PVR memory for us, how nice of it! +#endif </span><span class=3D"cx"> m_txrdata =3D NULL; if (!initial && m_gltxr) glDeleteTextures(1, &m_gltxr); </span><span class=3D"lines">@@ -178,10 +182,6 @@ </span><span class=3D"cx"> memcpy(m_ptr, img->data, img->byteCoun= t); } =20 </span><span class=3D"rem">- /* We'll write the converted data into this = buffer */ - if (!m_txrdata) - m_txrdata =3D new uint8[img->w * img->h * 4]; - </span><span class=3D"cx"> m_w =3D img->w; m_h =3D img->h; m_fmt =3D (Fmt)(img->fmt); </span><span class=3D"lines">@@ -204,6 +204,10 @@ </span><span class=3D"cx"> glBindTexture(GL_TEXTURE_2D, m_gltxr); =20 #if TIKI_PLAT !=3D TIKI_DC </span><span class=3D"add">+ /* We'll write the converted data into this = buffer */ + if (!m_txrdata) + m_txrdata =3D new uint8[img->w * img->h * 4]; +=09 </span><span class=3D"cx"> convertToGl(); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); </span><span class=3D"lines">@@ -211,10 +215,13 @@ </span><span class=3D"cx"> =09 GLenum err =3D glGetError(); #else </span><span class=3D"add">+ m_txrdata =3D (uint8 *)pvr_mem_malloc(img-&g= t;w * img->h * 2);=09 + pvr_txr_load_ex(m_ptr, m_txrdata, img->w, img->h, PVR_TXRLOAD_16B= PP); +=09 </span><span class=3D"cx"> if(use_alpha) { </span><span class=3D"rem">- glTexImage2D(GL_TEXTURE_2D, 0, GL_ARGB4444,= m_w, m_h, 0, GL_ARGB4444, GL_UNSIGNED_BYTE, m_ptr); </span><span class=3D"add">+ glKosTex2D(GL_ARGB4444_TWID, m_w, m_h, m_tx= rdata); </span><span class=3D"cx"> } else { </span><span class=3D"rem">- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB565, m= _w, m_h, 0, GL_RGB565, GL_UNSIGNED_BYTE, m_ptr); </span><span class=3D"add">+ glKosTex2D(GL_RGB565_TWID, m_w, m_h, m_txrd= ata); </span><span class=3D"cx"> } glTexEnvi(GL_TEXTURE_2D,GL_TEXTURE_ENV_MODE,GL_MODULATEALPHA); #endif </span> </pre> </div> </div> </body> </html> |