<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: 16. OpenGL Texturing</title>
	<atom:link href="http://www.swiftless.com/tutorials/opengl/texture_under_windows.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.swiftless.com/tutorials/opengl/texture_under_windows.html</link>
	<description>Game Programming and Computer Graphics Tutorials</description>
	<lastBuildDate>Wed, 01 Feb 2012 09:19:36 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Kazuya</title>
		<link>http://www.swiftless.com/tutorials/opengl/texture_under_windows.html/comment-page-1#comment-2992</link>
		<dc:creator>Kazuya</dc:creator>
		<pubDate>Thu, 10 Nov 2011 23:35:19 +0000</pubDate>
		<guid isPermaLink="false">http://swiftless.com/wordpress/?p=172#comment-2992</guid>
		<description>Dear Swiftless,
could you please explain to us about the mismatch colour and how to fix it, I am experiencing the same problem. Thanks.</description>
		<content:encoded><![CDATA[<p>Dear Swiftless,<br />
could you please explain to us about the mismatch colour and how to fix it, I am experiencing the same problem. Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mohagali</title>
		<link>http://www.swiftless.com/tutorials/opengl/texture_under_windows.html/comment-page-1#comment-2912</link>
		<dc:creator>mohagali</dc:creator>
		<pubDate>Wed, 09 Nov 2011 22:24:05 +0000</pubDate>
		<guid isPermaLink="false">http://swiftless.com/wordpress/?p=172#comment-2912</guid>
		<description>you tutorial 100% rate and 
i want function  load bmp  like load file.raw</description>
		<content:encoded><![CDATA[<p>you tutorial 100% rate and<br />
i want function  load bmp  like load file.raw</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: farheen</title>
		<link>http://www.swiftless.com/tutorials/opengl/texture_under_windows.html/comment-page-1#comment-2749</link>
		<dc:creator>farheen</dc:creator>
		<pubDate>Sat, 05 Nov 2011 09:52:34 +0000</pubDate>
		<guid isPermaLink="false">http://swiftless.com/wordpress/?p=172#comment-2749</guid>
		<description>hey em writing ur code as it is but it gives a yellow window screen as output. can u plz tell me what is the problem?</description>
		<content:encoded><![CDATA[<p>hey em writing ur code as it is but it gives a yellow window screen as output. can u plz tell me what is the problem?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: [OpenGL] Texture 函式參數 &#171; 逍遙文工作室</title>
		<link>http://www.swiftless.com/tutorials/opengl/texture_under_windows.html/comment-page-1#comment-2214</link>
		<dc:creator>[OpenGL] Texture 函式參數 &#171; 逍遙文工作室</dc:creator>
		<pubDate>Mon, 05 Sep 2011 14:06:50 +0000</pubDate>
		<guid isPermaLink="false">http://swiftless.com/wordpress/?p=172#comment-2214</guid>
		<description>[...] 參考：16. OpenGL Texturing。 Share this:ShareEmailPrintFacebookTwitterLike this:LikeBe the first to like this post. [...]</description>
		<content:encoded><![CDATA[<p>[...] 參考：16. OpenGL Texturing。 Share this:ShareEmailPrintFacebookTwitterLike this:LikeBe the first to like this post. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim</title>
		<link>http://www.swiftless.com/tutorials/opengl/texture_under_windows.html/comment-page-1#comment-2145</link>
		<dc:creator>Tim</dc:creator>
		<pubDate>Tue, 23 Aug 2011 06:32:17 +0000</pubDate>
		<guid isPermaLink="false">http://swiftless.com/wordpress/?p=172#comment-2145</guid>
		<description>Beatriz / future readers:

Trying something like that given below to map the texture to different objects. The rest of the code can remain the same. I hope it makes things a little clearer. 

shader.vert: 

varying vec2 Pos;

void main() {			
	
	// Set the position of the current vertex 
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

	Pos = vec2(gl_Vertex.x, gl_Vertex.y);

}

shader.frag:

uniform sampler2D color_texture;
varying vec2 Pos;

void main() {
	// Set the output color of our current pixel
	gl_FragColor = texture2D(color_texture, Pos);
}</description>
		<content:encoded><![CDATA[<p>Beatriz / future readers:</p>
<p>Trying something like that given below to map the texture to different objects. The rest of the code can remain the same. I hope it makes things a little clearer. </p>
<p>shader.vert: </p>
<p>varying vec2 Pos;</p>
<p>void main() {			</p>
<p>	// Set the position of the current vertex<br />
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;</p>
<p>	Pos = vec2(gl_Vertex.x, gl_Vertex.y);</p>
<p>}</p>
<p>shader.frag:</p>
<p>uniform sampler2D color_texture;<br />
varying vec2 Pos;</p>
<p>void main() {<br />
	// Set the output color of our current pixel<br />
	gl_FragColor = texture2D(color_texture, Pos);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Janus Pannonius</title>
		<link>http://www.swiftless.com/tutorials/opengl/texture_under_windows.html/comment-page-1#comment-2011</link>
		<dc:creator>Janus Pannonius</dc:creator>
		<pubDate>Tue, 02 Aug 2011 06:58:42 +0000</pubDate>
		<guid isPermaLink="false">http://swiftless.com/wordpress/?p=172#comment-2011</guid>
		<description>I found the solution for the problem, I don&#039;t need any help now.</description>
		<content:encoded><![CDATA[<p>I found the solution for the problem, I don&#8217;t need any help now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Janus Pannonius</title>
		<link>http://www.swiftless.com/tutorials/opengl/texture_under_windows.html/comment-page-1#comment-2004</link>
		<dc:creator>Janus Pannonius</dc:creator>
		<pubDate>Sun, 31 Jul 2011 08:28:23 +0000</pubDate>
		<guid isPermaLink="false">http://swiftless.com/wordpress/?p=172#comment-2004</guid>
		<description>Hi Swiftless!

I wrote a class-based image loader, but I have many problems with that.

First, it loads the RAW file with its parameters, but if I run my program I just see a blank white screen.

Second, if I don&#039;t set the parameters of the bitmap outside of the load-function, every parameters will be 0.

Here is the code:

// ctexture.h

#include 
#include 

using namespace std;

class CTexture
{
public:
	int Load(char* Filename, int Width, int Height);
	void SetActive();
	void Delete();
	unsigned int GetID();
	int Width;
	int Height;
	unsigned int ID;
	int GetWidth();
	int GetHeight();
private:
	GLuint Texture;
	unsigned char* Data;
};

int CTexture::Load(char* Filename, int Width, int Height)
{
	FILE* File;
	File=fopen(Filename,&quot;rb&quot;);
	Data=(unsigned char*)malloc(Width*Height*3);
	fread(Data,Width*Height*3,1,File);
	fclose(File);
	glGenTextures(1,&amp;Texture);
	glBindTexture(GL_TEXTURE_2D,Texture);
	glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
	glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
	glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,Width,Height,0,GL_RGB,GL_UNSIGNED_BYTE,Data);
	free(Data);
	return Texture;
}

void CTexture::SetActive()
{
	glBindTexture(GL_TEXTURE_2D,ID);
}

void CTexture::Delete()
{
	glDeleteTextures(1,&amp;ID);
}

unsigned int CTexture::GetID()
{
	return ID;
}

int CTexture::GetWidth()
{
	return Width;
}

int CTexture::GetHeight()
{
	return Height;
}

// main.cpp

#include 
#include 
#include 
#include 
#include 

using namespace std;

CTexture Default;

GLvoid InitTextures(GLvoid)
{
	glEnable(GL_TEXTURE_2D);
	Default.Width=256;
	Default.Height=256;
	Default.ID=34;
	Default.Load(&quot;default.raw&quot;,Default.Width,Default.Height);
	cout&lt;&lt;&quot;Image width is: &quot;&lt;&lt;Default.Width&lt;&lt;endl;
	cout&lt;&lt;&quot;Image height is: &quot;&lt;&lt;Default.Height&lt;&lt;endl;
	cout&lt;&lt;&quot;ID: &quot;&lt;&lt;Default.ID&lt;&lt;endl;
}

void Display(void)
{
	InitTextures();
	glClearColor(0.0f,0.0f,0.0f,0.0f);
	glClear(GL_COLOR_BUFFER_BIT);
	Default.SetActive();
	glBegin(GL_QUADS);
		glTexCoord2f(0.0f,0.0f); glVertex2f(-1.0f,1.0f);
		glTexCoord2f(1.0f,0.0f); glVertex2f(1.0f,1.0f);
		glTexCoord2f(1.0f,1.0f); glVertex2f(1.0f,-1.0f);
		glTexCoord2f(0.0f,1.0f); glVertex2f(-1.0f,-1.0f);
	glEnd();
	glFlush();
}

int main(int argc,char** argv)
{
	glutInit(&amp;argc,argv);
	glutInitDisplayMode(GLUT_SINGLE);
	glutCreateWindow(&quot;OpenGL&quot;);
	glutDisplayFunc(Display);
	glutMainLoop();
}

Otherwise, I use Microsoft Visual C++ 2008 for programming.

I don&#039;t know what is the problem.

Thank you very much!</description>
		<content:encoded><![CDATA[<p>Hi Swiftless!</p>
<p>I wrote a class-based image loader, but I have many problems with that.</p>
<p>First, it loads the RAW file with its parameters, but if I run my program I just see a blank white screen.</p>
<p>Second, if I don&#8217;t set the parameters of the bitmap outside of the load-function, every parameters will be 0.</p>
<p>Here is the code:</p>
<p>// ctexture.h</p>
<p>#include<br />
#include </p>
<p>using namespace std;</p>
<p>class CTexture<br />
{<br />
public:<br />
	int Load(char* Filename, int Width, int Height);<br />
	void SetActive();<br />
	void Delete();<br />
	unsigned int GetID();<br />
	int Width;<br />
	int Height;<br />
	unsigned int ID;<br />
	int GetWidth();<br />
	int GetHeight();<br />
private:<br />
	GLuint Texture;<br />
	unsigned char* Data;<br />
};</p>
<p>int CTexture::Load(char* Filename, int Width, int Height)<br />
{<br />
	FILE* File;<br />
	File=fopen(Filename,&#8221;rb&#8221;);<br />
	Data=(unsigned char*)malloc(Width*Height*3);<br />
	fread(Data,Width*Height*3,1,File);<br />
	fclose(File);<br />
	glGenTextures(1,&amp;Texture);<br />
	glBindTexture(GL_TEXTURE_2D,Texture);<br />
	glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);<br />
	glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);<br />
    glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);<br />
	glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,Width,Height,0,GL_RGB,GL_UNSIGNED_BYTE,Data);<br />
	free(Data);<br />
	return Texture;<br />
}</p>
<p>void CTexture::SetActive()<br />
{<br />
	glBindTexture(GL_TEXTURE_2D,ID);<br />
}</p>
<p>void CTexture::Delete()<br />
{<br />
	glDeleteTextures(1,&amp;ID);<br />
}</p>
<p>unsigned int CTexture::GetID()<br />
{<br />
	return ID;<br />
}</p>
<p>int CTexture::GetWidth()<br />
{<br />
	return Width;<br />
}</p>
<p>int CTexture::GetHeight()<br />
{<br />
	return Height;<br />
}</p>
<p>// main.cpp</p>
<p>#include<br />
#include<br />
#include<br />
#include<br />
#include </p>
<p>using namespace std;</p>
<p>CTexture Default;</p>
<p>GLvoid InitTextures(GLvoid)<br />
{<br />
	glEnable(GL_TEXTURE_2D);<br />
	Default.Width=256;<br />
	Default.Height=256;<br />
	Default.ID=34;<br />
	Default.Load(&#8220;default.raw&#8221;,Default.Width,Default.Height);<br />
	cout&lt;&lt;&quot;Image width is: &quot;&lt;&lt;Default.Width&lt;&lt;endl;<br />
	cout&lt;&lt;&quot;Image height is: &quot;&lt;&lt;Default.Height&lt;&lt;endl;<br />
	cout&lt;&lt;&quot;ID: &quot;&lt;&lt;Default.ID&lt;&lt;endl;<br />
}</p>
<p>void Display(void)<br />
{<br />
	InitTextures();<br />
	glClearColor(0.0f,0.0f,0.0f,0.0f);<br />
	glClear(GL_COLOR_BUFFER_BIT);<br />
	Default.SetActive();<br />
	glBegin(GL_QUADS);<br />
		glTexCoord2f(0.0f,0.0f); glVertex2f(-1.0f,1.0f);<br />
		glTexCoord2f(1.0f,0.0f); glVertex2f(1.0f,1.0f);<br />
		glTexCoord2f(1.0f,1.0f); glVertex2f(1.0f,-1.0f);<br />
		glTexCoord2f(0.0f,1.0f); glVertex2f(-1.0f,-1.0f);<br />
	glEnd();<br />
	glFlush();<br />
}</p>
<p>int main(int argc,char** argv)<br />
{<br />
	glutInit(&amp;argc,argv);<br />
	glutInitDisplayMode(GLUT_SINGLE);<br />
	glutCreateWindow(&quot;OpenGL&quot;);<br />
	glutDisplayFunc(Display);<br />
	glutMainLoop();<br />
}</p>
<p>Otherwise, I use Microsoft Visual C++ 2008 for programming.</p>
<p>I don&#039;t know what is the problem.</p>
<p>Thank you very much!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tuhin</title>
		<link>http://www.swiftless.com/tutorials/opengl/texture_under_windows.html/comment-page-1#comment-1928</link>
		<dc:creator>tuhin</dc:creator>
		<pubDate>Thu, 14 Jul 2011 00:35:37 +0000</pubDate>
		<guid isPermaLink="false">http://swiftless.com/wordpress/?p=172#comment-1928</guid>
		<description>hi after running this sample code i got only white square which one is rotating. i placed raw file to same folder.but there is no error and no texture.</description>
		<content:encoded><![CDATA[<p>hi after running this sample code i got only white square which one is rotating. i placed raw file to same folder.but there is no error and no texture.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rydik</title>
		<link>http://www.swiftless.com/tutorials/opengl/texture_under_windows.html/comment-page-1#comment-1696</link>
		<dc:creator>Rydik</dc:creator>
		<pubDate>Tue, 31 May 2011 20:10:08 +0000</pubDate>
		<guid isPermaLink="false">http://swiftless.com/wordpress/?p=172#comment-1696</guid>
		<description>For future readers: make sure the file path has forward slashes (/) instead of the standard (\). This is a really easy mistake that may save you some headache.

Btw, started learning opengl here. Now I have an ios app out. Check out &quot;Fission HD&quot; on YouTube. Thanks</description>
		<content:encoded><![CDATA[<p>For future readers: make sure the file path has forward slashes (/) instead of the standard (\). This is a really easy mistake that may save you some headache.</p>
<p>Btw, started learning opengl here. Now I have an ios app out. Check out &#8220;Fission HD&#8221; on YouTube. Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Janus Pannonius</title>
		<link>http://www.swiftless.com/tutorials/opengl/texture_under_windows.html/comment-page-1#comment-1684</link>
		<dc:creator>Janus Pannonius</dc:creator>
		<pubDate>Tue, 24 May 2011 15:46:28 +0000</pubDate>
		<guid isPermaLink="false">http://swiftless.com/wordpress/?p=172#comment-1684</guid>
		<description>Hi, Swiftless!
This idea is very good.
It works perfectly.
Thank you very much.
(Nagyon szépen köszönöm! :D)</description>
		<content:encoded><![CDATA[<p>Hi, Swiftless!<br />
This idea is very good.<br />
It works perfectly.<br />
Thank you very much.<br />
(Nagyon szépen köszönöm! <img src='http://www.swiftless.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> )</p>
]]></content:encoded>
	</item>
</channel>
</rss>

