<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>texture | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/texture/feed/" rel="self" type="application/rss+xml" />
	<link>https://learncgames.com</link>
	<description>A blog about C, programming games and my ebook(s).</description>
	<lastBuildDate>Sat, 25 Apr 2020 21:35:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://learncgames.com/wp-content/uploads/2020/03/cropped-favicon-32x32.png</url>
	<title>texture | Learn C Games Programming Blog</title>
	<link>https://learncgames.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">181446779</site>	<item>
		<title>SDL. Surfaces or textures?</title>
		<link>https://learncgames.com/sdl-surfaces-or-textures/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sdl-surfaces-or-textures</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Mon, 04 May 2020 23:00:32 +0000</pubDate>
				<category><![CDATA[Ebook]]></category>
		<category><![CDATA[SDL]]></category>
		<category><![CDATA[Techniques]]></category>
		<category><![CDATA[surface]]></category>
		<category><![CDATA[texture]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=523</guid>

					<description><![CDATA[<p>When I first started on the asteroids game, I did it as a set of tutorials on About.com. That was around 2011/2012 and back then I used SDL 1 which was all about surfaces not textures. When I picked up SDL coding again in 2018, it had progressed to SDL2 which uses textures. As I [&#8230;]</p>
The post <a href="https://learncgames.com/sdl-surfaces-or-textures/">SDL. Surfaces or textures?</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:538,&quot;href&quot;:&quot;http:\/\/libsdl.org&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205192603\/https:\/\/www.libsdl.org\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 15:57:32&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-10 02:51:56&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-13 09:33:58&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-16 18:09:01&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-21 06:45:36&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-24 15:37:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-28 04:04:30&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-03 17:50:08&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-07 01:13:30&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-10 01:47:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-13 09:00:02&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-16 09:18:20&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-21 17:14:07&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-25 02:02:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-28 15:58:56&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-01 03:07:18&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-04 13:20:07&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-04 13:20:07&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:741,&quot;href&quot;:&quot;https:\/\/dzone.com\/articles\/sdl2-pixel-drawing?fromrel=true&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20220817005424\/https:\/\/dzone.com\/articles\/sdl2-pixel-drawing?fromrel=true&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 18:05:52&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-12 18:00:58&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-15 20:08:47&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-28 07:11:10&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-10 03:00:12&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-15 13:00:53&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-22 18:02:17&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-02 15:48:00&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-06 08:24:08&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-06 08:24:08&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:742,&quot;href&quot;:&quot;http:\/\/www.illwinter.com\/dom\/screenshots.html&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260206180829\/https:\/\/www.illwinter.com\/dom\/screenshots.html&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-08 14:17:22&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 18:00:58&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-15 20:08:49&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-28 07:11:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-10 03:00:15&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-15 13:00:53&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-22 18:02:18&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-02 15:48:02&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-06 08:24:10&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-06 08:24:10&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]'></div>
<p><img fetchpriority="high" decoding="async" class="alignleft size-medium wp-image-524" src="https://learncgames.com/wp-content/uploads/2020/04/dominions-300x225.png" alt="Screenshot from Dominions" width="300" height="225" srcset="https://learncgames.com/wp-content/uploads/2020/04/dominions-300x225.png 300w, https://learncgames.com/wp-content/uploads/2020/04/dominions.png 440w" sizes="(max-width: 300px) 100vw, 300px" />When I first started on the asteroids game, I did it as a set of tutorials on About.com. That was around 2011/2012 and back then I used SDL 1 which was all about surfaces not textures. When I picked up <a title="Link to the SDL website" href="http://libsdl.org/" target="_blank" rel="noopener noreferrer">SDL coding</a> again in 2018, it had progressed to SDL2 which uses textures.</p>
<p>As I understand it, a surface is a structure in RAM while a texture is a structure in VRAM ( the memory in the GPU(. That makes it much faster copying pixels from VRAM to VRAM than from RAM to VRAM.</p>
<p>But I found it much easier to read pixels from a surface than from a texture. Chapter 38 in my e-book has a mask utility. It loads the images from disk into a surface then reads the pixels and creates the masks from that. Masks are used in collision detection. I had previously thought you couldn&#8217;t read from a texture.</p>
<p>However after reading <a href="https://dzone.com/articles/sdl2-pixel-drawing?fromrel=true" target="_blank" rel="noopener noreferrer">this article</a>, which writes directly to the pixels in a texture, it makes me think that reading from them should be possible. I will give it a go just because I&#8217;ve not seen it done anywhere.</p>
<p>Picture is from the game <a href="http://www.illwinter.com/dom/screenshots.html" target="_blank" rel="noopener noreferrer">Dominions</a>, created with SDL.</p>The post <a href="https://learncgames.com/sdl-surfaces-or-textures/">SDL. Surfaces or textures?</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">523</post-id>	</item>
	</channel>
</rss>
