<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853963</guid>
        <pubDate>Mon, 08 Nov 2021 07:37:10 +0000</pubDate>
        <title>Прозрачность без альфа-канала</title>
        <link>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853963</link>
        <description><![CDATA[Mikle: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=423945&view=findpost&p=3853962'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>F0X &#064; <time class="tag-quote__quoted-time" datetime="2021-11-08T10:22:40+03:00">08.11.21, 07:22</time></span><div class='quote '>Все работает</div></div><br>
Поздравляю&#33; :)]]></description>
        <author>Mikle</author>
        <category>Программирование графики</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853962</guid>
        <pubDate>Mon, 08 Nov 2021 07:22:40 +0000</pubDate>
        <title>Прозрачность без альфа-канала</title>
        <link>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853962</link>
        <description><![CDATA[F0X: <div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">void FormLoadTexturesGL()</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;int i, j;</div><div class="code_line">&nbsp;&nbsp; &nbsp;FILE *file1;</div><div class="code_line">&nbsp;&nbsp; &nbsp;FILE *file2;</div><div class="code_line">&nbsp;&nbsp; &nbsp;BOOL flag;</div><div class="code_line">&nbsp;&nbsp; &nbsp;file1 = NULL;</div><div class="code_line">&nbsp;&nbsp; &nbsp;file2 = NULL;</div><div class="code_line">&nbsp;&nbsp; &nbsp;flag = FALSE;</div><div class="code_line">&nbsp;&nbsp; &nbsp;char str[][256] = </div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&quot;Pic 001.bmp&quot;, &quot;Pic 002.bmp&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp;};</div><div class="code_line">&nbsp;&nbsp; &nbsp;glGenTextures(1, &amp;e::texture[0]);</div><div class="code_line">&nbsp;&nbsp; &nbsp;file1 = fopen(str[0], &quot;r&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;file2 = fopen(str[1], &quot;r&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;if ((file1) &amp;&amp; (file2))</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;flag = TRUE;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fread(e::data1, 54, 1, file1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fread(e::data1, 512 * 512 * 3, 1, file1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fread(e::data2, 54, 1, file2);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fread(e::data2, 512 * 512 * 3, 1, file2);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for (j=0; j&#60;512; j++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{ &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (i=0; i&#60;512; i++)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e::data3[i][j][0] = e::data1[i][j][0];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e::data3[i][j][1] = e::data1[i][j][1];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e::data3[i][j][2] = e::data1[i][j][2];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;e::data3[i][j][3] = e::data2[i][j][1];</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;glBindTexture(GL_TEXTURE_2D, e::texture[0]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;glTexImage2D(GL_TEXTURE_2D, 0, 4, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, e::data3);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fclose(file1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fclose(file2);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (!flag)</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;MessageBox(NULL, &quot;Error : Textures load impossible&quot;, e::appname, MB_OK | MB_ICONERROR);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;exit(0);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">}</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
<br>
Все работает]]></description>
        <author>F0X</author>
        <category>Программирование графики</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853916</guid>
        <pubDate>Fri, 05 Nov 2021 19:12:45 +0000</pubDate>
        <title>Прозрачность без альфа-канала</title>
        <link>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853916</link>
        <description><![CDATA[F0X: Спасибо, буду разбираться )]]></description>
        <author>F0X</author>
        <category>Программирование графики</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853906</guid>
        <pubDate>Fri, 05 Nov 2021 15:37:45 +0000</pubDate>
        <title>Прозрачность без альфа-канала</title>
        <link>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853906</link>
        <description><![CDATA[Mikle: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=423945&view=findpost&p=3853900'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>F0X &#064; <time class="tag-quote__quoted-time" datetime="2021-11-05T13:53:01+00:00">05.11.21, 13:53</time></span><div class='quote '>Есть ли у Вас примерчик как это делается в Direct3D ?</div></div><br>
<br>
Сделал небольшой примерчик на FFP:<br>
<a class='tag-url' href='https://disk.yandex.ru/d/V7C-p_RMgNdi3A' target='_blank'>https://disk.yandex.ru/d/V7C-p_RMgNdi3A</a>]]></description>
        <author>Mikle</author>
        <category>Программирование графики</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853900</guid>
        <pubDate>Fri, 05 Nov 2021 13:53:01 +0000</pubDate>
        <title>Прозрачность без альфа-канала</title>
        <link>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853900</link>
        <description><![CDATA[F0X: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '> лучше на этапе загрузки сразу поместить данные первого изображения в RGB, а второго в A каналы одной текстуры</div></div><br>
<br>
Да, кстати, это отличная идея&#33;, а как это делается ? Есть ли у Вас примерчик как это делается в Direct3D ?<br>
Под OpenGL я перепишу.<br>
<br>
PS Пишу игрушку платформер-головоломку )]]></description>
        <author>F0X</author>
        <category>Программирование графики</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853899</guid>
        <pubDate>Fri, 05 Nov 2021 13:12:03 +0000</pubDate>
        <title>Прозрачность без альфа-канала</title>
        <link>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853899</link>
        <description><![CDATA[Mikle: Не знаю, как это делается в OpenGL (всегда использовал Direct3D).<br>Для Direct3D, если нужно, могу написать соответствующий шейдер. Только это в любом случае не оптимально, лучше на этапе загрузки сразу поместить данные первого изображения в RGB, а второго в A каналы одной текстуры.]]></description>
        <author>Mikle</author>
        <category>Программирование графики</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853886</guid>
        <pubDate>Fri, 05 Nov 2021 10:12:10 +0000</pubDate>
        <title>Прозрачность без альфа-канала</title>
        <link>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853886</link>
        <description><![CDATA[F0X: А как сделать вот так ?<br>
<span class="b-attach" data-size="12808" data-hits="377" data-attach-id="63120" data-attach-post-id="3853886">
			<span class="b-attach__title"></span><a class='b-attach-link' href='https://forum.sources.ru/index.php?act=Attach&amp;type=post&amp;id=3853886&amp;attach_id=63120' title='Скачать файл' target='_blank'>004.GIF</a> (, : 377)
		</span>]]></description>
        <author>F0X</author>
        <category>Программирование графики</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853885</guid>
        <pubDate>Fri, 05 Nov 2021 10:11:23 +0000</pubDate>
        <title>Прозрачность без альфа-канала</title>
        <link>https://forum.sources.ru/index.php?showtopic=423945&amp;view=findpost&amp;p=3853885</link>
        <description><![CDATA[F0X: Как использовать две текстуры для достижения прозрачности (полупрозрачности).<br>
В старых играх часто в папках лежали два файла картинка и черно-белая маска.<br>
<br>
Как использовать такую технику рисования, где вторая картинка по сути альфа-канал?<br>
<br>
Есть рисунок 1<br>
<span class="b-attach" data-size="2090" data-hits="327" data-attach-id="63117" data-attach-post-id="3853885">
			<span class="b-attach__title"></span><a class='b-attach-link' href='https://forum.sources.ru/index.php?act=Attach&amp;type=post&amp;id=3853885&amp;attach_id=63117' title='Скачать файл' target='_blank'>001.GIF</a> (, : 327)
		</span><br>
Есть рисунок 2 (маска)<br>
<span class="b-attach" data-size="1050" data-hits="283" data-attach-id="63118" data-attach-post-id="3853885">
			<span class="b-attach__title"></span><a class='b-attach-link' href='https://forum.sources.ru/index.php?act=Attach&amp;type=post&amp;id=3853885&amp;attach_id=63118' title='Скачать файл' target='_blank'>002.GIF</a> (, : 283)
		</span><br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp;glEnable(GL_TEXTURE_2D);</div><div class="code_line">&nbsp;&nbsp; &nbsp;glEnable(GL_BLEND);</div><div class="code_line">&nbsp;&nbsp; &nbsp;glDisable(GL_DEPTH_TEST);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;glBlendFunc(GL_SRC_COLOR, GL_ZERO);</div><div class="code_line">&nbsp;&nbsp; &nbsp;glBindTexture(GL_TEXTURE_2D, e::texture[1]);</div><div class="code_line">&nbsp;&nbsp; &nbsp;FormPaintTextures(0, 0);</div><div class="code_line">&nbsp;&nbsp; &nbsp;glBlendFunc(GL_ONE, GL_DST_COLOR);</div><div class="code_line">&nbsp;&nbsp; &nbsp;glBindTexture(GL_TEXTURE_2D, e::texture[0]);</div><div class="code_line">&nbsp;&nbsp; &nbsp;FormPaintTextures(0, 0);</div></ol></div></div></div></div><br>
Получился результат<br>
<span class="b-attach" data-size="12909" data-hits="385" data-attach-id="63119" data-attach-post-id="3853885">
			<span class="b-attach__title"></span><a class='b-attach-link' href='https://forum.sources.ru/index.php?act=Attach&amp;type=post&amp;id=3853885&amp;attach_id=63119' title='Скачать файл' target='_blank'>003.GIF</a> (, : 385)
		</span>]]></description>
        <author>F0X</author>
        <category>Программирование графики</category>
      </item>
	
      </channel>
      </rss>
	