<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
	<title>GameDev.net Forums RSS</title>
	<description>RSS Feed for all GameDev.net forums.</description>
	<link>http://www.gamedev.net</link>
	<pubDate>Sun, 26 Feb 2012 06:17:40 +0000</pubDate>
	<ttl>5</ttl>
	<image>
		<title>GameDev.net Forums RSS</title>
		<url>http://www.gamedev.net/favicon.ico</url>
		<link>http://www.gamedev.net</link>
	</image>
	<item>
		<title>FreeType troubles...</title>
		<link>http://www.gamedev.net/topic/620926-freetype-troubles/</link>
		<description><![CDATA[I am having a really harsh time in trying to implement Font rendering into my Engine... Now I'm mainly getting pissed off with FreeType, I just can't seem to understand it 100%. I'm loading the Font with TrueType and then looping through all the glyphs in the font and saving them into one single big Texture, in ASCII order, and uploading them to OpenGL, but that's not working out so well.<br />
<br />
I would really appreciate it if someone looked at my code and explain to me what I am doing wrong. At the moment I can't load a TrueType font and I doubt I'm rendering them correctly either but I am not sure as I have not tested it...<br />
<br />
Here is how I am loading fonts; the maximum size of a font is defaulted to 20, to save into a Texture:<br />
<pre class='prettyprint'>void OGLGraphicalAssetLoader::loadFontFromFile(const std::string& filepath,  Font* output) const
{
FT_Library library; // a FreeType Library object
FT_Face face; // This holds the TrueType Font.
FT_Error error; // Holds any errors that could occur.
error = FT_Init_FreeType(&library); // Initialize the FreeType Library
if(error)
{
  throw AnaxException("FreeType 2 Library could not be initialized", -2);
}
// Load the TrueType Font into memory
error = FT_New_Face(library, filepath.c_str(), 0, &face);
if(error)
{
  throw AnaxException("Could not load TrueType Font: " + filepath, -2);
}
FT_Set_Char_Size(face, output-&gt;getMaxSize() * 64, output-&gt;getMaxSize() * 64, 96, 96); // Set the size of the Font

// Create a blank Texture (Image)
Image tempImage;
tempImage.create(face-&gt;glyph-&gt;bitmap.width, face-&gt;glyph-&gt;bitmap.rows);

Rect2DFloat textureCoords; // Holds temporary Texture Coordinates
Uint32 drawX = 0, drawY = 0; // The x and y coordinates that the glypth will be drawn to in the Texture.
// Loop through the Glyph's putting them in the Texture (Image)
for(int i = 0; i &lt; 256; ++i)
{
  Uint32 index = FT_Get_Char_Index(face, (char)i);
  error = FT_Load_Glyph(face, index, FT_LOAD_DEFAULT);
  if(error)
   continue; // just ignore it.. (should throw an except or something along those lines
  error = FT_Render_Glyph(face-&gt;glyph, FT_RENDER_MODE_NORMAL);
  if(error)
   continue; // just ignore it...

  // Place Texture Coordinates
  textureCoords.position.x = drawX + face-&gt;glyph-&gt;bitmap_left;
  textureCoords.position.y = drawY - face-&gt;glyph-&gt;bitmap_top;
  textureCoords.size.width = face-&gt;glyph-&gt;bitmap.width;
  textureCoords.size.height = face-&gt;glyph-&gt;bitmap.rows;
  setFontTextureCoordinateValueForGlyth(output, i, textureCoords); // Set the Texture Coordinates
  // Render into Image
  BlitGlypth(face-&gt;glyph, &tempImage, textureCoords.position.x, textureCoords.position.y);

  // Increment drawing position
  drawX += face-&gt;glyph-&gt;advance.x &gt;&gt; 6;
  drawY += face-&gt;glyph-&gt;advance.y &gt;&gt; 6;
}
// Upload the Texture to OpenGL
Texture2D tempTexture;
loadTextureFromImage(tempImage, &tempTexture);
// Set the ID of the Font
setFontIdNumber(output, tempTexture.getID());
}</pre>
<br />
<br />
I'm not quite sure if I'm formatting each character correctly into my texture, also I do not know how to get or calculate the size that the Texture will be. When I am calling tempImage.create() it parses 0, 0 for the dimensions of the image... S:? Is it because there is not current glyph selected or..? How do I calculate what the Texture size should be.<br />
<br />
Here is how I am drawing the Font's, using a Rectangle to draw them:<br />
<pre class='prettyprint'>
void OGLRenderer::renderText(const Renderable2DText& text)
{
const std::string& theCharactersToRender = text.getText();
Renderable2DRect& rect = getRectFromText(text);

// Loop through all the characters
for(int i = 0; i &lt; theCharactersToRender.length(); ++i)
{
  const Rect2DFloat& subRect = text.getFont()-&gt;getGlypth(i);
  rect.setSubRect(subRect);

  // Render the Rect
  renderRect(rect);
  rect.move(subRect.position.x, subRect.position.y);
}
}
</pre>
<br />
If you need anymore detail on how I am implementing this, please say so <img src='http://public.gamedev.net//public/style_emoticons/default/smile.png' class='bbc_emoticon' alt=':)' />]]></description>
		<pubDate>Sun, 26 Feb 2012 06:17:40 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620926-freetype-troubles/</guid>
	</item>
	<item>
		<title>how to render a two-sided mesh with correct illumination</title>
		<link>http://www.gamedev.net/topic/620925-how-to-render-a-two-sided-mesh-with-correct-illumination/</link>
		<description><![CDATA[I can render two-sided mesh by set the cullmode to CULL_None, but when i illuminate it by a spot light, there is some black place where the back-face is.<br />
          <span rel='lightbox'><img src='http://public.gamedev.net//public/style_emoticons/default/sad.png' alt='Posted Image' class='bbc_img' /></span><br />
this is a screenshot with enable cull.<br />
<a class='resized_img' rel='lightbox[4916666]' id='ipb-attach-url-7459-0-66112600-1330237711' href="http://www.gamedev.net/index.php?app=core&module=attach&section=attach&attach_rel_module=post&attach_id=7459" title="1.png - Size: 795.96K, Downloads: 2"><img src="http://public.gamedev.net/uploads/monthly_02_2012/post-167371-0-66951700-1330233922_thumb.png" id='ipb-attach-img-7459-0-66112600-1330237711' style='width:480;height:357' class='attach' width="480" height="357" alt="Attached Image: 1.png" /></a><br />
<br />
the following screenshot with disable cull. the white sign is the back face of this mesh.<br />
<a class='resized_img' rel='lightbox[4916666]' id='ipb-attach-url-7460-0-66232600-1330237711' href="http://www.gamedev.net/index.php?app=core&module=attach&section=attach&attach_rel_module=post&attach_id=7460" title="2.png - Size: 823.87K, Downloads: 2"><img src="http://public.gamedev.net/uploads/monthly_02_2012/post-167371-0-73483400-1330234063_thumb.png" id='ipb-attach-img-7460-0-66232600-1330237711' style='width:480;height:361' class='attach' width="480" height="361" alt="Attached Image: 2.png" /></a><br />
<br />
I think the normal sampled from normal map is the normal for that pixel's reverse side, so my light can't illuminate it.<br />
<br />
I wan't to know how to render the two-sided mesh with  correct illumination, or get the correct normal for that pixel. <span rel='lightbox'><img src='http://public.gamedev.net//public/style_emoticons/default/sad.png' alt='Posted Image' class='bbc_img' /></span> <span rel='lightbox'><img src='http://public.gamedev.net//public/style_emoticons/default/sad.png' alt='Posted Image' class='bbc_img' /></span> <span rel='lightbox'><img src='http://public.gamedev.net//public/style_emoticons/default/sad.png' alt='Posted Image' class='bbc_img' /></span> <span rel='lightbox'><img src='http://public.gamedev.net//public/style_emoticons/default/sad.png' alt='Posted Image' class='bbc_img' /></span><br />
<br />
<br />
this is the mesh:<br />
<a class='resized_img' rel='lightbox[4916666]' id='ipb-attach-url-7461-0-66243900-1330237711' href="http://www.gamedev.net/index.php?app=core&module=attach&section=attach&attach_rel_module=post&attach_id=7461" title="3.png - Size: 232.74K, Downloads: 1"><img src="http://public.gamedev.net/uploads/monthly_02_2012/post-167371-0-47018200-1330234368_thumb.png" id='ipb-attach-img-7461-0-66243900-1330237711' style='width:480;height:469' class='attach' width="480" height="469" alt="Attached Image: 3.png" /></a><br />
<span rel='lightbox'><img src='http://public.gamedev.net//public/style_emoticons/default/sad.png' alt='Posted Image' class='bbc_img' /></span> <span rel='lightbox'><img src='http://public.gamedev.net//public/style_emoticons/default/sad.png' alt='Posted Image' class='bbc_img' /></span> <span rel='lightbox'><img src='http://public.gamedev.net//public/style_emoticons/default/sad.png' alt='Posted Image' class='bbc_img' /></span> <span rel='lightbox'><img src='http://public.gamedev.net//public/style_emoticons/default/sad.png' alt='Posted Image' class='bbc_img' /></span>]]></description>
		<pubDate>Sun, 26 Feb 2012 05:33:27 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620925-how-to-render-a-two-sided-mesh-with-correct-illumination/</guid>
	</item>
	<item>
		<title>NAT Info</title>
		<link>http://www.gamedev.net/topic/620924-nat-info/</link>
		<description><![CDATA[[PC1][PC2][PC3]--------------&gt;[ROUTER]---------(internet)---------&gt;[SERVER / Webpage]<br />
<br />
<br />
<br />
So, all the pcs have firefox running. The http port is 80, so all their input/output ports use 80 correct?<br />
<br />
They each have 3 local IPS: 192.168.0.X ,   X = 2, 3, 4<br />
<br />
When PC1 sends data to the router, what does it send? It's local IP and then some data (like a web address)?<br />
<br />
Then when the webpage comes back to the router, what exact info does it have to know that this is a request from PC1 to tell the Router this packet is for PC1? Because as far as I know the server ONLY receives the Routers IP and sends data back to the Router, but that packet has to have some knowledge embedded from the SERVER that says here ROUTER, this is for PC1.<br />
<br />
This is my setup:<br />
<br />
[PC1][PC2][PC3]--------------&gt;[ROUTER]---------(internet)---------&gt;[ROUTER2]----------&gt;[MY SERVER]<br />
<br />
What I know:<br />
<br />
ROUTER2's IP Address.<br />
MY SERVER's LAN IP address.<br />
The udp port that MY SERVER calls recv() on.<br />
<br />
Without port forwarding, how do I get a packet to hit from PC1 to MY SERVER? I know that if I port forward ROUTER2 to translate packets based on port, it WILL receive PC1's request, and then when it sends a packet back to PC1, it magically gets there, so what is the magic part I need to know about PC1?]]></description>
		<pubDate>Sun, 26 Feb 2012 04:53:29 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620924-nat-info/</guid>
	</item>
	<item>
		<title>FluidStudios MM + memory leak?</title>
		<link>http://www.gamedev.net/topic/620923-fluidstudios-mm-memory-leak/</link>
		<description><![CDATA[Okay, so I'm working on a game, and I've just gotten to the point where I've successfully implemented openGL, SDL and box2d. Cool, cool. Now doing some tests with anti-aliasing, I suddenly realize I got a memory leak.<br />
<br />
Here's my main game loop: <strong class='bbc'>EDIT: after further testing, I discovered the leak is coming from how I'm drawing the shape using openGL. So here's the code for drawing the box:</strong><br />
<br />
<strong class='bbc'>EDIT2: Okay, after some more testing, turns out all I needed was to add these two lines after glEnd();</strong><br />
<br />
<pre class='prettyprint'>
glDisable(GL_TEXTURE_2D);
			glDeleteTextures( 1, &texture );
</pre>
<br />
<strong class='bbc'>THE PROBLEM NOW</strong><br />
<br />
Now I've tried implementing FluidStudios memory manager which looks pretty awesome, but I can't seem to get it to work.<br />
<br />
I can access a few variables from the class because it's actually defined as a type in the header file, but then there are these functions that are just floating independently in the header file that I'm not sure how to access.<br />
<br />
I tried:<br />
<br />
<pre class='prettyprint'>
#include "mmgr.h"

extern void	m_dumpMemoryReport(const char *, const bool); //Adding this alone without the below lines doesn't give an error

//now trying to access it using only *ONE* of the two bellow

m_dumpMemoryReport("mem.txt",true); //undefined reference error
m_dumpMemoryReport(); //undefined reference error
</pre>
<br />
Any help on either of these (the memory leak or getting that memory manager to work) would be appreciated! Thanks!]]></description>
		<pubDate>Sun, 26 Feb 2012 03:53:02 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620923-fluidstudios-mm-memory-leak/</guid>
	</item>
	<item>
		<title>Explain this set of Code</title>
		<link>http://www.gamedev.net/topic/620922-explain-this-set-of-code/</link>
		<description><![CDATA[<pre class='prettyprint'>
#include&lt;iostream&gt;
#include&lt;string&gt;
using namespace std;

class car
{
	public:
	car(const string& name = " "); //cars name
	string getName() const; //returns name
	car* getNext() const;
	void setNext(car* next);

	private:
	string m_name; //naame of car
	car* m_pNext; //pointer to next car on the list

};

car::car(const string& name):
	m_name(name),
	m_pNext(0)
{}

string car::getName() const
{
	return m_name;
}

car* car::getNext() const
{
	return m_pNext;
}

void car::setNext(car* next)
{
	m_pNext = next;
}

class Garage
{
	friend ostream& operator&lt;&lt;(ostream& os, const Garage& aGarage);

	public:
	Garage();
	~Garage();
	void AddCar();
	void DeleteCar();
	void Clear();

	private:
	car* m_pHead;
};

Garage::Garage():
	m_pHead(0)
{}

Garage::~Garage()
{
	Clear();
}

void Garage::AddCar()
{
	//getting new car
	cout &lt;&lt; "Please enter new name of car: " &lt;&lt; endl;
	string name;
	cin &gt;&gt; name;

	car* pNewCar = new car(name);

	//if list is empty make new new head
	if( m_pHead == 0)
	{
		m_pHead = pNewCar;
	}

	//otherwise end of the list
	else
	{
		car* pIter = m_pHead;
		while(pIter-&gt;getNext() != 0)
		{
			pIter = pIter-&gt;getNext();
		}
		pIter-&gt;setNext(pNewCar);
	}
}

void Garage::DeleteCar()
{
	if(m_pHead == 0)
	{
		cout &lt;&lt; "The garage is empty !" &lt;&lt; endl;
	}
	else
	{
		car* pTemp = m_pHead;
		m_pHead = m_pHead-&gt;getNext();
		delete pTemp;
	}
}

void Garage::Clear()
{
	while(m_pHead != 0)
	{
		DeleteCar();
	}
}

ostream& operator&lt;&lt;(ostream& os, const Garage& aGarage)
{
	car* pIter = aGarage.m_pHead;

	os &lt;&lt; "\nHere's what cars are in the garage:\n";
	if(pIter == 0)
	{
		os &lt;&lt; "The garage is empty.\n";
	}

	else
	{
		while(pIter != 0)
		{
			os &lt;&lt; pIter-&gt;getName() &lt;&lt; endl;
			pIter = pIter-&gt;getNext();
		}
	}

	return os;
}

int main()
{
	Garage myGarage;
	int choice;

	do
	{
		cout &lt;&lt; myGarage;
		cout &lt;&lt; "Here you'll have your own car garage.\n";
		cout &lt;&lt; "0 - Quit" &lt;&lt; endl;
		cout &lt;&lt; "1 - Add Car" &lt;&lt; endl;
		cout &lt;&lt; "2 - Delete Car" &lt;&lt; endl;
		cout &lt;&lt; "3 - Clear Car" &lt;&lt; endl;
		cin &gt;&gt; choice;

		switch(choice)
		{
			case 0:cout &lt;&lt; "Thanks for Playing" &lt;&lt; endl; break;
			case 1:myGarage.AddCar(); break;
			case 2:myGarage.DeleteCar(); break;
			case 3:myGarage.Clear(); break;
			default: cout &lt;&lt; "Invalid choice.." &lt;&lt; endl;
		}
	}while(choice != 0);

	return 0;
}
</pre>
<br />
This is a some code I got from reading the Beginning C++ through Game Programming, it explains it in the book, but I really don't understand. I was wondering if anyone could help explain. I get really confused around the Garage Add member fucntion, that's what confuses most.]]></description>
		<pubDate>Sun, 26 Feb 2012 03:25:35 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620922-explain-this-set-of-code/</guid>
	</item>
	<item>
		<title>Any way to get which index is being computed in a vertex shader?</title>
		<link>http://www.gamedev.net/topic/620921-any-way-to-get-which-index-is-being-computed-in-a-vertex-shader/</link>
		<description><![CDATA[Note: I am in D3D11, &gt;=4.0 shaders<br />
<br />
I've been reading this page today:<br />
<br />
<a href='http://msdn.microsoft.com/en-us/library/windows/desktop/bb205118(v=vs.85).aspx' class='bbc_url' title='External link' rel='nofollow external'>http://msdn.microsof...8(v=vs.85).aspx</a><br />
<br />
It all seems very useful, however it's not quite what I need.<br />
<br />
SV_VertexID refers to the actual value of the index in the index buffer you're iterating through, with say, DrawIndexed.<br />
<br />
However, there doesn't seem to be a way to get the plain old 'which index am i on?'  So when you're for example debugging in PIX and see a DrawIndexed call of 192k indices, there's no way inside the vertex shader to know if you're computing index 0 or 192k or 5 or 99, etc.<br />
<br />
Does anybody know any way this is possible in HLSL?  I'm kind of stunned it doesn't exist.  There are many patterns where the value of the index could help you calculate something that would otherwise waste vertex format space.<br />
<br />
Just to be super clear, I'm talking about getting the value of VTX rather than IDX in the below scenario:<br />
<br />
<span rel='lightbox'><img src='http://bh.polpo.org/SV_VertexID.jpg' alt='Posted Image' class='bbc_img' /></span><br />
<br />
Thanks.]]></description>
		<pubDate>Sun, 26 Feb 2012 02:17:56 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620921-any-way-to-get-which-index-is-being-computed-in-a-vertex-shader/</guid>
	</item>
	<item>
		<title>Mapping problem with OsX Gamepad controls via HIDManager</title>
		<link>http://www.gamedev.net/topic/620920-mapping-problem-with-osx-gamepad-controls-via-hidmanager/</link>
		<description><![CDATA[I am currently trying to map gamepad controls in a Cocoa application, using Apple's HIDManager api.<br />
<br />
However, I ran into a problem, and can't find an easy solution to it.<br />
<br />
From examination, it seems to me, that the only way I can identify distinct control updates (button presses and stick movement) is via an integer identifier, I get back from the <em class='bbc'>HIDElementGetCookie(element)</em> function. But this identifier is completely vendor specific as far as I know.<br />
<br />
For example, on my simple logitech Gamepad, the Cookie 18 describes the X-Axis of the left analog stick, whereas on the PS3 controller the same Cookie value describes the upper-right shoulder button.<br />
<br />
Is there any technique or reliable other method, how I can identify specific elements of a controller?<br />
<br />
To add some code to my question, here is the HID callback function, that handles the control update:<br />
<pre class='prettyprint'>void gamepadAction(void* inContext, IOReturn inResult,
				   void* inSender, IOHIDValueRef value) {
  
	IOHIDElementRef element = IOHIDValueGetElement(value);
	Boolean isElement = CFGetTypeID(element) == IOHIDElementGetTypeID();
	if (!isElement)
		return;
	IOHIDElementCookie cookie = IOHIDElementGetCookie(element);
	IOHIDElementType type = IOHIDElementGetType(element);
	if (18 != cookie && 19 != cookie && 21 != cookie){
		NSLog(@"Gamepad talked rubbish at %d of type %d", cookie, type);
		return;
	}
  
	IOHIDElementCollectionType ctype = IOHIDElementGetCollectionType(element);
	CFStringRef name = IOHIDElementGetName(element);
  
	long elementValue = IOHIDValueGetIntegerValue(value);
	NSLog(@"Gamepad talked: %d / %d - %@ &#91;%i&#93; = %ld", type, ctype, name,
		  cookie, elementValue);
  
	if (18 == cookie || 19 == cookie || 21 == cookie){
		MyGameController* obj = (__bridge MyGameController*) inContext;
		float axisScale = 128;
	  
		float axisvalue = ((float)(elementValue-axisScale)/axisScale);
		if (elementValue &lt;= axisScale +1 &&
			elementValue &gt;= axisScale -1)
			axisvalue = 0.0;
		if (18 == cookie)
			&#91;obj setLatitude:axisvalue&#93;;
		else if (21 == cookie)
			&#91;obj setCenterDistance:axisvalue&#93;;
		else if (19 == cookie)
			&#91;obj setLongitude:axisvalue&#93;;
	}  
}</pre>]]></description>
		<pubDate>Sun, 26 Feb 2012 01:05:35 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620920-mapping-problem-with-osx-gamepad-controls-via-hidmanager/</guid>
	</item>
	<item>
		<title>C++ Win32 Winsock sending a file</title>
		<link>http://www.gamedev.net/topic/620919-c-win32-winsock-sending-a-file/</link>
		<description><![CDATA[Ive gotten a few comments on how the people with my game shouldnt have to keep downloading my game from lets say, media fire to get the newest updates. So i made a updater that has a list of files and folders. The host (me) sends the list of files and folders to the client. if the client already has it, then it wont add anything new. but if a folder/file is gone, a new folder is made and files are "downloaded". as in downloaded, i mean sent in chunks. they approach i made is basicly this:<br />
<br />
nBuffer is from recv. I open it with the mode binary.<br />
<br />
<br />
client:<br />
<pre class='prettyprint'>if(std::string(nBuffer)=="FILE_DONE_DOWN")
	{
	 std::cout&lt;&lt;"Finnished Downloading File: "&lt;&lt;this-&gt;Files_To_Update&#91;0&#93;&lt;&lt;'\n';
	 this-&gt;Files_To_Update.erase(this-&gt;Files_To_Update.begin());
	 if(this-&gt;Files_To_Update.size()&gt;0)
	 {
	  std::cout&lt;&lt;"Downloading File: "&lt;&lt;this-&gt;Files_To_Update&#91;0&#93;&lt;&lt;'\n';
	  this-&gt;Send_Client(this-&gt;Files_To_Update&#91;0&#93;);
	  this-&gt;WriteToFile.open(this-&gt;Files_To_Update&#91;0&#93;,this-&gt;WriteToFile.binary);
	 }
	 else
	 {
	  std::cout&lt;&lt;"Downloading Executable...\n";
	  this-&gt;Doing="DOWNLOAD_EXE";
	  this-&gt;Send_Client("EXE");
	 }
	}
	else
	{
	 nBuffer&#91;Size&#93;='\0';
	 this-&gt;WriteToFile.write(nBuffer,Size);
	 this-&gt;Send_Client("OK");
	 std::cout&lt;&lt;nBuffer&lt;&lt;'\n';
	}</pre>
<br />
host:<br />
<pre class='prettyprint'>if(SendFile.is_open())
	{
	 char SendBuf&#91;Buff_Size&#93;;
	 //SendFile.seekg(std::ios::beg+DoingAt*Buff_Size);
	 SendFile.read(SendBuf,Buff_Size);
	 APP.Send_Server(SendBuf,p);
	 DoingAt++;
	 if(SendFile.eof())
	 {
	  SendFile.close();
	 }
	 std::cout&lt;&lt;SendBuf&lt;&lt;'\n';
	}
	else
	{
	 APP.Send_Server("FILE_DONE_DOWN",p);
	 DoingAt=0;
	 SendFile.close();
	 Doing="SEND_FILES";
	}</pre>
<br />
i dont know if this is right, nor if this is the right approach. i was sort of following this tutorial:<br />
<a href='http://www.codeproject.com/Articles/1922/Beginning-Winsock-Programming-Multithreaded-TCP-se' class='bbc_url' title='External link' rel='nofollow external'>http://www.codeproje...threaded-TCP-se</a><br />
<br />
but instead of using a CFile i just used a fstream.<br />
<br />
Oh, and by files i mean .png,.wav,.ogg, etc.]]></description>
		<pubDate>Sun, 26 Feb 2012 00:32:58 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620919-c-win32-winsock-sending-a-file/</guid>
	</item>
	<item>
		<title>normal vector and triangle strip</title>
		<link>http://www.gamedev.net/topic/620918-normal-vector-and-triangle-strip/</link>
		<description><![CDATA[hi everybody,<br />
<br />
i generate a map with this tuto <a href='http://www.chadvernon.com/blog/resources/directx9/terrain-generation-with-a-heightmap/' class='bbc_url' title='External link' rel='nofollow external'>http://www.chadvernon.com/blog/resources/directx9/terrain-generation-with-a-heightmap/ </a>and i generate the map with triangle strip but i want to calculate the normals on vertices but how calculate those normals?<br />
<br />
Thx!]]></description>
		<pubDate>Sat, 25 Feb 2012 23:57:23 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620918-normal-vector-and-triangle-strip/</guid>
	</item>
	<item>
		<title>condensing code</title>
		<link>http://www.gamedev.net/topic/620917-condensing-code/</link>
		<description><![CDATA[I have done research on condensing code, all I found was that I could use a List statement instead of using if statements.I am using c#.there has to be a way to condense the following code.<br />
 <br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'>for</span></span></span></span></span></span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'> (</span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'>int</span></span></span></span></span></span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'> j = 3; j &lt; 6; ++j)</span></span></span></span><br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>{</span></span></span></span><br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'>if</span></span></span></span></span></span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'> (pX &gt;= squares[j].X && pX &lt;= squares[j].Y && pY &gt;= squares[j].Width && pY &lt;= squares[j].Height)</span></span></span></span><br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>{</span></span></span></span><br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>board[1, j-3] = 1;</span></span></span></span><br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>}</span></span></span></span><br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>}</span></span></span></span><br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'>if</span></span></span></span></span></span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'> (board[1, 0] == 1 && board[1, 1] == 1 && board[1, 2] == 1)</span></span></span></span><br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>{</span></span></span></span><br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>g.DrawLine(pn, 0, 125, 200, 125);</span></span></span></span><br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>}</span></span></span></span>]]></description>
		<pubDate>Sat, 25 Feb 2012 23:49:29 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620917-condensing-code/</guid>
	</item>
	<item>
		<title>OpenGL C++ window creation</title>
		<link>http://www.gamedev.net/topic/620916-opengl-c-window-creation/</link>
		<description><![CDATA[I've used OpenGL in C before but changing to C++ has caused me some problems.<br />
<br />
In C I was able to do this in my main method:<br />
<pre class='prettyprint'>glutDisplayFunc(renderScene);</pre>
<br />
When I try to do this now in a createAndShowGUI() method in the myGUI class, I get an error like this:<br />
<pre class='prettyprint'>argument of type 'void (myGUI::)()' does not match 'void (*)()'</pre>
<br />
Does anyone know how I can avoid/work around this? Thanks!<br />
<br />
<pre class='prettyprint'>
/****************************************
* class myGUI						  *
* Desc : Handles all the GUI stuff	  *
****************************************/
class myGUI
{
  int winX;
  int winY;
    public:
 
  //Constructors
  myGUI(int argc, char** argv)
  { setXYsize(defaultXsize, defaultYsize);
    createAndShowGUI(argc, argv); }
 
  myGUI(int argc, char** argv, int x, int y)
  { setXYsize(x, y);
    createAndShowGUI(argc, argv); }
 
  //Protofunctions
  void createAndShowGUI(int, char**);
  void renderScene(void);
  void changeSize(int, int);
  void processSpecialKeys(int, int, int);
  void processNormalKeys(unsigned char, int, int);
 
  void setXYsize(int x, int y)
  { winX = x; winY = y; }
  void setXsize(int x)
  { winX = x; }
  void setYsize(int y)
  { winY = y; }
};

/****************************************
* myGui::createAndShowGUI			  *
* initializes and displays window	   *
* Args:								 *
*	   argc, argv : unmodified vars    *
*				    from main		  *
****************************************/
void myGUI::createAndShowGUI(int argc, char** argv)
{
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
  glutInitWindowPosition(100, 100);
  if (myGUI::winX != 0 && myGUI::winY != 0)
  {  glutInitWindowSize(myGUI::winX, myGUI::winY); }
  else
    { myGUI::winX = 500; myGUI::winY = 500;
	  glutInitWindowSize(myGUI::winX, myGUI::winY); }
 
  glutCreateWindow("myGUI");
 
  glutDisplayFunc(myGUI::renderScene);
  glutReshapeFunc(myGUI::changeSize);
  glutIdleFunc(myGUI::renderScene);
  glutKeyboardFunc(myGUI::processNormalKeys);
  glutSpecialFunc(myGUI::processSpecialKeys);
 
  glutMainLoop();
}

/****************************************
* MAIN function for testing			 *
****************************************/
int main(int argc, char** argv)
{
  cout &lt;&lt; "Welcome to myGUI!" &lt;&lt; endl;
 
  myGUI window (argc, argv, 1000, 1000);
}
</pre>]]></description>
		<pubDate>Sat, 25 Feb 2012 23:45:11 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620916-opengl-c-window-creation/</guid>
	</item>
	<item>
		<title>HowTo start writing games for Mac Os X using ObjC</title>
		<link>http://www.gamedev.net/topic/620915-howto-start-writing-games-for-mac-os-x-using-objc/</link>
		<description><![CDATA[Hello Everyone,<br />
<br />
I am an experienced developer in "<em class='bbc'>the serious business"</em>, and am currently trying my hand at game development.<br />
<br />
Since I am starting my journey on a Macintosh, I also started to write for that platform and with the tools available here. This means Objective C, Cocoa and OpenGL/OpenAL.<br />
<br />
I haven't found any good tutorials on that topic yet, and so I started to document my work in a step by step diary/tutorial as I am learning the ropes.<br />
<br />
Maybe that stuff is also of interest to someone here. To entries about basic OpenGL wiring and OpenAL processing are already done. More will follow as I am progressing. I am currently writing the third entry about Gamepad control via the HIDManager.<br />
<br />
Sorry, if that is the wrong place for it (it forums are quite big) or if posts like this are not welcome at all, in which case I can delete it (hopefully). But I thought, that maybe of use to someone here:<br />
<br />
Part 1: <a href='http://dragonsandbytecode.wordpress.com/2012/01/16/game-developers-diary-1-opengl-and-coco/' class='bbc_url' title='External link' rel='nofollow external'>http://dragonsandbyt...pengl-and-coco/</a><br />
Part 2: <a href='https://dragonsandbytecode.wordpress.com/2012/02/18/game-developers-diary-2-the-world-is-alive-with-the-sound-of-openal/' class='bbc_url' title='External link' rel='nofollow external'>https://dragonsandby...ound-of-openal/</a><br />
<br />
<br />
Regards,<br />
<br />
Mr. Raven]]></description>
		<pubDate>Sat, 25 Feb 2012 23:29:46 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620915-howto-start-writing-games-for-mac-os-x-using-objc/</guid>
	</item>
	<item>
		<title><![CDATA[[HLSL] How to use arrays of textures in hlsl?]]></title>
		<link>http://www.gamedev.net/topic/620914-hlsl-how-to-use-arrays-of-textures-in-hlsl/</link>
		<description><![CDATA[I'm trying to load bunch of similar textures on to the gpu, and then access them from the cpu.<br />
SSo in my .fx file I have<br />
<pre class='prettyprint'>
Texture2D letters&#91;26&#93;;
</pre>
But when it comes time to map that to the ShaderResourceVariable, which is declared like this: <br />
<pre class='prettyprint'>
ID3D10EffectShaderResourceVariable* pShaderLetters&#91;26&#93;;
</pre>
<br />
I get an error saying something like can't convert * to an array (even though both are arrays). <br />
<br />
Any suggestions?]]></description>
		<pubDate>Sat, 25 Feb 2012 23:24:25 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620914-hlsl-how-to-use-arrays-of-textures-in-hlsl/</guid>
	</item>
	<item>
		<title><![CDATA[[Solved]glCopyTexImage alternative?]]></title>
		<link>http://www.gamedev.net/topic/620913-solvedglcopyteximage-alternative/</link>
		<description><![CDATA[Hello gamedev.net!<br />
I'm making a 2D soft shadow engine and i am currently experiencing a speed problem with glCopyTexImage.<br />
<br />
Here is a quick summary of what happens during rendering:<br />
step 1: I fill the stencil buffer with shadow regions for each convexhull.<br />
step 2: I render a radial gradient while the stencil buffer is enabled so that It stencils away areas of the radial gradient that were previously covering the shadow region<br />
step 3: for each light, I render  shadow fins, that are within the radius of each light. I use the stencil buffer to make sure that the shadows are within the lights radius.<br />
step 4: I needed a way to save each lighting pass so i decided that i would copy the framebuffer as  a texture using glCopyTexImage and then I clear the framebuffer each Iteration/Pass.<br />
step 5: I iterate through all lighting passes,and render a fullscreen quad with additive blending enabled.Yielding Soft-looking edges for shadows.<br />
<br />
Here is the rendering routine as code:<br />
<pre class='prettyprint'>unsigned int K= 0;
extern Wrapper BindedClasses;
bool loaded = false;
GLuint ID&#91;50&#93;;
int RecsFilled = 0;
void Frame::OnRender(){
	//void RenderParticles(std::vector&lt;Particle&gt; & ParticleList);
	//void RenderParticles(std::vector&lt;Particle&gt; & ParticleList,float R,float G,float B);
	void RenderConvexHulls(std::vector&lt;Convex_Hull*&gt; & ActiveBodies);
	//void RenderPositionList(std::vector&lt;Particle&gt; & TempVertexList);
	void RenderShadows(std::vector&lt;Convex_Hull*&gt; & ActiveBodies,Light & CL);
	void OpenStencil();
	void CloseStencil();
	void ClearStencil();
	void ClearAlphaChannel(float TranslateX,float TranslateY);
	void RenderFins(std::vector&lt;Convex_Hull*&gt; & ActiveBodies, Light & CL);
	void CloseStencilUnlocked();

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
	glLoadIdentity();
	glScalef(Scale.X,Scale.Y,1.0f);
	glTranslatef(Translate.X,Translate.Y,0.0f);

	glEnable(GL_BLEND);
	ClearAlphaChannel(0,0);
	for(unsigned int K = 0; K &lt; LightList.size();K++){
		Light & CL = LightList&#91;K&#93;;
		OpenStencil();
		RenderShadows(ActiveBodies,CL);
		CloseStencil();
		glBlendFunc(GL_ONE, GL_ONE);
		CL.RenderLight();
		ClearStencil();
		OpenStencil();
			TextureProcedures::FillRect(0,0,10000,10000,1,1,1,1);
			CL.RenderLight();
		CloseStencilUnlocked();
		glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
		RenderFins(ActiveBodies,CL);
		ClearStencil();
	  
		//Save shadow pass as a texture
		glEnable(GL_TEXTURE_2D);
			glGenTextures(1,&ID&#91;RecsFilled&#93;);
			glBindTexture(GL_TEXTURE_2D,ID&#91;RecsFilled&#93;);
			glCopyTexImage2DEXT(GL_TEXTURE_2D,0,GL_RGBA,0,0,1920,1080,0);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
			RecsFilled++;
		glDisable(GL_TEXTURE_2D);
		//clear Framebuffer
		glClear(GL_COLOR_BUFFER_BIT);
	}
	ClearStencil();
	//Additively blends all shadow passes
	glClear(GL_COLOR_BUFFER_BIT);
	glBlendFunc(GL_ONE,GL_ONE);
	for(int K = 0; K &lt; RecsFilled;K++){
		GLuint & CID = ID&#91;K&#93;;
		TextureProcedures::RenderInvertedQuad(0,0,1920,1080,CID,false);
	}
	glDeleteTextures(RecsFilled,ID);
	RecsFilled = 0;

	RenderConvexHulls(ActiveBodies);

	glLoadIdentity();
	SDL_GL_SwapBuffers();
}
void RenderConvexHulls(std::vector&lt;Convex_Hull*&gt; & ActiveBodies){
	for(K = 0; K &lt; ActiveBodies.size();K++){
		Convex_Hull * CH = ActiveBodies&#91;K&#93;;
		CH-&gt;V_Render();
	}
}
void RenderPositionList(std::vector&lt;Particle&gt; & TempVertexList){
	glBegin(GL_LINE_LOOP);
		for(K = 0; K &lt; TempVertexList.size();K++){
			Particle & CV = TempVertexList&#91;K&#93;;
			glVertex2f(CV.Position.X,CV.Position.Y);
		}
	glEnd();
}
void RenderShadows(std::vector&lt;Convex_Hull*&gt; & ActiveBodies,Light & CL){
	for(unsigned int K = 0;K &lt; ActiveBodies.size();K++){
		Convex_Hull * CH = ActiveBodies&#91;K&#93;;
		CH-&gt;RenderShadows(CL);
	}
}
void OpenStencil(){
	glEnable(GL_STENCIL_TEST);
	glStencilFunc(GL_NEVER, 0x0, 0x0);
	glStencilOp(GL_INCR, GL_INCR, GL_INCR);
}
void CloseStencil(){
	glStencilFunc(GL_EQUAL, 0x00, 0xFF);
	glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
}
void CloseStencilUnlocked(){
	glStencilFunc(GL_NOTEQUAL, 0x1, 0x1);
	glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
}
void ClearStencil(){
	glClear(GL_STENCIL_BUFFER_BIT);
}
void ClearAlphaChannel(float TranslateX,float TranslateY){
	glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); //only write to alpha
		TextureProcedures::FillRect(TranslateX*-1,TranslateY*-1,100000,100000,0.0f,0.0f,0.0f,0.1f);
	glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); //enable color writes
}

void RenderFins(std::vector&lt;Convex_Hull*&gt; & ActiveBodies, Light & CL){
	BindedClasses.TestShader-&gt;Begin();
	for(unsigned int K = 0; K &lt; ActiveBodies.size();K++){
		ActiveBodies&#91;K&#93;-&gt;RenderShadowFin(CL);
	}
	BindedClasses.TestShader-&gt;End();
}</pre>
<br />
Basically in order for the shadow fins to render correctly i have to render each iteration separately and then use additive blending otherwise<br />
the shadow fins will be rendered with dark edges rather than faded edges.<br />
<br />
<br />
Am I using glCopyTexImage incorrectly or is it just slow?<br />
<br />
Footage: <object style="height: 390px; width: 640px"><param name="movie" value="http://youtube.com/v/6Nc1boqxyZA?version=3" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><embed src="http://youtube.com/v/6Nc1boqxyZA?version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="360"></embed></object>]]></description>
		<pubDate>Sat, 25 Feb 2012 23:23:20 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620913-solvedglcopyteximage-alternative/</guid>
	</item>
	<item>
		<title><![CDATA[[DX] Simple Cell Data From Vertex Data]]></title>
		<link>http://www.gamedev.net/topic/620912-dx-simple-cell-data-from-vertex-data/</link>
		<description><![CDATA[I've created a terrain mesh with the same size triangles. I store cell data for every 2 triangles. I have 60 vertices per row and 60 vertices per column. When creating the vertices I store every 6 vertices in a collection as a cell for collision detection later. The problem with this is that it creates 10 cells per row and not 60.<br />
<br />
<strong class='bbc'>60 vertices / 6 = 10 cells. </strong>I should have 60 cells.<br />
<br />
Since each cell shares vertices from another, how can I calculate this? How can I determine which vertices to re-use when creating the next cell?<br />
<br />
I know this should be pretty easy but I'm stumped...]]></description>
		<pubDate>Sat, 25 Feb 2012 22:56:55 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620912-dx-simple-cell-data-from-vertex-data/</guid>
	</item>
	<item>
		<title>Looking for Resources</title>
		<link>http://www.gamedev.net/topic/620911-looking-for-resources/</link>
		<description><![CDATA[As the title suggests, I'm looking for resources like 3d models, sound clips, music.  Push comes to shove, I could probably compose my own music (spending several hours per piece on garageband), but I'd really rather spend more time on the engine, if I can find other music I can use without the threat of impinging on copyright it'll be preferable.  I neither have the interest nor the equipment to generate my own sound clips, so I'd be relying on someone elses too.  I'd like to write my own game for fun and if it's decent, maybe even profit <img src='http://public.gamedev.net//public/style_emoticons/default/smile.png' class='bbc_emoticon' alt=':)' />.  I'm more than willing to write my own engine complete with graphics pipeline, physics (this'll have potential to get really advanced; incorporating Relativistic transformations), music and sound handling.  My pocketbook is about as deep as an average episode of Family Guy.  (Which is to say, not at all).<br />
<br />
The main platform I'd be using for the graphics handling and rendering is OpenGL; although I've considered writing a cannibalized version of POVRay to handle the rendering.  (This would be necessary because POVRay is designed for PhotoRealistic Images, and has realistic ray optics and can handle realistic reflection and refraction, and because PhotoRealistic images are computationally expensive to create, and I need something to render scenes interactively (Generating at least 60 frames per second); hence, I'll need to hack it).<br />
<br />
I'm probably biting off a bit more than I can chew, but I'm motivated and at the very least I'll learn enough from working on this project to be a dangerously good programmer.  (That's the goal)<br />
<br />
I'll welcome any constructive advice/criticism.]]></description>
		<pubDate>Sat, 25 Feb 2012 22:43:54 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620911-looking-for-resources/</guid>
	</item>
	<item>
		<title>was wondering , has any  one used myGui?</title>
		<link>http://www.gamedev.net/topic/620909-was-wondering-has-any-one-used-mygui/</link>
		<description><![CDATA[i came across this <br />
<br />
<a href='http://mygui.info/' class='bbc_url' title='External link' rel='nofollow external'>http://mygui.info/</a><br />
<a href='http://www.ogre3d.org/tikiwiki/MyGUI+Compiling' class='bbc_url' title='External link' rel='nofollow external'>http://www.ogre3d.org/tikiwiki/MyGUI+Compiling</a><br />
<br />
it looks like i have ogre to use  it , <br />
<br />
and for the life of me  i cant get it to work .<br />
was wondering if any one has any tips , cause i need  a tool bar in and antTweak bar does not  have enough scope for what i need]]></description>
		<pubDate>Sat, 25 Feb 2012 22:11:58 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620909-was-wondering-has-any-one-used-mygui/</guid>
	</item>
	<item>
		<title>Transformation Gizmo</title>
		<link>http://www.gamedev.net/topic/620908-transformation-gizmo/</link>
		<description><![CDATA[Hey guys,<br />
<br />
i'm trying to make a transformation gizmo for my scene editor to be able to easilly transform objects around but i've bumped into a little problem i need a little help with. I've started with the translation gizmo and i'd like that to be a series of three axis aligned billboards. I'd also like the gizmo to be a consistent size no matter distance.<br />
<br />
To do this i've created a custom shader and i'm building a custom ortho matrix especially for rendering the gizmo. While there are some problems with positioning the gizmo at the correct position the issue i'd like help with is that i'd like the axis aligned billboards to use perspection so that they'll still show parallel to the selected object's axis. I'm not quite sure how to do this, currently i'm thinking i might need to render with a perspective matrix after all and do some custom scaling.<br />
<br />
Here's the rendering code, it also includes the building of the ortho matrix and altered position:<br />
<pre class='prettyprint'>

//Create an orthographic projection matrix that can see everything the perspective camera can see.
//Since the perspective camera's view is biggest near the far clipping plane we'll have to calculate
//the orthographic matrix to include that area.
float height = tan( mainCamera-&gt;GetFieldOfView() / 2.0f ) * mainCamera-&gt;GetFarClipDistance() * 2;
float width = height * mainCamera-&gt;GetAspectRatio();
EEData::Matrix4x4 ortho = EEData::Matrix4x4::BuildOrthoMatrix( width, height, mainCamera-&gt;GetNearClipDistance(), mainCamera-&gt;GetFarClipDistance() );
renderer.ApplyMatrix( Renderer::PROJECTION, ortho );

//Since the object we're placing the gizmo on is rendered using a perspective view we'll
//need to convert it's origin to a position that results in the same position on screen if
//we're using an orthographic camera. This is needed so that the gizmo always stays at
//the selection's origin.
EEData::Matrix4x4 worldMatrix;

//Find the position on screen.
Vector3f clipPos = mainCamera-&gt;WorldSpaceToClipSpace( currentSelection-&gt;GetPosition() );
Logger::Instance().QuickPrint( "x: %f, y: %f, z: %f", clipPos.x, clipPos.y, clipPos.z );
//Fill in the new position using the screen position combined with the camera's coordinate system.
Vector3f newPos;
newPos += mainCamera-&gt;GetOwner()-&gt;GetMatrix().GetTangent() * (clipPos.x * width / 2.0f);
newPos += mainCamera-&gt;GetOwner()-&gt;GetMatrix().GetNormal() * (clipPos.y * height / 2.0f);
newPos += mainCamera-&gt;GetOwner()-&gt;GetMatrix().GetBiNormal() * mainCamera-&gt;GetOwner()-&gt;GetMatrix().GetBiNormal().DotProduct( currentSelection-&gt;GetPosition() - mainCamera-&gt;GetOwner()-&gt;GetPosition() );
worldMatrix.AsTranslation( newPos );

bool oldDepthTest = renderer.SetRenderState( Renderer::ECHORS_ZENABLE, false );
renderer.DrawMesh( transformMesh-&gt;GetId(), worldMatrix );
renderer.SetRenderState( Renderer::ECHORS_ZENABLE, oldDepthTest );

//Apply the camera's perspective matrix again for any futher rendering.
renderer.ApplyMatrix( Renderer::PROJECTION, mainCamera-&gt;GetProjectionMatrix() );
</pre>
<br />
Some extra references for the WorldSpaceToClipSpace function:<br />
<pre class='prettyprint'>

/**
* Converts a world position to clip space position.
*
* @return: The clip space position. The left side of the screen is x = -1, the right
* side of the screen is x = 1. The top side of the screen is y = 1, the bottom side of
* the screen is y = -1;
*/

Vector3f ComponentCamera::WorldSpaceToClipSpace( const Vector3f& worldPosition ) const
{
EEData::Matrix4x4 viewProj = viewMatrix * projectionMatrix;
Vector4f result = Vector4f( worldPosition.x, worldPosition.y, worldPosition.z, 1.0f );
viewProj.TransformPoint( result );
double rhw = 1.0 / result.w;
result = Vector4f( (result.x * rhw),
				  (result.y * rhw),
				  (result.z * rhw),
				  rhw );
return result.XYZ();
}


void Matrix4x4::TransformPoint( Vector4f& point ) const
{
float x = point.x * values&#91; 0 &#93; +
point.y * values&#91; 4 &#93; +
point.z * values&#91; 8 &#93; +
point.w * values&#91; 12 &#93;;
float y = point.x * values&#91; 1 &#93; +
point.y * values&#91; 5 &#93; +
point.z * values&#91; 9 &#93; +
point.w * values&#91; 13 &#93;;
float z = point.x * values&#91; 2  &#93; +
point.y * values&#91; 6  &#93; +
point.z * values&#91; 10 &#93; +
point.w * values&#91; 14 &#93;;
float w = point.x * values&#91; 3  &#93; +
point.y * values&#91; 7  &#93; +
point.z * values&#91; 11 &#93; +
point.w * values&#91; 15 &#93;;
point.x = x;
point.y = y;
point.z = z;
point.w = w;
}
</pre>
<br />
While there's probably still some errors in there i dont think they're affecting the gizmo's shape, are they? I think the error must be somewhere in my shader, so i'll post that aswell. The shader assumes a quite specific vertex format so a quick layout:<br />
gl_Vertex.xy: The AABillboard's size where x indicates width and y indicates length in direction of the aligned axis.<br />
gl_Vertex.z: Color index, used to color the quads. Colors are provided through a uniform array.<br />
gl_Normal: The axis to which this billboard should be aligned. So for example 1.0f, 0.0f, 0.0f should result in a billboard that rotates around the x axis.<br />
Texture coordinates are standard, i'll use these later to put an arrow texture or something on the billboards.<br />
<br />
The shader responsible for rendering the gizmo.<br />
<pre class='prettyprint'>
Shader GizmoTransform
{
  RenderQueue AlphaOff
  Properties
  {
	Matrix World
	Matrix ViewInverse
	Matrix Proj
	Matrix WorldViewProj
	Vec3 CameraPosition
	Vec3Array Colors
  }
  Pass p0
  {
	VertexShader
	{
	  #version 110
	  uniform mat4 World;
	  uniform mat4 ViewInverse;
	  uniform mat4 WorldViewProj;
	  uniform vec3 CameraPosition;
	  uniform vec3 Colors&#91; 3 &#93;;

	  varying vec2 texCoord;
	  varying vec3 color;
	  void main()
	  {
		vec3 origin;
		origin.x = World&#91; 3 &#93;&#91; 0 &#93;;
		origin.y = World&#91; 3 &#93;&#91; 1 &#93;;
		origin.z = World&#91; 3 &#93;&#91; 2 &#93;;

		vec3 forward = normalize( origin - CameraPosition );
		forward = normalize( vec3( ViewInverse&#91;2&#93;&#91;0&#93;, ViewInverse&#91;2&#93;&#91;1&#93;, ViewInverse&#91;2&#93;&#91;2&#93; ) );
		forward *= (vec3(1.0) - gl_Normal);
		forward = normalize( forward );

		vec3 up = gl_Normal;
		vec3 right = normalize( cross( up, forward ) );

		vec2 direction = gl_Vertex.xy;
		vec3 vRight = direction.xxx * right;
		vec3 vUp = direction.yyy * up;
		vec4 vPos = vec4( vRight + vUp, 1 );

		gl_Position = WorldViewProj * vPos;
		//gl_Position.xyz *= (gl_Position.w);
		texCoord = vec2( gl_MultiTexCoord0.x, gl_MultiTexCoord0.y );
		color = Colors&#91; int(gl_Vertex.z) &#93;;
	  }
	}
	FragmentShader
	{
	  #version 110
	  varying vec2 texCoord;
	  varying vec3 color;
	  void main()
	  {
		//gl_FragColor = vec4( texCoord.x, texCoord.y, 0, 1 );
		gl_FragColor = vec4( color, 1 );
	  }
	}
  }
}
</pre>
<br />
The glsl code can be found in the "VertexShader" and "FragmentShader" blocks, the rest is used by the engine and has no effect on the resulting shader whatsoever.<br />
And finally a picture to show what i mean:<br />
<span rel='lightbox'><img src='http://www.echo-gaming.eu/Capture.PNG' alt='Posted Image' class='bbc_img' /></span><br />
<br />
Please help me with any issues. Suggestions for a better approach to what i'm trying are welcome aswell.<br />
<br />
*Edit: Oh right, i forgot to mention my matrices are row major and are not transposed when set as uniform. This allows me to write matrix * vector rather than vector * matrix]]></description>
		<pubDate>Sat, 25 Feb 2012 21:49:18 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620908-transformation-gizmo/</guid>
	</item>
	<item>
		<title>Instancing</title>
		<link>http://www.gamedev.net/topic/620907-instancing/</link>
		<description><![CDATA[Hey.<br />
<br />
I have been following <a href='http://rastertek.com/dx11tut37.html' class='bbc_url' title='External link' rel='nofollow external'>this tutorial</a> , but while experimenting I reached a dead end. The addition I was trying to implement is a dynamic updating rotation per instance.<br />
<br />
So first, i define<br />
<br />
<pre class='prettyprint'>
// TriangleTest.h
struct InstanceType
  {
  D3DXVECTOR3 position;
  D3DXVECTOR3 rotation;
  };
</pre>
for my Instance buffer Type, which leads me to define<br />
<br />
<pre class='prettyprint'>
// vertexshader.vs
struct VertexInputType
{
float3 position : POSITION;
float4 color : COLOR;
float3 instancePosition : POSITION1;
float3 instanceRotation : POSITION2;
};
</pre>
in my vertex Shader file. Note that I have changed the usage of semantic type TEXCOORD from the tutorial, as I feel more comfortable having positions use  POSITION, as well as giving the position a <strong class='bbc'>float3 type</strong>.<br />
<br />
I set up my InputElementDescription array like this<br />
<br />
<pre class='prettyprint'>
//shaderclass.cpp
polygonLayout&#91;0&#93;.SemanticName = "POSITION";
  polygonLayout&#91;0&#93;.SemanticIndex = 0;
  polygonLayout&#91;0&#93;.Format = DXGI_FORMAT_R32G32B32_FLOAT;
  polygonLayout&#91;0&#93;.InputSlot = 0;
  polygonLayout&#91;0&#93;.AlignedByteOffset = 0;
  polygonLayout&#91;0&#93;.InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
  polygonLayout&#91;0&#93;.InstanceDataStepRate = 0;
  polygonLayout&#91;1&#93;.SemanticName = "COLOR";
  polygonLayout&#91;1&#93;.SemanticIndex = 0;
  polygonLayout&#91;1&#93;.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
  polygonLayout&#91;1&#93;.InputSlot = 0;
  polygonLayout&#91;1&#93;.AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
  polygonLayout&#91;1&#93;.InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
  polygonLayout&#91;1&#93;.InstanceDataStepRate = 0;
  polygonLayout&#91;2&#93;.SemanticName = "POSITION";
  polygonLayout&#91;2&#93;.SemanticIndex = 1;
  polygonLayout&#91;2&#93;.Format = DXGI_FORMAT_R32G32B32_FLOAT;
  polygonLayout&#91;2&#93;.InputSlot = 1;
  polygonLayout&#91;2&#93;.AlignedByteOffset = 0;
  polygonLayout&#91;2&#93;.InputSlotClass = D3D11_INPUT_PER_INSTANCE_DATA;
  polygonLayout&#91;2&#93;.InstanceDataStepRate = 1;
  polygonLayout&#91;3&#93;.SemanticName = "POSITION";
  polygonLayout&#91;3&#93;.SemanticIndex = 2;
  polygonLayout&#91;3&#93;.Format = DXGI_FORMAT_R32G32B32_FLOAT;
  polygonLayout&#91;3&#93;.InputSlot = 1;
  polygonLayout&#91;3&#93;.AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
  polygonLayout&#91;3&#93;.InputSlotClass = D3D11_INPUT_PER_INSTANCE_DATA;
  polygonLayout&#91;3&#93;.InstanceDataStepRate = 1;
</pre>
<br />
and create the input layouts.<br />
In my model class (TriangeTest), i use this to update the dynamic instance buffer ( completely created as D3D11_USAGE_DYNAMIC, with D3D11_CP_ACCESS_WRITE)<br />
<br />
<pre class='prettyprint'>
void TriangleTest::Frame(ID3D11DeviceContext* deviceContext) {
for (int i = 0; i &lt; this-&gt;i_instanceCount; i++) {
  D3DXVec3Add(&(m_instanceList&#91;i&#93;.rotation), &(m_instanceList&#91;i&#93;.rotation), &D3DXVECTOR3(1,0,0.0f));
  }
UpdateBuffers(deviceContext);
}
void TriangleTest::UpdateBuffers(ID3D11DeviceContext* deviceContext) {
HRESULT result;
D3D11_MAPPED_SUBRESOURCE mappedResource;
InstanceType* instancePtr;

result =deviceContext-&gt;Map(m_instanceBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if(FAILED(result)) throw CException("Could not remap instance buffer");
instancePtr = (InstanceType*)mappedResource.pData;
memcpy(instancePtr, (void*)m_instanceList, (sizeof(InstanceType) * i_instanceCount));
deviceContext-&gt;Unmap(m_instanceBuffer, 0);
}
</pre>
, where m_instanceList is an array of InstanceType holding all information on the position and rotation per triangle. Of course, theFrame(...) function gets called once per frame.<br />
<br />
Then I use the shader as provided and replace instancePosition with <strong class='bbc'>instanceRotation</strong>,which should make my triangles slide out to the right.<br />
<br />
<pre class='prettyprint'>
PixelInputType TextureVertexShader(VertexInputType input)
{
	PixelInputType output;
  
	// Change the position vector to be 4 units for proper matrix calculations.
	input.position.w = 1.0f;
Here is where we use the instanced position information to modify the position of each triangle we are drawing.
	// Update the position of the vertices based on the data for this particular instance.
	input.position.x += input.&#91;b&#93;instanceRotation&#91;/b&#93;.x;
	input.position.y += input.&#91;b&#93;instanceRotation&#91;/b&#93;.y;
	input.position.z += input.&#91;b&#93;instanceRotation&#91;/b&#93;.z;
	// Calculate the position of the vertex against the world, view, and projection matrices.
	output.position = mul(input.position, worldMatrix);
	output.position = mul(output.position, viewMatrix);
	output.position = mul(output.position, projectionMatrix);
  
	// Store the texture coordinates for the pixel shader.
	output.tex = input.tex;
  
	return output;
}
</pre>
<br />
But when I run it (complete without errors), the triangles stay still on the screen. Even when using <strong class='bbc'>instancePosition</strong> again. They move however, if I change the semantic type of inputPosition to TEXCOORD and update the position in the Frame procedure, but even then I get no motion from the instanceRotation.<br />
<br />
Which leads me to think, that my InputElementLayoutDescription is wrong. But how? I have tried many a combination already, but don't understand.<br />
<br />
Can anyone enlighten me with their ideas?]]></description>
		<pubDate>Sat, 25 Feb 2012 21:31:34 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620907-instancing/</guid>
	</item>
	<item>
		<title>Generated tile map arrays, seeds, populating questions</title>
		<link>http://www.gamedev.net/topic/620906-generated-tile-map-arrays-seeds-populating-questions/</link>
		<description><![CDATA[I have a working tile engine which draws tiles based off an array. It uses 3 arrays, which have some corresponding parts as far as layout and size.<br />
<br />
The first array is the tile array, which distinguishes which tile which tile from the tile image to draw like:<br />
<br />
<pre class='prettyprint'>//Array #1--map tiles
0,0,0,0,0,0,0,0,0,0,
0,9,9,9,9,9,9,9,9,0,
0,9,9,9,9,9,9,9,9,0,
0,9,9,9,9,9,9,9,9,0,
0,0,0,0,0,0,0,0,0,0</pre>
<br />
Where 0 tells it to draw a wall, 9 is a floor tile.<br />
<br />
The second array draws any objects/items on a layer above the map.<br />
<pre class='prettyprint'>//Array #2--items
0,0,0,0,0,0,0,0,0,0,
0,44,44,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,52,0,0,0,
0,0,0,0,0,0,0,0,0,0</pre>
Where 0 means draw nothing while 44 and 52 are index numbers of tiles from a sprite sheet of items to draw.<br />
<br />
While yet the 3rd array determines which tiles are passable or walkable. 1 means impassible, 0 means passable.<br />
<pre class='prettyprint'>//Array #3--physics
1,1,1,1,1,1,1,1,1,1,
1,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1,1,1,</pre>
<br />
For testing purposes I just multiplied the above arrays 50x wide and 100 times long to make a map 500x500 (250k tiles). I found that it worked best up to 500x300 (150k entries in each array).<br />
<br />
The actual physical size of having an array 150k entries long is almost 3 megabytes of text, while the actual code to draw the map is a few hundred kilobytes.<br />
<br />
<strong class='bbc'>I want to make basically roguelike maps, and am wondering how they go about generating the arrays.</strong> Like clearly I could just randomly add 150k entries, but the edges of rooms wouldn't have walls, they'd be randomly everywhere.<br />
<br />
<strong class='bbc'>Ideally I'd use some pre-defined "pattern" arrays for individual rooms, and just randomize "seeds" in the jumbo arrays </strong>which determine the index locations to add my pattern arrays.<br />
<br />
Anyone have any ideas? You can see what I'm talking about here (runs best in chrome browser) <a href='http://simplehotkey.com/Tiles/main.html' class='bbc_url' title='External link' rel='nofollow external'>http://simplehotkey.com/Tiles/main.html</a>]]></description>
		<pubDate>Sat, 25 Feb 2012 21:31:27 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620906-generated-tile-map-arrays-seeds-populating-questions/</guid>
	</item>
	<item>
		<title>How far do you go to encapsulate?</title>
		<link>http://www.gamedev.net/topic/620904-how-far-do-you-go-to-encapsulate/</link>
		<description><![CDATA[So we all know that encapsulation is a good thing in OO design. Encapsulation increases maintainability and insulates clients from changes to implementation details. But at the same time, there ain't no such thing as a free lunch: there is an upfront cost (in terms of programmer time) to writing a class in an encapsulated manner.<br />
<br />
So the question of how much you should encapsulate is, like most engineering decisions, a tradeoff: how much effort do you want to spend now to ease future development and maintenance?<br />
<br />
I want to give a concrete example here: let's say you have a class Gadget, whose purpose is to maintain, update, and mutate an internal collection of Widgets. The internal representation of this collection isn't part of Gadget's interface and is an implementation detail - so ideally you want to hide this from clients of the Gadget class. The Gadget class needs to allow its clients to somehow observe its collection of Widgets, without exposing too much of its implementation details. And ideally, only forward and backward iteration of Widgets should be exposed to clients: that way we can use vector, list, set, or any other container in the implementation without affecting client code.<br />
<br />
The simplest solution would be to just return a reference to the internal collection:<br />
<pre class="brush: plain;">
class Gadget {
	vector&lt;Widget&gt; widgets;

public:
	const vector&lt;Widget&gt;& GetWidgets() const { return widgets; }
}
</pre>
<br />
This hides very little: client code knows that you use a vector and must take a dependency on that. You also cannot change the implementation (eg. can't change a vector to a list or whatever) without modifying your interface.<br />
<br />
A second option would be to provide an index accessor like this:<br />
<br />
<pre class="brush: plain;">
class Gadget {
	vector&lt;Widget&gt; widgets;

public:
	size_t GetWidgetCount() const;
	const Widget& GetWidget(size_t i) const;
}
</pre>
<br />
This allows you to change the type of <span style='font-family: courier new,courier,monospace'>widgets</span> without affecting client code, but with a caveat: you've allowed random access to the underlying Widgets collection. In this case, you wouldn't be able to change <span style='font-family: courier new,courier,monospace'>widgets</span> to map or list or something else that doesn't support random access.<br />
<br />
A similar, but different option would be to expose <strong class='bbc'>iterators </strong>to the data:<br />
<br />
<pre class="brush: plain;">
class Gadget {
	vector&lt;widget&gt; widgets;

public:
	typedef vector&lt;Widget&gt;::const_iterator WidgetIterator;

	WidgetIterator WidgetBegin() const { return widgets.begin(); }
	WidgetIterator WidgetEnd() const { return widgets.end(); }
}
</pre>
<br />
But that's still not perfect: typedefs are are not actually separate types so it doesn't stop anyone from accidentally doing stuff like this:<br />
<br />
<span style='font-family: courier new,courier,monospace'>vector&lt;Widget&gt;::const_iterator it = gadget.WidgetBegin(); // leaky encapsulation</span><br />
<span style='font-family: courier new,courier,monospace'>size_t num = gadget.WidgetEnd() - gadget.WidgetBegin(); // only works if random access iterator</span><br />
<br />
And finally, probably the most encapsulated solution would be to actually define your own iterators:<br />
<br />
<pre class="brush: plain;">
class Gadget {
	vector&lt;Widget&gt; widgets;

public:
	struct WidgetIterator : iterator&lt;bidirectional_iterator_tag, Widget&gt; {
		// ...
	}

	WidgetIterator WidgetBegin() const { ... }
	WidgetIterator WidgetEnd() const { ... }
}
</pre>
<br />
This is the most encapsulated solution. It exposes exactly nothing more than it needs to, and allows complete freedom for you to change the internals of Gadget without affecting client code. You can even make <span style='font-family: courier new,courier,monospace'>widgets</span> an associative data structure like map (whose iterator iterates over key/value pairs), and write your custom iterator to discard the key and return only the value. But it's also the most difficult and costly to write: custom iterators aren't entirely trivial to write and the extra code to implement the custom iterator is itself a maintenance burden.<br />
<br />
So there are many ways to achieve the same thing, with varying degrees of complexity and encapsulation. So my question is: in your projects, which option do you usually choose? If you were tasked with implementing the Gadget class, would you go with the simple and cheap option, the complex but safe option, or something entirely different?<br />
<br />
edit: fix angle brackets]]></description>
		<pubDate>Sat, 25 Feb 2012 20:43:14 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620904-how-far-do-you-go-to-encapsulate/</guid>
	</item>
	<item>
		<title>msvc++ 2011 express</title>
		<link>http://www.gamedev.net/topic/620903-msvc-2011-express/</link>
		<description><![CDATA[Is there a msvc++ 2011 express version?  Did the msvc++ 2010 express version come out months after the non-express version came out?   Any reason to think there will or won't be an express version of msvc++ 2011?  Tia.<br />
<br />
Brian Wood<br />
Ebenezer Enterprises<br />
<a href='http://webEbenezer.net' class='bbc_url' title='External link' rel='nofollow external'>http://webEbenezer.net</a>]]></description>
		<pubDate>Sat, 25 Feb 2012 19:56:55 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620903-msvc-2011-express/</guid>
	</item>
	<item>
		<title>starting 2 extern programs at the same time</title>
		<link>http://www.gamedev.net/topic/620902-starting-2-extern-programs-at-the-same-time/</link>
		<description><![CDATA[My graphic engine (by using ray tracing) is pretty slow all by itself, so I want to try to split it into other programs running at the same time (= distributed rendering). I once tried "system()" function in another program to start the engine, and it worked.<br />
<br />
Unfortunately it only starts 1 program after another when I'm using this code (command in Windows):<br />
<br />
<pre class='prettyprint'>
#include &lt;iostream&gt;
#include &lt;cstdlib&gt;

using namespace std;

int main()
{
   string cmd = "MyGraphicEngine.exe";
   system(cmd.c_str());
   system(cmd.c_str());

return 0;
}
</pre>
<br />
Is there a possibility to run "MyGraphicEngine.exe" twice at the same time?<br />
<br />
lg rumpfi88]]></description>
		<pubDate>Sat, 25 Feb 2012 18:53:12 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620902-starting-2-extern-programs-at-the-same-time/</guid>
	</item>
	<item>
		<title>Setting custom Pixel Shader causes massive Performance Drop</title>
		<link>http://www.gamedev.net/topic/620901-setting-custom-pixel-shader-causes-massive-performance-drop/</link>
		<description><![CDATA[Hey all,<br />
I ran into a problem with my 2D Deferred Lighting implementation and I hope you can help me.<br />
<br />
For the 2D game I'm currently programming I decided to go with Deferred Lighting, because it is supposed to be easy to implement and fast.<br />
I used <a href='http://www.soolstyle.com/2010/02/15/2d-deferred-lightning/' class='bbc_url' title='External link' rel='nofollow external'>this tutorial</a> as a starting point and adapted it to my needs.<br />
<br />
It's all working fine and looks amazing except that I get a sever drop in framerate as soon as I enable the lighting.<br />
From about 2500 FPS (CPU-Bound/ 80% GPU load) it falls down to 1000 FPS(GPU-Bound/70% CPU load). Of course 1000 FPS is still quite high,<br />
but considering my system (and the 2500 FPS without lighting) it's actually not that much.<br />
<br />
I did some profiling and testing and it showed, that about 50% of processor time is spend in EndDraw(), this usually means, that the graphics card is overstrained and needs some time to catch up. I can't explain why that is, because after all I'm just rendering 9 lights to a 1280x720 texture and I've seen Deferred Rendering Engines with over 100 active lights.<br />
<br />
This is how my code currently looks like:<br />
<br />
Rendering:<br />
<br />
<pre class='prettyprint'>private int RenderLights(List&lt;Light&gt; _lights, ref RenderTarget2D _lightingRT)
{
	   int lightsRendered = 0;
	   Device.BlendState = BlendState.Additive;
	   Device.SetRenderTarget(_lightingRT);
	   Device.Clear(Color.Black);
	   // For every light inside the current scene
	   foreach (Light light in _lights)
	   {
			 //simple early out condition (rough not in sight or not active)
			 if ((light.Position - (Graphics.Instance.MainCamera.Position + Graphics.Instance.Resolution / 2)).Length() &gt; 	 	 	 	  
	 	 	 	 	 	 	 	   (Graphics.Instance.Resolution / 2).Length() + light.Distance || !light.IsActive)
					continue;

			 lightEffect.CurrentTechnique = lightEffect.Techniques&#91;"DeferredLight"&#93;;
			  
			 //Set light parameters
			 lightEffect.Parameters&#91;"lightStrength"&#93;.SetValue(light.Intensity);			
			 lightEffect.Parameters&#91;"lightColor"&#93;.SetValue(light.Color.ToVector3());
			 lightEffect.Parameters&#91;"lightRadius"&#93;.SetValue(light.Distance);
			 if (light is Spotlight)
			 {
					lightEffect.Parameters&#91;"isSpotlight"&#93;.SetValue(true);
					lightEffect.Parameters&#91;"angleCos"&#93;.SetValue((float)Math.Cos((light as Spotlight).Angle));
					lightEffect.Parameters&#91;"lightNormal"&#93;.SetValue( Vector2.Transform(new Vector2(1, 0),
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 		Matrix.CreateRotationZ(light.gameObject.transform.Rotation)));
			 }
			 else
					lightEffect.Parameters&#91;"isSpotlight"&#93;.SetValue(false);
			 lightEffect.Parameters&#91;"screenWidth"&#93;.SetValue(Graphics.Instance.Resolution.X);
			 lightEffect.Parameters&#91;"screenHeight"&#93;.SetValue(Graphics.Instance.Resolution.Y);
			 lightEffect.Parameters&#91;"lightPosition"&#93;.SetValue(Graphics.Instance.MainCamera.WorldToScreen(light.Position));
			 //Apply Pass
			 lightEffect.CurrentTechnique.Passes&#91;0&#93;.Apply();
			 // Draw the full screen Quad
			 Device.SetVertexBuffer(vertexBuffer);
			 Device.DrawUserPrimitives(PrimitiveType.TriangleStrip, vertices, 0, 2);
			 lightsRendered++;
	   }
	   // Deactivate alpha blending
	   Device.BlendState = BlendState.Opaque;
	   // Deactive the rander targets to resolve them
	   //Device.SetRenderTarget(null);
	   return lightsRendered;
}</pre>
<br />
And the shader:<br />
<br />
<pre class='prettyprint'>float screenWidth;
float screenHeight;
float lightStrength;
float lightRadius;
float2 lightPosition;
float3 lightColor;
bool isSpotlight;
float angleCos;
float2 lightNormal;

void VertexToPixelShader(inout float2 texCoord: TEXCOORD0, inout float4 Position : POSITION)
{
}

float4 LightShader(float2 TexCoord : TEXCOORD0) : COLOR0
{
	 float2 pixelPosition;
	 pixelPosition.x = screenWidth * TexCoord.x;
	 pixelPosition.y = screenHeight * TexCoord.y;
	 float3 shading;
	 float2 lightDirection = pixelPosition - lightPosition;

	 float distance =  length(lightPosition - pixelPosition);
	 //early out if the pixel is out of range
	 if(distance &gt; lightRadius)
	 {
   	 	 return float4(0,0,0,0);
	 }
	 float coneAttenuation = saturate(1.0f - distance / lightRadius);
	 if(isSpotlight)
	 {
	   	 float dotP = dot(lightNormal, normalize(lightDirection));
	   	 coneAttenuation *= saturate(dotP - ((1-dotP)/(1-angleCos) * angleCos));
	 }
	 shading = pow(coneAttenuation, 2) * lightColor * lightStrength;
	 return float4(shading.r, shading.g, shading.b, 1.0f);
}

technique DeferredLight
{
	pass Pass1
	{
		VertexShader = compile vs_2_0 VertexToPixelShader();
		PixelShader = compile ps_2_0 LightShader();
	}
}
</pre>
<br />
My first guess was, that the lighting shader is just too slow, so I made it to instantly return solld black. But that didn't change anything. The framerate stayed exactly the same.<br />
<br />
I discovered that as soon as I don't apply the shader's pass (comment "lightEffect.CurrentTechnique.Passes[0].Apply();" out) it runs fine, but of course without the lighting.<br />
<br />
I even did some profiling with PIX and looked at the time one light draw call takes. With my own shader, which just returns black it were about<br />
200,000 ns, with the default one 130,000 ns. That difference could explain why the framerate drops, but I don't understand, why the default shader is so much faster than just returning black.<br />
<br />
Does anyone have an idea of what might causing the heavy load for the graphics card?<br />
<br />
Thanks, bonus.2113]]></description>
		<pubDate>Sat, 25 Feb 2012 18:20:20 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620901-setting-custom-pixel-shader-causes-massive-performance-drop/</guid>
	</item>
	<item>
		<title>What Books Are Recommended</title>
		<link>http://www.gamedev.net/topic/620900-what-books-are-recommended/</link>
		<description><![CDATA[I'm looking into buying a book on Game Engine Math/Physics and another on AI. What books would you guys recommend? The two that interest me the most are <a href='http://www.amazon.com/Mathematics-Programming-Computer-Graphics-Third/dp/1435458869/ref=sr_1_1?s=books&ie=UTF8&qid=1330191819&sr=1-1' class='bbc_url' title='External link' rel='nofollow external'>Mathematics for 3D Game Programing and Computer Graphics</a> and <a href='http://www.amazon.com/Programming-Game-Example-Mat-Buckland/dp/1556220782/ref=pd_sim_b_3' class='bbc_url' title='External link' rel='nofollow external'>Programming Game AI By Example</a>. Any thoughts?<br />
<br />
I'm a senior in high school who has taken AP Physics C (calculus based physics) and up through Calculus III (but no linear algebra), if you need that information for a recommendation.<br />
<br />
Thank you in advance!<br />
<br />
<br />
Edit: I probably shouldn't limit suggestions to those two topics - any recommendation for someone developing their own game engine would be awesome.]]></description>
		<pubDate>Sat, 25 Feb 2012 18:02:18 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620900-what-books-are-recommended/</guid>
	</item>
	<item>
		<title>calculate texture coordinates</title>
		<link>http://www.gamedev.net/topic/620898-calculate-texture-coordinates/</link>
		<description><![CDATA[Hello everyone,<br />
I created a map using a heightmap and i have a question<br />
how to correctly calculate texture coordinates for a texture that will be repeated on my map?<br />
<br />
Thx!<span rel='lightbox'><img src='http://public.gamedev.net//public/style_emoticons/default/smile.png' alt='Posted Image' class='bbc_img' /></span>]]></description>
		<pubDate>Sat, 25 Feb 2012 15:57:44 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620898-calculate-texture-coordinates/</guid>
	</item>
	<item>
		<title>Mesh with relative coordinates</title>
		<link>http://www.gamedev.net/topic/620897-mesh-with-relative-coordinates/</link>
		<description><![CDATA[<span style='font-family: Verdana, sans-serif'>Hey, I'm trying to render a mesh format where the vertices aren't stored with their actual coordinates in the file.</span><br />
<span style='font-family: Verdana, sans-serif'>Here's the explanation I got:</span><br />
<br />
<pre class='prettyprint'>in a mesh, vertices are stored as coordinates relative to the proximal end of the bone that they're attached to.
so you need to walk down the bone tree, and then for each vertex, rather than plotting it, move the camera to that position and obtain the absolute position of the camera, and then move back.
now you can store that position in the TransformedVertices array.
do that for both the fixed and blended vertices
then once the array is completely filled up, blend the blended vertices towards their fixed vertices that they're influenced by.
then you can draw all the faces for that mesh, and all the vertices will be in the right spots.</pre>
<br />
<span style='font-family: Verdana, sans-serif'>Here's my attempt to do the above:</span><br />
<br />
<span style='font-family: Verdana, sans-serif'><pre class='prettyprint'>public void TransformVertices2(Skeleton Skel)
{
	float&#91;,&#93; LocalCopy;
    foreach (Bone Bne in Skel.Bones)
	{
		foreach (BoneBinding BBinding in m_BoneBindings)
		{
			if (BBinding.BoneIndex == Bne.ID)
			{
				if (BBinding.FirstVertex != -1)
				{
					int VertexCount = 0;
					if (BBinding.FirstVertex &gt; BBinding.VertexCount)
						VertexCount = BBinding.FirstVertex - BBinding.VertexCount;
					else
						VertexCount = BBinding.VertexCount - BBinding.FirstVertex;&#91;/font&#93;
                    LocalCopy = new float&#91;VertexCount, 6&#93;;
					Array.Copy(m_VertexData, BBinding.FirstVertex, LocalCopy, 0, VertexCount);&#91;/font&#93;
                    for (int i = 0; i &lt; VertexCount; i++)
					{
						//The below is from: http&#58;//msdn.microsoft.com/en-us/library/bb197901.aspx
						//Calculate the camera's current position.&#91;/font&#93;
                        //Set the direction the camera points without rotation.
						Vector3 CameraReference = Bne.GlobalTranslation;
						//Camera's position.
						Vector3 CameraPos = new Vector3(LocalCopy&#91;i, 0&#93;, LocalCopy&#91;i, 1&#93;, LocalCopy&#91;i, 2&#93;);&#91;/font&#93;
                        Matrix RotationMatrix = Matrix.CreateFromQuaternion(Bne.GlobalRotation);
						//Create a vector pointing the direction the camera is facing.
						Vector3 TransformedReference = Vector3.Transform(CameraReference, RotationMatrix);
						//Calculate the position the camera is looking at.
						Vector3 CameraLookat = CameraPos + TransformedReference;&#91;/font&#93;
                        m_TransformedVertices&#91;i&#93; = CameraLookat;
					}
				}
                if (BBinding.FirstBlendedVert != -1)
				{
					int BlendedVertexCount = 0;
					if (BBinding.FirstBlendedVert &gt; BBinding.BlendedVertexCount)
						BlendedVertexCount = BBinding.FirstBlendedVert - BBinding.BlendedVertexCount;
					else
						BlendedVertexCount = BBinding.BlendedVertexCount - BBinding.FirstBlendedVert;&#91;/font&#93;
					LocalCopy = new float&#91;BlendedVertexCount, 6&#93;;
					Array.Copy(m_VertexData, BBinding.FirstBlendedVert, LocalCopy, 0, BlendedVertexCount);&#91;/font&#93;
					for (int j = 0; j &lt; BlendedVertexCount; j++)
					{
						//The below is from: http&#58;//msdn.microsoft.com/en-us/library/bb197901.aspx
						//Calculate the camera's current position.&#91;/font&#93;
						//Set the direction the camera points without rotation.
						Vector3 CameraReference = Bne.GlobalTranslation;
						//Camera's position.
						Vector3 CameraPos = new Vector3(LocalCopy&#91;j, 0&#93;, LocalCopy&#91;j, 1&#93;, LocalCopy&#91;j, 2&#93;);&#91;/font&#93;
						Matrix RotationMatrix = Matrix.CreateFromQuaternion(Bne.GlobalRotation);
						//Create a vector pointing the direction the camera is facing.
						Vector3 TransformedReference = Vector3.Transform(CameraReference, RotationMatrix);
						//Calculate the position the camera is looking at.
						Vector3 CameraLookat = CameraPos + TransformedReference;&#91;/font&#93;
						m_TransformedVertices&#91;j&#93; = CameraLookat;
					}
				}
			}
		}
	}
}</pre></span><br />
<br />
<br />
<br />
<br />
<br />
<span style='font-family: Verdana, sans-serif'>Problem is, this doesn't work! <span rel='lightbox'><img src='http://public.gamedev.net//public/style_emoticons/default/sad.png' alt='Posted Image' class='bbc_img' /></span></span><br />
<span style='font-family: Verdana, sans-serif'>Can someone please explain how to implement this algorithm in XNA?</span><br />
<br />
<br />
<br />
<br />
<span style='font-family: Verdana, sans-serif'>Here's my rendering code:</span><br />
<br />
<br />
<br />
<br />
<br />
<span style='font-family: Verdana, sans-serif'><pre class='prettyprint'>private void mWinForm_OnFrameRender(GraphicsDevice pDevice)
{
	/*m_SBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.BackToFront, SaveStateMode.SaveState);

	m_SBatch.Draw(m_BackgroundTex, new Microsoft.Xna.Framework.Rectangle(0, 0, m_BackgroundTex.Width,
		m_BackgroundTex.Height), Microsoft.Xna.Framework.Graphics.Color.White);

	m_SBatch.End();*/

	Device.RenderState.DepthBufferEnable = true;
	Device.RenderState.DepthBufferWriteEnable = true;
	Device.RenderState.AlphaBlendEnable = false;

	// Configure effect
	mSimpleEffect.World = this.mWorldMat;
	mSimpleEffect.View = this.mViewMat;
	mSimpleEffect.Projection = this.mProjectionMat;

	if (m_Tex != null)
	{
		mSimpleEffect.Texture = m_Tex;
		mSimpleEffect.TextureEnabled = true;

		//Disable lights in an attempt to render bodies...
		//mSimpleEffect.EnableDefaultLighting();
	}

	mSimpleEffect.CommitChanges();

	// Draw
	mSimpleEffect.Begin();
	mSimpleEffect.Techniques&#91;0&#93;.Passes&#91;0&#93;.Begin();

	if (m_NormVerticies != null)
	{
		if (m_LoadComplete)
		{
			if (m_CurrentMesh.IsBodyMesh)
			{
				//m_MatrixStack.Push(mSimpleEffect.World);
				//glLoadIdentity();
				//mSimpleEffect.View = Matrix.Identity;

				m_CurrentMesh.TransformVertices2(m_Skeleton);

				//mSimpleEffect.View = m_MatrixStack.Pop();

				m_CurrentMesh.BlendVertices2();
			}

			foreach (Face Fce in m_CurrentMesh.Faces)
			{
				VertexPositionNormalTexture&#91;&#93; Vertex = new VertexPositionNormalTexture&#91;3&#93;;
				Vertex&#91;0&#93; = m_NormVerticies&#91;Fce.AVertexIndex&#93;;
				Vertex&#91;1&#93; = m_NormVerticies&#91;Fce.BVertexIndex&#93;;
				Vertex&#91;2&#93; = m_NormVerticies&#91;Fce.CVertexIndex&#93;;

				Vertex&#91;0&#93;.TextureCoordinate = m_NormVerticies&#91;Fce.AVertexIndex&#93;.TextureCoordinate;
				Vertex&#91;1&#93;.TextureCoordinate = m_NormVerticies&#91;Fce.BVertexIndex&#93;.TextureCoordinate;
				Vertex&#91;2&#93;.TextureCoordinate = m_NormVerticies&#91;Fce.CVertexIndex&#93;.TextureCoordinate;

				pDevice.DrawUserPrimitives&lt;VertexPositionNormalTexture&gt;(PrimitiveType.TriangleList,
					Vertex, 0, 1);
			}
		}
	}

	mSimpleEffect.Techniques&#91;0&#93;.Passes&#91;0&#93;.End();
	mSimpleEffect.End();

}</pre></span>]]></description>
		<pubDate>Sat, 25 Feb 2012 15:33:21 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620897-mesh-with-relative-coordinates/</guid>
	</item>
	<item>
		<title>Best threading model for DX10 multiple monitor non full screen app?</title>
		<link>http://www.gamedev.net/topic/620896-best-threading-model-for-dx10-multiple-monitor-non-full-screen-app/</link>
		<description><![CDATA[I have currently porting a DX9 based XP application to DX10 on Windows 7.<br />
<br />
This application displays scrolling data in multiple windows on multiple monitors (up to 4 monitors, with 3 windows per monitor). Each present must by synced to the VSYNC of the monitor as it is important that we have no tearing. It is not a full screen DirectX app.<br />
<br />
In the current architecture (XP with DirectX 9) a different DirectX 9 device was created for each monitor and each monitor had its own rendering thread (not the main thread). A separate swap chain was created for each window. Each rendering thread would render to each window in turn, and then present to each window in turn, i.e. RenderA, RenderB, RenderC, PresentA, PresentB, PresentC. This worked well in XP with DirectX9.<br />
<br />
The problem is that this arrangement does not seem to work well in Windows 7 with DirectX 10. I have ported the Render Code to DX10, and am using DXGI swap chains.I now need help choosing the threading model.<br />
<br />
It seems that DXGI swap chains work a lot differently than DX9 swap chains. For a start, in order to present synced to the VSYNC, It seems that  I MUST enable the Desktop Windows Manager (i.e. Aero). If I do not do this, only one window on the monitor updates per monitor refresh (a different window each refresh). This means that for the 3 windows WindowA, WindowB, WindowC, you will get WindowA updated on frame1, WindowB on frame 2, WindowC on frame 3, and Window A on frame 4. This effectively gives a refresh rate of 20Hz for each window on a 60Hz monitor - yuck!<br />
<br />
Enabling DWM has caused some performance problems, as now each window's content is now blitted to a DWM surface each frame. The real problem that I am running into is that the scrolling of each window's content is no longer smooth using the existing threading model of one rendering thread per monitor. I experimented with reducing the number of monitors, and got good results only when I had one monitor (i.e. only one rendering thread)<br />
<br />
What is the best way to render multiple windows synced to the VSYNC to multiple monitors with DirectX10?<br />
Thanks,<br />
Clive]]></description>
		<pubDate>Sat, 25 Feb 2012 14:52:17 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620896-best-threading-model-for-dx10-multiple-monitor-non-full-screen-app/</guid>
	</item>
	<item>
		<title>Painting pixels on 3D object</title>
		<link>http://www.gamedev.net/topic/620895-painting-pixels-on-3d-object/</link>
		<description><![CDATA[I already use glReadPixels to get pixel information on a certain 3D object on screen. I'd like to ask if, in order to paint pixels on such object (so that, to be more clear, I can use the mouse as a brush), I'd use glDrawPixels and if there are better solution than this.]]></description>
		<pubDate>Sat, 25 Feb 2012 13:39:17 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620895-painting-pixels-on-3d-object/</guid>
	</item>
	<item>
		<title>Mesh itersection for collisions</title>
		<link>http://www.gamedev.net/topic/620892-mesh-itersection-for-collisions/</link>
		<description><![CDATA[I switched from openGL to XNA and i think it is really awesome, but i stuck on collision detection. I know that I can use built in BoundingSphere or BoundingBox ( I am not sure but i think it's OBB). But since I want to play with car games (not necessary extremely physicaly correct) i want to have better collision detection. In openGL I did collision with terain by modification of class that reads model from .3ds, but there I assumed that I will have perfect "chessboard" from top view, i divided the squares until i find the one with my model, find which triangle to test and then get height from plane equation <img src='http://public.gamedev.net//public/style_emoticons/default/smile.png' class='bbc_emoticon' alt=':)' /> It worked like a charm, but here I don't have a cluee how to reimplement it with xna classes <img src='http://public.gamedev.net//public/style_emoticons/default/sad.png' class='bbc_emoticon' alt=':(' /> And I would like to go step further and do better collision detection <img src='http://public.gamedev.net//public/style_emoticons/default/smile.png' class='bbc_emoticon' alt=':)' /> How can I get the triangle data from Model class? Or maybe someone knows how (i don't need the code, only basic idea, I catch on quickly <img src='http://public.gamedev.net//public/style_emoticons/default/smile.png' class='bbc_emoticon' alt=':)' /> ) or where I can find mesh volume collision explanation (like with proxy model)? <img src='http://public.gamedev.net//public/style_emoticons/default/smile.png' class='bbc_emoticon' alt=':)' /> Thank You in advance <img src='http://public.gamedev.net//public/style_emoticons/default/smile.png' class='bbc_emoticon' alt=':)' />]]></description>
		<pubDate>Sat, 25 Feb 2012 13:06:29 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620892-mesh-itersection-for-collisions/</guid>
	</item>
	<item>
		<title>rotate fbo</title>
		<link>http://www.gamedev.net/topic/620891-rotate-fbo/</link>
		<description><![CDATA[Hi<br />
now I do:<br />
        glMatrixMode(GL_PROJECTION);<br />
        glPushMatrix();<br />
        glLoadIdentity();<br />
        glFrustum(-0.7, 0.7, -0.7, 0.7, 1, 5000);<br />
        glMatrixMode(GL_MODELVIEW);<br />
        glPushMatrix();<br />
        glLoadIdentity();<br />
        glRotatef(GetDataf(psi), 0, 1, 0);//heading<br />
        glRotatef(GetDataf(theta), -1, 0, 0);//pitch<br />
        glRotatef(GetDataf(phi), 0, 0, 1);//roll<br />
        glTranslatef(-GetDatad(locX), -GetDatad(locY), -GetDatad(locZ));//<br />
positions<br />
        drawMesh();<br />
so far all is ok<br />
now I want to rotate the mesh 90' to look from above on it. I've tried<br />
without success:<br />
//      glRotatef(90, -1, 0, 0); // look down<br />
//      glTranslatef(0.0f, 0.0f, 128.0f);//128x128 mesh<br />
//      gluLookAt(0,0,GetDatad(locZ)+2000,0,0,-256,0,1,0);<br />
How to rotate and maybe zoom out?<br />
Many thanks<br />
Michael]]></description>
		<pubDate>Sat, 25 Feb 2012 13:01:22 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620891-rotate-fbo/</guid>
	</item>
	<item>
		<title>2D mesh rotation</title>
		<link>http://www.gamedev.net/topic/620890-2d-mesh-rotation/</link>
		<description><![CDATA[Hi<br />
I do:<br />
for x &lt; 128<br />
	  for z &lt; 128<br />
returns a height map (y).<br />
now I'd want to rotate (opengl glpoints glvertex2f) that with a given angle around the centre.<br />
Any ideas/help?<br />
Many thanks<br />
Michael]]></description>
		<pubDate>Sat, 25 Feb 2012 12:49:42 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620890-2d-mesh-rotation/</guid>
	</item>
	<item>
		<title>Starting from the ground up.</title>
		<link>http://www.gamedev.net/topic/620888-starting-from-the-ground-up/</link>
		<description><![CDATA[I wanted to start crafting a 16bit platformer, hoping it'd be as good as any place to start (that and the nostalgic value). That being said, I have no idea what I'm doing. I was wondering if any good and decently priced game engines would help me on this. If I have to learn code and I should, what code would be good to pick up for this.<br />
<br />
Also, I was hoping if anyone knew any good..<ul class='bbc'><li>Sprite Creation Programs<br /></li><li>A simple 8bit music program<br /></li><li>A wing and a prayer</li></ul>
It's a lot to ask, I know. While I could just google this, I wanted your guys input. Thank you for anything and yes I know, this gonna suck.]]></description>
		<pubDate>Sat, 25 Feb 2012 11:43:57 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620888-starting-from-the-ground-up/</guid>
	</item>
	<item>
		<title>Triangulation Reduction A* ( TRA* )</title>
		<link>http://www.gamedev.net/topic/620887-triangulation-reduction-a-tra/</link>
		<description><![CDATA[Hi everyone,<br />
<br />
I was wondering where can I find the code or the pseudo-code for the TRA* algorithm.<br />
<br />
I looked at the Demyen's papers and read everything regarding that subject but it isn't enough for me?<br />
<br />
<br />
Any ideas?]]></description>
		<pubDate>Sat, 25 Feb 2012 10:35:04 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620887-triangulation-reduction-a-tra/</guid>
	</item>
	<item>
		<title>PropertyGrid / PropertySheet</title>
		<link>http://www.gamedev.net/topic/620886-propertygrid-propertysheet/</link>
		<description><![CDATA[Hi everyone,<br />
<br />
I'm currently making a scene editor with c++ and winapi.<br />
<br />
I'd like to make a property grid / sheet in native c++ like in c# (or like in the Visual Studio, the Property Window). I've searched by google and I've found that the PROPSHEETHEADER and the PROPSHEETPAGE are the only (?) way.<br />
I have a main window and I have a groupbox in it. I'd like to put my property sheet into that box (I know the handle of the gb). Here is my first try:<br />
<pre class='prettyprint'>
void PropertyGrid::CreateDummy(const HWND& _parent)
{
  PROPSHEETHEADER propSheet;
  PROPSHEETPAGE pages&#91;1&#93;;
  HINSTANCE hInstance = (HINSTANCE)GetWindowLong(_parent, GWL_HINSTANCE);

  memset(&propSheet, 0, sizeof(PROPSHEETHEADER));
  memset(pages, 0, sizeof(pages));

  pages&#91;0&#93;.dwSize = sizeof(PROPSHEETPAGE);
  pages&#91;0&#93;.dwFlags = PSP_DEFAULT;
  pages&#91;0&#93;.hInstance = hInstance;
  pages&#91;0&#93;.pszTitle = "page 1";

  propSheet.dwSize = sizeof(PROPSHEETHEADER);
  propSheet.dwFlags = PSH_PROPSHEETPAGE;
  propSheet.hwndParent = _parent;
  propSheet.hInstance = hInstance;
  propSheet.nPages = sizeof(pages) / sizeof(PROPSHEETPAGE);
  propSheet.ppsp = (LPCPROPSHEETPAGE)pages;

  int ret = PropertySheet(&propSheet);
}
</pre>
I want to see an empty property grid, but I can't see anyting.<br />
<br />
I hope you could help me,<br />
thanks]]></description>
		<pubDate>Sat, 25 Feb 2012 08:35:46 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620886-propertygrid-propertysheet/</guid>
	</item>
	<item>
		<title><![CDATA['Mixing' Shaders and code to shader organization]]></title>
		<link>http://www.gamedev.net/topic/620885-mixing-shaders-and-code-to-shader-organization/</link>
		<description><![CDATA[I've been exposed to shaders for a short stint, and have been exposed to a number of lighting techniques.<br />
I have a couple of questions regarding shaders:<br />
1) What are some kinds of techniques that can be integrated into existing shader techniques?<br />
Example: I have a basic Per-pixel lighting shader up. Can I integrate shadows into the lighting equation with minimal effort?<br />
How about deferred shading, HDR lighting, etc? Can all these be combined into one shader that is used for objects that need to be<br />
lit up? Or are there some kinds of techniques that if 'you choose technique A, you forgo technique B'? (Would love it if you can give an<br />
example here)<br />
<br />
2) How costly can setting uniform variables per frame be? I'm thinking of supplying some constant variables(example: WorldViewProjectionMatrix) to all shaders so there's no need to write extra code to constantly supply that uniform variable.]]></description>
		<pubDate>Sat, 25 Feb 2012 08:14:34 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620885-mixing-shaders-and-code-to-shader-organization/</guid>
	</item>
	<item>
		<title>Shadow moves with camera</title>
		<link>http://www.gamedev.net/topic/620883-shadow-moves-with-camera/</link>
		<description><![CDATA[Hi,<br />
<br />
I am trying to implement some basic shadow mapping and using this site <a href='http://www.flashbang.se/archives/87/comment-page-1#comment-791' class='bbc_url' title='External link' rel='nofollow external'>http://www.flashbang.se/archives/87</a><br />
<br />
I noticed with this demo that the shadow moves/rotates with when the camera/viewport move/rotates. How do i stop it doing this. Sorry i am still trying to understand the matrix stuff in that demo.<br />
<br />
Thanks.]]></description>
		<pubDate>Sat, 25 Feb 2012 07:33:08 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620883-shadow-moves-with-camera/</guid>
	</item>
	<item>
		<title>if clip will interrupt the pixel shader?</title>
		<link>http://www.gamedev.net/topic/620882-if-clip-will-interrupt-the-pixel-shader/</link>
		<description><![CDATA[<strong class='bbc'>	clip (DirectX HLSL)</strong><br />
<br />
Discards the current pixel if the specified value is less than zero.										clip(<em class='bbc'>x</em>)			<br />
<br />
Use this function to simulate clipping planes if each component of the <em class='bbc'>x</em> parameter represents the distance from a plane.<br />
<br />
<br />
==========================================<br />
if x is less than zero, the following code will be interrupted???<span rel='lightbox'><img src='http://public.gamedev.net//public/style_emoticons/default/wub.png' alt='Posted Image' class='bbc_img' /></span>]]></description>
		<pubDate>Sat, 25 Feb 2012 06:26:59 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620882-if-clip-will-interrupt-the-pixel-shader/</guid>
	</item>
	<item>
		<title>What engine/language would you recommend?</title>
		<link>http://www.gamedev.net/topic/620881-what-enginelanguage-would-you-recommend/</link>
		<description><![CDATA[I am looking to create a genre-spanning title that is, at its center, a visual novel, but that incorporates puzzle, skill building, search-and-find, and shop simulation elements as well.<br />
<br />
I'll elaborate on each individual element to give a better idea of what I have in mind.<br />
<br />
<strong class='bbc'>Visual Novel</strong>: I would need to be able to incorporate all of the standard features of a visual novel. The only potential problem I foresee with this are the story-affecting choices, but this is absolutely imperative.<br />
<br />
<strong class='bbc'>Search-and-Find</strong>: I would like to include several different locations that vary with the in-game seasons and contain fairly mild animations (plants blowing in the wind, etc.). Within these locations, players will be foraging for herbs -- among other things -- and it needs to be possible to vary the likelihood of certain flora and fauna being available during any given visit. For example, a rare species of butterfly that will only seldom fly onto the scene. Also, I would like for player's to be able to interact with the locations with various tools from their inventory.<br />
<br />
<strong class='bbc'>Shop Simulation</strong>: This one's pretty straightforward.<br />
<br />
<strong class='bbc'>Puzzle</strong>: This one's a bit complicated. Imagine, for example, that a player was attempting to prepare a potion that would induce a Romeo and Juliet-esque death-like state. The may be able to accomplish this by combining an ingredient that prevents insomnia with one that stops the heart, counteracting the latter by tossing in a drop of Draught of Immortality or some such. I'll need to incorporate some sort of algorithm for how each ingredient reacts, alone and with others.<br />
<br />
<strong class='bbc'>Skill Building</strong>: Again, this one's self-explanatory.<br />
<br />
<strong class='bbc'>Potion Making/Ingredient Preparation</strong>: I imagine players being able to stir their bubbling brews with actual movements of the mouse, with both direction and speed variation being accounted for. Similarly, I would like for players to be able to slice/chop/smash/etc. their various ingredients.<br />
<br />
Note: For those who don't know, visual novels are a sort of interactive fiction. The general setup is one ore more 2D characters with interchangeable expressions atop varying backgrounds and a textbox containing the story at the bottom of the screen. Usually, important scenes contain actual illustrations. There is background music throughout, as well as sound effects and, often, voice acting. Mild animations are not uncommon. The interactivity comes in the form of decisions that must be made throughout that story which effect its direction and outcome.]]></description>
		<pubDate>Sat, 25 Feb 2012 05:41:08 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620881-what-enginelanguage-would-you-recommend/</guid>
	</item>
	<item>
		<title>tic tac toe</title>
		<link>http://www.gamedev.net/topic/620880-tic-tac-toe/</link>
		<description><![CDATA[well thanks to all who have helped me with this project,I am happy to announce that I have finished coding the "X" moves and the player gui.I have also found out that there is alot of work to develop even the simplest game.]]></description>
		<pubDate>Sat, 25 Feb 2012 05:12:51 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620880-tic-tac-toe/</guid>
	</item>
	<item>
		<title><![CDATA[[SDL] Super slow framerate on Windows 7, GLEW shaders unavailable]]></title>
		<link>http://www.gamedev.net/topic/620879-sdl-super-slow-framerate-on-windows-7-glew-shaders-unavailable/</link>
		<description><![CDATA[Hello!<br />
<br />
I've been working on a project off and on in SDL for a number of months now, and I've had an issue from the start that I recently had some time to try and debug. I've been developing on Windows XP until this past week, so it was not really an issue until now.<br />
<br />
Basically, my SDL bases game works perfectly fine on any Windows XP machine (ie. normal frame rate, shaders work no problem), but I initially noticed that if I ran the executable on Windows 7, the frame rate would only be 10-15 for no reason (on super high-end machines, ie. Phenom II X6 / 5970) but this was strictly a Windows 7 issue as indicated by testing on several different machines. Upon further investigation I realized that if I run the game from within Visual Studio 2008 on a Windows 7 machine it works perfectly (ie. 7000+ FPS w/o vsync), but as soon as I ran it from the executable instead, the frame rate would once again be between 10 and 15, and if shaders were being used via GLEW, the program would simply exit because GLEW 2.0 was unavailable.<br />
<br />
tldr; SDL OpenGL game, works fine on XP, on Win7 works fine in VS2008 but EXE limited to 10 fps and shaders wont work<br />
<br />
Honestly not sure what the issue could possibly be and has been baffling me for some time. If anyone has any suggestions or input, it would be greatly appreciated. It almost seems like SDL is somehow switching to software mode or some limited version of OpenGL. Also worth mentioning that the only things being rendered is some text (generated and rendered via lists) and a very simple skybox with 1024x1024 textures for each side.<br />
<br />
My game is using SDLmain and a number of libraries, including:<br />
SDL<br />
SDL_ttf<br />
GLEW<br />
FreeImage<br />
Qt<br />
FMOD Ex<br />
FBX SDK<br />
Bullet Physics<br />
<br />
Thanks for reading. Some code, if it helps any:<br />
<br />
Main.cpp:<br />
<pre class='prettyprint'>
#include "Game.h"
int main(int argc, char * argv&#91;&#93;) {
	 Game * game = new Game();
	 if(!game-&gt;init()) { return -1; }
	 game-&gt;run();
	 delete game;
	 return 0;
}
</pre>
<br />
OpenGL Setup:<br />
<pre class='prettyprint'>
bool Game::init() {
	 if(m_initialized) { return false; }
	 settings-&gt;load();
	 if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK) == -1) { return false; }
	 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
	 SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, settings-&gt;verticalSync ? 1 : 0);
	 m_graphics = SDL_SetVideoMode(settings-&gt;windowWidth, settings-&gt;windowHeight, 0, SDL_OPENGL | (settings-&gt;fullScreen ?	 SDL_FULLSCREEN : 0));
	 SDL_WM_SetCaption("Game", NULL);
	 QString iconPath;
	 iconPath.append(QString("%1/Icons/Block.bmp").arg(settings-&gt;dataDirectoryName));
	 QByteArray iconPathBytes = iconPath.toLocal8Bit();
	 m_icon = SDL_LoadBMP(iconPathBytes.data());
	 SDL_WM_SetIcon(m_icon, NULL);
	 glShadeModel(GL_SMOOTH);
	 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	 glClearDepth(1.0f);
	 glEnable(GL_DEPTH_TEST);
	 glEnable(GL_TEXTURE_2D);
	 glEnable(GL_BLEND);
	 glDepthFunc(GL_LEQUAL);
	 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
	 glMatrixMode(GL_MODELVIEW);
	 glViewport(0, 0, settings-&gt;windowWidth, settings-&gt;windowHeight);
	 if(glewInit() != GLEW_OK) { return false; }
	 if(!GLEW_VERSION_2_0) { return false; }

	 etc.
</pre>
<br />
Game Loop:<br />
<pre class='prettyprint'>
void Game::run() {
if(!m_initialized) { return; }
m_running = true;
SDL_Event event;
static unsigned int lastTime = SDL_GetTicks();
unsigned int currentTime = SDL_GetTicks();
do {
  if(SDL_PollEvent(&event)) {
   switch(event.type) {
	case SDL_KEYDOWN:
	 if(!console-&gt;isActive()) {
	  menu-&gt;handleInput(event);
	 }
	 if(!menu-&gt;isActive()) {
	  console-&gt;handleInput(event);
	 }
	 break;
	case SDL_MOUSEMOTION:
	 if(!console-&gt;isActive() &&
		!menu-&gt;isActive() &&
		SDL_GetAppState() & SDL_APPMOUSEFOCUS &&
		SDL_GetAppState() & SDL_APPINPUTFOCUS &&
		SDL_GetAppState() & SDL_APPACTIVE) {
	  camera-&gt;handleInput(event);
	 }
	 break;
	case SDL_QUIT:
	 m_running = false;
	 break;
	default:
	 break;
   }
  }
  if(m_running) {
   currentTime = SDL_GetTicks();
   update(currentTime - lastTime);
   draw();
   lastTime = currentTime;
  }
} while(m_running);
}
</pre>]]></description>
		<pubDate>Sat, 25 Feb 2012 04:38:51 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620879-sdl-super-slow-framerate-on-windows-7-glew-shaders-unavailable/</guid>
	</item>
	<item>
		<title>OOP Design/help (reworking some code)</title>
		<link>http://www.gamedev.net/topic/620878-oop-designhelp-reworking-some-code/</link>
		<description><![CDATA[Language: C#<br />
API: XNA<br />
<br />
Hi,  I have a game that i worked on a while back that I wish to re-write/fix up.  The code for it is ugly and definitely has major design flaws.  One of the major flaws I found is my use of declaring objects as static.  Here's an example of what I'm talking about<br />
<br />
Original design<br />
GameplayScreen snippet<br />
<pre class='prettyprint'>
 class GameplayScreen : GameScreen
    {
	    #region Fields

	    ContentManager content;
	    SpriteFont gameFont;
	    
	    Random random = new Random();

	    //Code I've added
	    public Block player;
	    BlockManager blockManager = new BlockManager();
	    public static ItemManager itemManager;
	    public static Texture2D redBlock;
	    public static Texture2D yellowBlock;
	    public static Texture2D greenBlock;
	    public static Texture2D plusOrb;
	    public static Texture2D minusOrb;
	    public static Texture2D growBiggerArrow;
	    public static Texture2D growSmallerArrow;
	    public static Texture2D invincibility;
	    public static SpriteFont itemFont;
	    public static SoundEffect death;
	    public static SoundEffect spawn;
	    public static SoundEffect plusSound;
	    public static SoundEffect minusSound;
	    public static SoundEffect shrinkSound;
	    public static SoundEffect growSound;
	    public static SoundEffect invincibilitySound;
	    public static bool isPlayerAlive = true;
	    public static int score = 0;
</pre>
GrowBiggerArrow Snippet<br />
<pre class='prettyprint'>
public override void Update(GameTime gameTime)
	    {
		    /*if (this.HitBounds.Intersects(GameplayScreen.player.HitBounds))
		    {
			    //do specific item powerup. in this case it is +size
			    if (GameplayScreen.player.Size.X &lt; GameplayScreen.player.MaxSize.X || GameplayScreen.player.Size.Y &lt; GameplayScreen.player.MaxSize.Y)
				    GameplayScreen.player.Size += new Vector2(16,16);
			    GameplayScreen.itemManager.RemoveItem(this);
		    }*/

		    if (0 == triggered)
		    {
			    itemTimer += gameTime.ElapsedGameTime;
			    if (itemTimer &gt; TimeSpan.FromSeconds(3))
			    {
				    GameplayScreen.itemManager.RemoveItem(this);
				    return;
			    }
			    if (this.HitBounds.Intersects(GameplayScreen.player.HitBounds))
			    {
				    //do specific item powerup. in this case it is grow bigger
				    //start timer
				    if (OptionsMenuScreen.sound)
					    GameplayScreen.growSound.Play();
				    if (GameplayScreen.player.Size.X &lt;= GameplayScreen.player.MaxSize.X || GameplayScreen.player.Size.Y &lt;= GameplayScreen.player.MaxSize.Y)
				    {
					    GameplayScreen.player.Size += new Vector2(16, 16);
					    text = "You grew!";
				    }
				    else
					    text = "You're too big to grow!";
				    triggered = 1;

				    //GameplayScreen.itemManager.RemoveItem(this);
			    }
		    }
		    //otherwise we picked it up at some point so check the timer and see if its time to take away the buff
		    else
		    {
			    displayTimer += gameTime.ElapsedGameTime;
			    if (displayTimer &gt; TimeSpan.FromSeconds(3))
			    {
				    GameplayScreen.itemManager.RemoveItem(this);

				    displayTimer = TimeSpan.Zero;
			    }
		    }

	    }
</pre>
<br />
As you can see, I have statics running all over the place.  I want to keep my Update function to only take gametime as a parameter, but I need a way of getting rid of that call to access the player via the gamescreen class.  I'm not sure how to implement this but these are the ideas I came up with.<br />
<br />
Idea 1: On a collision, call the Grow method.  I would have to take the collision detection out of the grow bigger class and move it to the gameplay screen (maybe? or is there a better way?)<br />
<br />
Idea fix for grow bigger class<br />
<pre class='prettyprint'>
//All game objects (players, cars, items) are derived from GameObject
//gameObjectType would be an enum with all the different object types.  (This could get extremely large and would
//have to be maintained manually (Haven't figured out how to do this part automatically)
//By taking these two parameters, I would be able to make all the public statics in gameplayscreen into private members
void Grow(GameObject obj, enum gameObjectType)
{
switch (gameObjectType)
{
case: Player:
//Handle player specific growth
break;
case: Vehicle
//Handle vehicle specific growth
break
}
}
</pre>
<br />
Idea 2: Similar to idea 1 except I would have the grow bigger item fire off an event on the object that it collided with.  The object that it collided with would then get the onCollide event and it would have the onCollide event handled by itself.<br />
Example: GrowBiggerItem collides with player.  GrowBiggerItem fires off the collide event to player.  Player gets the event and has a method "onCollide" and handles the collide event.<br />
<br />
<br />
These are the ideas that I came up with to get rid of the public statics and hopefully provide a better OOP design to my classes.  Any feedback on what I can do to fix this would be appreciated. <br />
<br />
Here is the full code for the growbigger item.  Please point out any issues you see that I can improve on, I'm still trying to grasp OOP design in my code.  Thank you.]]></description>
		<pubDate>Sat, 25 Feb 2012 02:31:59 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620878-oop-designhelp-reworking-some-code/</guid>
	</item>
	<item>
		<title>Game Engine Camera</title>
		<link>http://www.gamedev.net/topic/620877-game-engine-camera/</link>
		<description><![CDATA[Hi,<br />
<br />
I am just getting into game designing and I wanted to know if you can program game engine camera to send what the camera renders to a hardware like a 3D encoder/decoder? For example you want to turn the game engine camera into a broadcasting camera streaming real-time.]]></description>
		<pubDate>Sat, 25 Feb 2012 02:02:59 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620877-game-engine-camera/</guid>
	</item>
	<item>
		<title>Xna Z-order precision</title>
		<link>http://www.gamedev.net/topic/620875-xna-z-order-precision/</link>
		<description><![CDATA[Hi,<br />
<br />
I have a game management system that handles distance culling, so I use a custom frustum to cull objects before rendering.  I don't clip the far plane because my system considers objects visible if they actually are visible.  I mean, I don't cull distance at all.  If the object is big enough to be seen at its current distance, then it gets drawn.  It handles LOD sorting and is very fast.<br />
<br />
Anyway, just for fun, I set up a (actual size) Sun and Earth, and set them their actual distance apart.  I used a 1:1 scale where the value 1.0 represents 1.0 meters.  So I made the earth object 6M units (radius), the sun object 700M units, and set them 150B units apart.<br />
<br />
My system handles everything fine: objects look pretty, no jitter (double precision), and such.<br />
<br />
The problem is, the renderer is drawing the sun on top of the earth when the earth should obscure it.  I'm guessing this is a z-order precision issue, but I'm not a rendering guy.<br />
<br />
My guess is that there's nothing I can do about it, but I wanted to be sure.<br />
<br />
Oh, I'm using Xna for rendering right now, but my system allows for any rendering codebase to plug in fairly easily, so I'm asking this specific to Xna but not to the exclusion of other rendering engines.<br />
<br />
Cheers,<br />
Dave]]></description>
		<pubDate>Sat, 25 Feb 2012 01:19:44 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620875-xna-z-order-precision/</guid>
	</item>
	<item>
		<title>Quasi MMO and cheating</title>
		<link>http://www.gamedev.net/topic/620871-quasi-mmo-and-cheating/</link>
		<description><![CDATA[I'm in the process of designing a game where players host their own worlds but players can take their stuff gained from any certain world with them to other servers. Players will be able to literally take pieces of worlds into their inventory. The environments are voxelized so players can pick up a chunk of voxels of dirt or any other material and keep it in their inventory.<br />
<br />
Player data will be kept on a central server.<br />
<br />
I'm trying to think of a way to do this that will minimize cheating. I don't want to keep player created data on my own servers.<br />
<br />
How could I validate gathered materials without actually hosting the maps?<br />
<br />
I think I can host things like monster and treasure spawns but not player created content.]]></description>
		<pubDate>Fri, 24 Feb 2012 23:34:05 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620871-quasi-mmo-and-cheating/</guid>
	</item>
	<item>
		<title>Is it possible to make a game for a console or handheld?</title>
		<link>http://www.gamedev.net/topic/620869-is-it-possible-to-make-a-game-for-a-console-or-handheld/</link>
		<description><![CDATA[I have made a couple simple android games that i like to show my friends but one problem always gets in the way and that is the controls.  Some ideas I have dont always seem to work with the touch control scheme and the screen size.  I was told that a tablet has more screen size to play with.  In my search for a control idea I saw microsofts xna frame work and it looked awesome. I could make games for the xbox and or windows phone 7( I own an xbox but not the latter so I guess just xbox in this case).  This looked amazing.  I was wondering if there were any other hardware manufacturers that let you make indie games on their platform like microsoft does?  I looked up for sony for example and i saw the playstation suit but the wiki article was old and it said it was outdated.<br />
<br />
Thanks]]></description>
		<pubDate>Fri, 24 Feb 2012 23:05:39 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620869-is-it-possible-to-make-a-game-for-a-console-or-handheld/</guid>
	</item>
	<item>
		<title>How can PIX be used with WPF apps?</title>
		<link>http://www.gamedev.net/topic/620868-how-can-pix-be-used-with-wpf-apps/</link>
		<description><![CDATA[Hi everyone!<br />
<br />
I’m planning a project that will require a nice UI. I’m thinking of using ribbon toolbars, which is why I probably need WPF (I know there are lightweight versions for WinForms, but I didn’t came across something that wasn’t buggy, missed important things or was slow…)<br />
I’d like to use SlimDX (currently I only have the September 2011 release installed). So, I looked into the WPF samples of SlimDX and I got confused…<br />
<br />
When I tried to debug any of the WPF samples (DX9 or 10 didn’t matter) PIX didn’t show up anything. The D3D area was plain white and hitting F12 had no effect. I read that some people somehow managed to get PIX to do at least something (they got crashes, though…).<br />
<br />
<strong class='bbc'>So my question is</strong>: Is it possible to write WPF apps that use SlimDX to render Direct3D 11 content and can be debugged in PIX?<br />
<br />
Thanks in advance, dear people!]]></description>
		<pubDate>Fri, 24 Feb 2012 22:41:22 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620868-how-can-pix-be-used-with-wpf-apps/</guid>
	</item>
	<item>
		<title>Side scroller theory</title>
		<link>http://www.gamedev.net/topic/620867-side-scroller-theory/</link>
		<description><![CDATA[Hello all. I have been searching on this for quite some time now and trying things out but I think it is time to finally ask a question. I have a platformer that I built that I am trying to change to a side scroller now. I have the map already layed out with tiles via a program I wrote and the tiles are loading properly.<br />
<br />
What I am having trouble understanding and getting a definitive answer is this; In your update loop, when the player moves you have to update all of the tiles positions, monsters, and every item's position by the amount the player moved correct? I know a lot of articles say to use a camera which I am using but it basically just points to the player at all times.<br />
<br />
I believe I have the rendering algorithm working properly (rendering tiles around the player only). A lot of the things I have read talk about updating the rendering rectangle of your background texture, so I was going to try this next by rendering to texture my tilemap but before I did that I figured I would ask the above question because I can't see a reason why you would have to convert everything to a texture first.<br />
<br />
It shouldn't matter because I am just looking for theory here but I am writing in XNA 4.0.<br />
<br />
If someone could point me in the right direction that would be great. Thank you.]]></description>
		<pubDate>Fri, 24 Feb 2012 22:33:09 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620867-side-scroller-theory/</guid>
	</item>
	<item>
		<title>Impulse based friction on line segment</title>
		<link>http://www.gamedev.net/topic/620866-impulse-based-friction-on-line-segment/</link>
		<description><![CDATA[Trying to figure out the friction impulse to apply on a circle rolling down a line segment, I've read a lot of other threads and it seems like it's kind of similar to the elastic impulse:<br />
<br />
<pre class='prettyprint'>
// nx & ny = contact normal
// fE = elastic impulse
// dx & dy = distance from center of mass to contact point

var tx = -ny;
var ty = nx;

var tCross = dx*ty-dy*tx;

var friction = .5;

var fF = tx*c.vx+ty*c.vy;
fF /= (c.inverseMass+(tCross*tCross)/c.momentOfInertia);

var fx = (fE*nx)+(friction*fF*tx);
var fy = (fE*ny)+(friction*fF*ty);

// xy velocity + angular

c.vx -= fx*c.inverseMass;
c.vy -= fy*c.inverseMass;

c.av -= (dx*fy-dy*fx)/c.momentOfInertia;
</pre>
<br />
This is following the same sort of "pattern" adapted for the angular force as the usual<br />
j = -(1 + e)rV . n / (n . n(iM1) + (pv1 . n)^2 / I1)<br />
<br />
However when it came to the implementation, the behaviour of it's a little.. strange. Here's a demo - <a href='http://www.fileize.com/view/9137d063-58a/' class='bbc_url' title='External link' rel='nofollow external'>http://www.fileize.com/view/9137d063-58a/</a><br />
I've tried clamping the friction to be a limit based on the elastic impulse but that didn't really do much. Could anybody enlighten me as to where I've slipped up?]]></description>
		<pubDate>Fri, 24 Feb 2012 22:30:11 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620866-impulse-based-friction-on-line-segment/</guid>
	</item>
	<item>
		<title>if statement problem</title>
		<link>http://www.gamedev.net/topic/620865-if-statement-problem/</link>
		<description><![CDATA[for some reason this if statement never executes even if all arrays are true.let me know if you need more code<br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'>if</span></span></span></span></span></span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'> (((board[0,0]) == </span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'>true</span></span></span></span></span></span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>) && ((board[0,1]) == </span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'>true</span></span></span></span></span></span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>) && ((board[0,2]) == </span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'>true</span></span></span></span></span></span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>))</span></span></span></span><br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>{</span></span></span></span><br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #2b91af'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #2b91af'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #2b91af'>Pen</span></span></span></span></span></span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'> pn = </span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #0000ff'>new</span></span></span></span></span></span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'> </span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #2b91af'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #2b91af'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #2b91af'>Pen</span></span></span></span></span></span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>(</span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #2b91af'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #2b91af'><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='color: #2b91af'>Color</span></span></span></span></span></span></span></span></span><span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>.Blue, 3);</span></span></span></span><br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>g.DrawLine(pn, 0, 50, 200, 50);</span></span></span></span><br />
<span style='font-family: Consolas'><span style='font-size: 10px;'><span style='font-family: Consolas'><span style='font-size: 10px;'>}</span></span></span></span>]]></description>
		<pubDate>Fri, 24 Feb 2012 22:25:16 +0000</pubDate>
		<guid>http://www.gamedev.net/topic/620865-if-statement-problem/</guid>
	</item>
</channel>
</rss>
