Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

216 Neutral

About RealMarkP

  • Rank
    Advanced Member
  1. RealMarkP

    which is faster list or vector?

    a std::vector is basically an array. If you were to remove from the middle, the array would be shifted around and shrunk. A list, if you were to remove from the middle, would not need to copy data to shrink an array. Rather, it would join the next and previous nodes in the linked list. If you are going to be removing things a lot, use a list. If you are going to be accessing things a lot without removing, use a vector.
  2. RealMarkP

    VSync, Why would you turn it off?

    Great discussion. I am going to have the option of turning on Triple Buffering so I guess it makes sense to also expose the VSync option as well. I don't really care much for input lag because the game is not dependent on mad mouse skillz. I'm just worried that the graphics options screen is going to be a bit cluttered.
  3. I'm debating of having an option in my menu system to turn of vsync and allow the engine to run at max FPS. Is there really a reason why anyone would want to turn this off? From what I can see, leaving it on has no detrimental effects. Rendering any FPS beyond of what the monitor can display is a waste.
  4. I'm going to bump this thread in my last attempt to get an answer. My only alternative is to refactor my code to use the managed pool. Using PIX, it looks almost like that the D3DPOOL_SYSTEMMEM texture, that I use for updating the default texture, is somehow getting garbled between releasing or the UpdateTexture() funciton call is not working properly (and not giving me an error). Questions: - When I reset my device after a resize, is it possible that the systemmem texture is not persisted? Was it sheer luck that my code worked before (ie. the texture data was in tact in VRAM and just by luck I got a handle to that particular portion of ram). - Could UpdateTexture() fail in any way without giving an error? If you guys need more information from me to help me fix this bug, please post it. I can also email you an exe so you can take a look at it using PIX or other tools.
  5. I tried running it using software rendering and my textures became completely black. Looks like they still might be getting garbled. I'll try dumping the textures to file to see what it gives me. I also ran my code on a different computer with a different video card. The reason why I'm using the default pool is because I'm planning on using render targets later on when I build the game. Currently I just have a generic texture class that uses the default pool and has a backup 'shadow' copy in the systemmem pool. Screenshots: Before After Resize EDIT: When I resize the window to be smaller (After Resize Screenshot), the texture gets garbled but as soon as I resize back to it's original size the texture appears normal again. This is what confuses me. [Edited by - RealMarkP on May 17, 2010 12:38:00 PM]
  6. I have a few textures in memory that become garbled or display as a lime green color when I resize my window. I'm having a hard time tracking this bug down and PIX, when inspecting the textures, claims everything is working alright. I have a main texture in memory using D3DPOOL_DEFAULT. It displays fine when first running my engine. I have a backup copy of the texture in D3DPOOL_SYSTEMMEM. Whenever the window size changes, I release all my textures (except for the ones in D3DPOOL_SYSTEMMEM), reset my device, and call UpdateTexture() to copy my backup copy of the texture back into D3DPOOL_DEFAULT. Resizing my window works alright if it's being resized only a few pixels. Moving the window around doesn't have an effect. Maximizing the window is hit and miss. Minimizing the window always leaves the window garbled. PIX tells me the textures are in tact. Any ideas?
  7. RealMarkP

    Need Help: Ortho Matrix Math

    Thanks for catching that. It still doesn't solve my problem. // Fixed: m_tProjMatrix.mRaw._43 = (-m_fNearClip) / (m_fFarClip - m_fNearClip);
  8. RealMarkP

    Need Help: Ortho Matrix Math

    I'm in the process of writing my own matrix math (row-major, left-handed) functions, however I cannot get the math right for Otho Projection. here is what I have: // For reference // struct Mat4x4 // { // Float _11, _12, _13, _14; // Float _21, _22, _23, _24; // Float _31, _32, _33, _34; // Float _41, _42, _43, _44; // } mRaw; m_tProjMatrix.mRaw._11 = 2.0f / fWidth; m_tProjMatrix.mRaw._22 = 2.0f / fHeight; m_tProjMatrix.mRaw._33 = 1.0f / (m_fFarClip - m_fNearClip); m_tProjMatrix.mRaw._43 = m_fNearClip / (m_fNearClip - m_fFarClip); m_tProjMatrix.mRaw._44 = 1; What I end up is an Orthogonal projection with (0, 0) in the center and (-1, -1) in the bottom left and (1, 1) in the top right. Is it possible to modify this math so that I get (0, 0) in the top left and (width, height) in the bottom right? Thanks. [Edited by - RealMarkP on May 14, 2010 3:12:42 PM]
  9. I'm looking at the complexity of my HLSL effect and wondering if it's worth splitting off into multiple effect files. In a typical game, how many effect files would be used? Would you write all your shader code in one effect file (complete with dozens of techniques, global variables, etc) and just use that for everything? How man effect/cgfx files do you use?
  10. You could simplify your code by only having one function that checks for collision between your two rects: // This is what I use in my code Bool isIntersecting(const CRect &rectOne, const CRect &rectTwo) { // Check weather these Rectangles are crossing if ((rectOne.topLeft.x > rectTwo.topLeft.x) || (rectOne.bottomRight.x > rectTwo.bottomRight.x)) return false; if ((rectOne.topLeft.y > rectTwo.topLeft.y) || (rectOne.bottomRight.y > rectTwo.bottomRight.y)) return false; return true; } What you can do is when you move your character, you can stop movement all together, or in that one direction. // Pseudo code if (!isIntersecting(myPlayerSprite.getRect(), myWallSprite.getRect())) { // do movement }
  11. What I'm asking is how does an Octree fit into here. I guess I add an IsVisisble member to the SceneObject which would ignore the entire node if the Octree deems that it is outside the bounds of the Frustum. I guess in that case the SceneObject would need a bounding Volume of some sort, probably an AABB.
  12. Scene graphs. They make my brain hurt. I require someone to comment on my design. I understand that a Scene graph is a generic logical representation of objects in relation to one another. A scene graph is not used for culling, nor is it used for spacial awareness. It's not used for render sorting. So, knowing that, I have made up a series of subsystems that covers the above areas, which are all separate of one another. Here is what it looks like (pseudocode): State: - Contains a RenderTargetPtr - Contains a ShaderPtr - Contains a TechniqueID - Contains a map of shader parameters and their values (before application) - Contains Vertex and Index buffers - has function Render(MyRenderer &myRenderer) --- Applies RenderTarget, Shader, Technique, Parameters and Buffers --- MyRenderer holds the last 'state', to minimize unnecessary state changes SceneObject: - Contains a 'pose' (myPoseMat4x4) - Contains a pointer to a State - Contains a list of children (Other SceneObjects) - OnUpdate(Mat4x4 &parentMat4x4, Mat4x4 &camProjMat4x4) --- State->SetParameter("someShaderParam", parentMat4x4 * myPoseMat4x4 * camProjMat4x4); --- for_each(children) child->OnUpdate(parentMat4x4 * myPose4x4, camProjMat4x4); TransformationGraph: - Contains a list of SceneObjects at root level - OnUpdate(Camera &myCamera) --- Loop through all nodes and call OnUpdate(myCamera->getWorldMat(), myCamera->getProjMat); RenderGraph: - Contains a list of States - has a function Update() which sorts the states - has a function Add(State &) which sorts the new state into the list - OnRender(MyRenderer &myRenderer) --- for_each(State in StateList) State->render(myRenderer); This is how far I got. What I'm stuck on is how does one do culling when your data is in the structure above? Assume I'm using an Octree for simplicity. I'm not tied down to this structure, so if you have better ideas, please post them. Thanks!
  13. I've had almost no success finding an answer to this problem. I have the following effect shader: float4x4 g_WorldViewProjection : WORLDVIEWPROJECTION; texture g_Texture; sampler2D g_TexSampler = sampler_state { Texture = <g_Texture>; MinFilter = Linear; MagFilter = Linear; AddressU = Clamp; AddressV = Clamp; }; struct VSIn { float4 position : POSITION; float2 texCoord : TEXCOORD0; }; struct VSOut { float4 position : POSITION; float2 texCoord : TEXCOORD0; }; // Vertex Shader VSOut UIVertexShader(VSIn IN) { VSOut OUT; // Move the vertex position based on the projection Matrix OUT.position = mul(IN.position, g_WorldViewProjection); OUT.texCoord = IN.texCoord; return OUT; } // Pixel Shader float4 UIPixelShader(VSOut IN) : COLOR { // Show the texture on the quad at desired coordinates float4 fResult = tex2D(g_TexSampler, IN.texCoord); return float4(fResult.xyz, 1.0f); } technique UITechnique { pass p0 { VertexProgram = compile vp20 UIVertexShader(); FragmentProgram = compile fp20 UIPixelShader(); } } When I call cgValidateTechnique() on this technique, it fails with CG_FALSE. No error message is caught by my error callback. No other reason is given. I put the shader into FXComposer 2.5 and tried to compile it, no errors are shown and it passes. I use the cgc compiler and it succeeds without error. I'm stuck and I don't know why. if I try to continue through my program without validation, CG gives me the error: "Technique did not pass validation." Does anyone know what causes this, or has anyone run into this problem? my alternative is to dump cg and go back to HLSL. As far as I can see, the shader is coded properly.
  14. I have a rather simple shader thats failing to load in my engine. I loaded it up in FX Composer 2.5 and it gave me the following error: Warning warning C6504 Unknown profile option '''' ignored Graphics\Shader.cgfx 0 Here is my Shader: // +----------------------------------+ // | Declared Globals | // +----------------------------------+ // Matrix Globals float4x4 g_WorldViewProjection : WorldViewProjection; // Texture Globals texture g_UITexture; // Texture Samplers sampler2D g_TexSampler = sampler_state { MinFilter = Linear; MagFilter = Linear; AddressU = Clamp; AddressV = Clamp; }; // +----------------------------------+ // | Vertex Shader | // +----------------------------------+ struct VSIn { float4 position : POSITION; float2 texCoord : TEXCOORD0; }; struct VSOut { float4 position : POSITION; float2 texCoord : TEXCOORD0; }; // Vertex Shader VSOut UIVertexShader(VSIn IN) { VSOut OUT; // Move the vertex position based on the projection Matrix OUT.position = mul(IN.position, g_WorldViewProjection); OUT.texCoord = IN.texCoord; return OUT; } // +----------------------------------+ // | Pixel Shader | // +----------------------------------+ // Pixel Shader float4 UIPixelShader(VSOut IN) : COLOR { // Show the texture on the quad at desired coordinates float4 fResult = tex2D(g_TexSampler, IN.texCoord); return float4(fResult.xyz, 1.0f); } // +----------------------------------+ // | Techniques | // +----------------------------------+ technique UITechnique { pass p0 { VertexShader = compile vp20 UIVertexShader(); PixelShader = compile fp20 UIPixelShader(); } } [Edited by - RealMarkP on March 5, 2010 8:24:15 AM]
  15. RealMarkP

    2D UI Transformations

    Quote:Original post by Buckeye If you're going to do the resizing often, leave the buffer along and apply a scaling transform. If you properly order the translate-scale-translate the scale won't affect the translation. You can, also, just create the quad at (0,0) to begin with and use scale-translate all the time. Great, this is the answer I was looking for.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!