This entry was posted
on Wednesday, September 17th, 2008 at 12:20 pm and is filed under XNA Tutorials.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
9 Responses to “More Rendering Complexity – Shaders and Cameras”
Have you tried looking at the svn source code? There may be slight issues in the PDF that could be the issue. Also, if you are changing the resolution or the size of the window, the image is supposed to be shrinking. The framework scales the final rendered output to the new window size. If you wanted to make it exactly the same no matter the window size, you’d need to play with the focal distance of the lens, which is accomplished by messing with the fieldOfView parameter in the Update function. The other thing you could try is visiting the forums and asking around there. A few hundred more eyes on the problem might help as well if it really is a problem
I’m sorry to bother you again, but where do i find the source for the tutorials?
I tried to search the forum and there’s much talk of source code, but not much links to the source.
Never mind. I found http://code.google.com/p/hmengine-xna/, downloaded TurtoiseSVN and checked the Trunk out
I will find the problem with this working example.
I overlooked these lines in the PDF at page 9:
if (null != myEffect.Parameters["World"]) myEffect.Parameters["World"].SetValue(World);
if (null != myEffect.Parameters["View"]) myEffect.Parameters["View"].SetValue(HMCameraManager.ActiveCamera.View);
if (null != myEffect.Parameters["Project"]) myEffect.Parameters["Project"].SetValue(HMCameraManager.ActiveCamera.Projection);
Should I be using VS2008? I did not have any problems with the code until I came to this:
myVertices = new[] {
new VertexPositionColorTexture(new Vector3(-0.5f, 0.5f, 0), myColor, new Vector2(0, 0)),
new VertexPositionColorTexture(new Vector3(0.5f, 0.5f, 0), myColor, new Vector2(1, 0)),
new VertexPositionColorTexture(new Vector3(-0.5f, -0.5f, 0), myColor, new Vector2(0, 1)),
new VertexPositionColorTexture(new Vector3(0.5f, -0.5f, 0), myColor, new Vector2(1, 1))
};
myIndexes = new[] { 0, 1, 2, 1, 3, 2 };
I’m getting syntax error value expected at the square brackets in VS 2005 Pro.
I guess I will have to download VS 2008 Express huh?
Hiya hazymind! After talking at you on #xna @ Efnet I finally found time to stop in an check these new tutorial version out. I found that going through them a second time almost a year or so later, I understand them alot more.
These are really nice. Idk if they are for complete beginners though lol. I love these because they show how to actually tie a game neatly together instead of hard code everything.
These were really what I needed to hit up again because I found myself stumbling over adding managers and object isolation.
I documented you general process and am using the steps to write my terrain components woot!
August 25th, 2008 at 7:13 am
I can’t get it to work properly. The image keeps resizing when I resize the window, so i asume it’s not using the camera as viewport.
I noticed this in the PDF at page 8. Could that be the problem?
// In HMGame
using HMEngine.HMCameras;
protected override void LoadContent()
{
HMCameraManager.LoadContent(GraphicsDevice);
HMObjectManager.Root.LoadContent(GraphicsDevice, Content);
HMShaderManager.LoadContent(GraphicsDevice, Content);
base.LoadContent();
}
What is this HMObjectManager.Root?
Do I need to set an active camera?
Greetings
Bavo
August 25th, 2008 at 8:33 am
Have you tried looking at the svn source code? There may be slight issues in the PDF that could be the issue. Also, if you are changing the resolution or the size of the window, the image is supposed to be shrinking. The framework scales the final rendered output to the new window size. If you wanted to make it exactly the same no matter the window size, you’d need to play with the focal distance of the lens, which is accomplished by messing with the fieldOfView parameter in the Update function. The other thing you could try is visiting the forums and asking around there. A few hundred more eyes on the problem might help as well if it really is a problem
August 26th, 2008 at 1:35 am
I’m sorry to bother you again, but where do i find the source for the tutorials?
I tried to search the forum and there’s much talk of source code, but not much links to the source.
August 26th, 2008 at 2:15 am
Never mind. I found http://code.google.com/p/hmengine-xna/, downloaded TurtoiseSVN and checked the Trunk out
I will find the problem with this working example.
August 26th, 2008 at 3:15 am
I overlooked these lines in the PDF at page 9:
if (null != myEffect.Parameters["World"]) myEffect.Parameters["World"].SetValue(World);
if (null != myEffect.Parameters["View"]) myEffect.Parameters["View"].SetValue(HMCameraManager.ActiveCamera.View);
if (null != myEffect.Parameters["Project"]) myEffect.Parameters["Project"].SetValue(HMCameraManager.ActiveCamera.Projection);
That fixed it! (and makes much more sense too)
November 13th, 2008 at 9:25 pm
Should I be using VS2008? I did not have any problems with the code until I came to this:
myVertices = new[] {
new VertexPositionColorTexture(new Vector3(-0.5f, 0.5f, 0), myColor, new Vector2(0, 0)),
new VertexPositionColorTexture(new Vector3(0.5f, 0.5f, 0), myColor, new Vector2(1, 0)),
new VertexPositionColorTexture(new Vector3(-0.5f, -0.5f, 0), myColor, new Vector2(0, 1)),
new VertexPositionColorTexture(new Vector3(0.5f, -0.5f, 0), myColor, new Vector2(1, 1))
};
myIndexes = new[] { 0, 1, 2, 1, 3, 2 };
I’m getting syntax error value expected at the square brackets in VS 2005 Pro.
I guess I will have to download VS 2008 Express huh?
November 14th, 2008 at 9:02 am
jnbutler, The new[]{}; syntax is a part of C# 3.0 and will probably need .Net 3.5 and VS2008 to compile correctly. You could use syntax like
new VertexPositionColorTexture[]{ … }
as well to alleviate this issue.
November 14th, 2008 at 3:01 pm
I went ahead and installed C# Express 2008 and XNA 3.0. Now I can open the svn source! Cool! Great tutorials Mike, thanks.
January 28th, 2009 at 8:06 pm
Hiya hazymind! After talking at you on #xna @ Efnet I finally found time to stop in an check these new tutorial version out. I found that going through them a second time almost a year or so later, I understand them alot more.
These are really nice. Idk if they are for complete beginners though lol. I love these because they show how to actually tie a game neatly together instead of hard code everything.
These were really what I needed to hit up again because I found myself stumbling over adding managers and object isolation.
I documented you general process and am using the steps to write my terrain components woot!
Thanks m@e