Search Results

Search found 704 results on 29 pages for 'directx'.

Page 15/29 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Which parts of Graphics Pipelines are done using CPU & GPU?

    - by afriza
    Which parts of pipelines are done using CPU and which are done using GPU? Reading Wikipedia on Graphics Pipeline, maybe my question does not precisely represent what I am asking. Referring to this question, which "steps" are done in CPU and which are done in GPU? Edit: My question is more into which parts of logical high level steps needed to display terrain+3D models are using CPU/GPU instead of which functions.

    Read the article

  • header confusion. Compiler not recognizing datatypes

    - by numerical25
    I am getting confused on why the compiler is not recognizing my classes. So I am just going to show you my code and let you guys decide. My error is this error C2653: 'RenderEngine' : is not a class or namespace name and it's pointing to this line std::vector<RenderEngine::rDefaultVertex> m_verts; Here is the code for rModel, in its entirety. It contains the varible. the class that holds it is further down. #ifndef _MODEL_H #define _MODEL_H #include "stdafx.h" #include <vector> #include <string> //#include "RenderEngine.h" #include "rTri.h" class rModel { public: typedef tri<WORD> sTri; std::vector<sTri> m_tris; std::vector<RenderEngine::rDefaultVertex> m_verts; std::wstring m_name; ID3D10Buffer *m_pVertexBuffer; ID3D10Buffer *m_pIndexBuffer; rModel( const TCHAR *filename ); rModel( const TCHAR *name, int nVerts, int nTris ); ~rModel(); float GenRadius(); void Scale( float amt ); void Draw(); //------------------------------------ Access functions. int NumVerts(){ return m_verts.size(); } int NumTris(){ return m_tris.size(); } const TCHAR *Name(){ return m_name.c_str(); } RenderEngine::cDefaultVertex *VertData(){ return &m_verts[0]; } sTri *TriData(){ return &m_tris[0]; } }; #endif at the very top of the code there is a header file #include "stdafx.h" that includes this // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #include "targetver.h" #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // Windows Header Files: #include <windows.h> // C RunTime Header Files #include <stdlib.h> #include <malloc.h> #include <memory.h> #include <tchar.h> #include "resource.h" #include "d3d10.h" #include "d3dx10.h" #include "dinput.h" #include "RenderEngine.h" #include "rModel.h" // TODO: reference additional headers your program requires here as you can see, RenderEngine.h comes before rModel.h #include "RenderEngine.h" #include "rModel.h" According to my knowledge, it should recognize it. But on the other hand, I am not really that great with organizing headers. Here my my RenderEngine Declaration. #pragma once #include "stdafx.h" #define MAX_LOADSTRING 100 #define MAX_LIGHTS 10 class RenderEngine { public: class rDefaultVertex { public: D3DXVECTOR3 m_vPosition; D3DXVECTOR3 m_vNormal; D3DXCOLOR m_vColor; D3DXVECTOR2 m_TexCoords; }; class rLight { public: rLight() { } D3DXCOLOR m_vColor; D3DXVECTOR3 m_vDirection; }; static HINSTANCE m_hInst; HWND m_hWnd; int m_nCmdShow; TCHAR m_szTitle[MAX_LOADSTRING]; // The title bar text TCHAR m_szWindowClass[MAX_LOADSTRING]; // the main window class name void DrawTextString(int x, int y, D3DXCOLOR color, const TCHAR *strOutput); //static functions static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); bool InitWindow(); bool InitDirectX(); bool InitInstance(); int Run(); void ShutDown(); void AddLight(D3DCOLOR color, D3DXVECTOR3 pos); RenderEngine() { m_screenRect.right = 800; m_screenRect.bottom = 600; m_iNumLights = 0; } protected: RECT m_screenRect; //direct3d Members ID3D10Device *m_pDevice; // The IDirect3DDevice10 // interface ID3D10Texture2D *m_pBackBuffer; // Pointer to the back buffer ID3D10RenderTargetView *m_pRenderTargetView; // Pointer to render target view IDXGISwapChain *m_pSwapChain; // Pointer to the swap chain RECT m_rcScreenRect; // The dimensions of the screen ID3D10Texture2D *m_pDepthStencilBuffer; ID3D10DepthStencilState *m_pDepthStencilState; ID3D10DepthStencilView *m_pDepthStencilView; //transformation matrixs system D3DXMATRIX m_mtxWorld; D3DXMATRIX m_mtxView; D3DXMATRIX m_mtxProj; //pointers to shaders matrix varibles ID3D10EffectMatrixVariable* m_pmtxWorldVar; ID3D10EffectMatrixVariable* m_pmtxViewVar; ID3D10EffectMatrixVariable* m_pmtxProjVar; //Application Lights rLight m_aLights[MAX_LIGHTS]; // Light array int m_iNumLights; // Number of active lights //light pointers from shader ID3D10EffectVectorVariable* m_pLightDirVar; ID3D10EffectVectorVariable* m_pLightColorVar; ID3D10EffectVectorVariable* m_pNumLightsVar; //Effect members ID3D10Effect *m_pDefaultEffect; ID3D10EffectTechnique *m_pDefaultTechnique; ID3D10InputLayout* m_pDefaultInputLayout; ID3DX10Font *m_pFont; // The font used for rendering text // Sprites used to hold font characters ID3DX10Sprite *m_pFontSprite; ATOM RegisterEngineClass(); void DoFrame(float); bool LoadEffects(); void UpdateMatrices(); void UpdateLights(); }; The classes are defined within the class class rDefaultVertex { public: D3DXVECTOR3 m_vPosition; D3DXVECTOR3 m_vNormal; D3DXCOLOR m_vColor; D3DXVECTOR2 m_TexCoords; }; class rLight { public: rLight() { } D3DXCOLOR m_vColor; D3DXVECTOR3 m_vDirection; }; Not sure if thats good practice, but I am just going by the book. In the end, I just need a good way to organize it so that rModel recognizes RenderEngine. and if possible, the other way around.

    Read the article

  • unresolved external symbol _D3D10CreateDeviceAndSwapChain@32 referenced in function "public: bool

    - by numerical25
    Having trouble creating my swap chain. I receive the following error. DX3dApp.obj : error LNK2019: unresolved external symbol _D3D10CreateDeviceAndSwapChain@32 referenced in function "public: bool __thiscall DX3dApp::InitDirect3D(void)" (?InitDirect3D@DX3dApp@@QAE_NXZ) Below is the code ive done so far. #include "DX3dApp.h" bool DX3dApp::Init(HINSTANCE hInstance, int width, int height) { mhInst = hInstance; mWidth = width; mHeight = height; if(!WindowsInit()) { return false; } if(!InitDirect3D()) { return false; } } int DX3dApp::Run() { MSG msg = {0}; while (WM_QUIT != msg.message) { while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) == TRUE) { TranslateMessage(&msg); DispatchMessage(&msg); } Render(); } return (int) msg.wParam; } bool DX3dApp::WindowsInit() { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = mhInst; wcex.hIcon = 0; wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = NULL; wcex.lpszClassName = TEXT("DirectXExample"); wcex.hIconSm = 0; RegisterClassEx(&wcex); // Resize the window RECT rect = { 0, 0, mWidth, mHeight }; AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE); // create the window from the class above mMainhWnd = CreateWindow(TEXT("DirectXExample"), TEXT("DirectXExample"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, mhInst, NULL); if (!mMainhWnd) { return false; } ShowWindow(mMainhWnd, SW_SHOW); UpdateWindow(mMainhWnd); return true; } bool DX3dApp::InitDirect3D() { DXGI_SWAP_CHAIN_DESC scd; ZeroMemory(&scd, sizeof(scd)); scd.BufferCount = 1; scd.BufferDesc.Width = mWidth; scd.BufferDesc.Height = mHeight; scd.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; scd.BufferDesc.RefreshRate.Numerator = 60; scd.BufferDesc.RefreshRate.Denominator = 1; scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; scd.OutputWindow = mMainhWnd; scd.SampleDesc.Count = 1; scd.SampleDesc.Quality = 0; scd.Windowed = TRUE; HRESULT hr = D3D10CreateDeviceAndSwapChain(NULL,D3D10_DRIVER_TYPE_REFERENCE, NULL, 0, D3D10_SDK_VERSION, &scd, &mpSwapChain, &mpD3DDevice); if(!hr != S_OK) { return FALSE; } ID3D10Texture2D *pBackBuffer; return TRUE; } void DX3dApp::Render() { } LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { // Allow the user to press the escape key to end the application case WM_KEYDOWN: switch(wParam) { // Check if the user hit the escape key case VK_ESCAPE: PostQuitMessage(0); break; } break; // The user hit the close button, close the application case WM_DESTROY: PostQuitMessage(0); break; } return DefWindowProc(hWnd, message, wParam, lParam); }

    Read the article

  • Problem setting up Direct X for C++

    - by Josh
    I've downloaded Direct X SDK from the microsoft website but when I try to compile my code i'm getting this error: Error 1 error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "void __cdecl initD3D(struct HWND__ *)" (?initD3D@@YAXPAUHWND__@@@Z) C:\Users\Josh\Desktop\Tutorial\Tutorial\Tutorial.obj Tutorial I have added Direct X to my C++ build directories like that: $(DXSDK_DIR)include $(DXSDK_DIR)Lib\x64 I've googled it and found out that most of the time people were forgetting this line: #pragma comment (lib, "d3dx9.lib") But it's there for me here are my includes and lib: #include <windows.h> #include <windowsx.h> #include <d3d9.h> #include <d3dx9.h> #pragma comment (lib, "d3d9.lib") #pragma comment (lib, "d3dx9.lib") Can anyone help me with this? I'm using Visual studio 2010 Professional on win7 x64

    Read the article

  • Images saved with D3DXSaveSurfaceToFile will open in Paint, not Photoshop

    - by bsruth
    I'm using D3DXSaveSurfaceToFile to save windowed Direct3D 9 surfaces to PNG, BMP and JPG files. There are no errors returned from the D3DXSaveSurfaceToFile call and all files open fine in Windows Photo Viewer and Paint. But they will not open in a higher end image editing program such as Paint Shop Pro or Photoshop. The error messages from these programs basically say that the file is corrupted. If I open the files in Paint and then save them in the same file format with a different file name, then they'll open fine in the other programs. This leads me to believe that D3DXSaveSurfaceToFile is writing out non-standard versions of these file formats. Is there some way I can get this function to write out files that can be opened in programs like Photoshop without the intermediate step of resaving the files in Paint? Or is there another function I should be using that does a better job of saving a Direct3D surfaces to an image?

    Read the article

  • VMR9Allocator (DirectShow .NET + SlimDX)

    - by faulty
    I was trying to convert and run the VMR9Allocator sample for DirectShow .NET with SlimDX instead of MDX. I got an exception when it reach this line return vmrSurfaceAllocatorNotify.SetD3DDevice(unmanagedDevice, hMonitor) In the AdviseNotify method in Allocator.cs. The exception is "No such interface supported", and the hr return was "0x80004002". The sample runs fine with MDX, and my SlimDx is also working, as I've written another 3d apps using it, working fine. I can't seems to find out what went wrong, no help from googling as well. Apparently not much ppl uses this combination, and non that i can find actually stumble into this problem. Any idea guys? NOTE: I've asked the same question over at gamedev.net 2 weeks back, no answer thus far.

    Read the article

  • Access violation reading location 0x00184000.

    - by numerical25
    having troubles with the following line HR(md3dDevice->CreateBuffer(&vbd, &vinitData, &mVB)); it appears the CreateBuffer method is having troubles reading &mVB. mVB is defined in box.h and looks like this ID3D10Buffer* mVB; Below is the code it its entirety. this is all files that mVB is in. //Box.cpp #include "Box.h" #include "Vertex.h" #include <vector> Box::Box() : mNumVertices(0), mNumFaces(0), md3dDevice(0), mVB(0), mIB(0) { } Box::~Box() { ReleaseCOM(mVB); ReleaseCOM(mIB); } float Box::getHeight(float x, float z)const { return 0.3f*(z*sinf(0.1f*x) + x*cosf(0.1f*z)); } void Box::init(ID3D10Device* device, float m, float n, float dx) { md3dDevice = device; mNumVertices = m*n; mNumFaces = 12; float halfWidth = (n-1)*dx*0.5f; float halfDepth = (m-1)*dx*0.5f; std::vector<Vertex> vertices(mNumVertices); for(DWORD i = 0; i < m; ++i) { float z = halfDepth - (i * dx); for(DWORD j = 0; j < n; ++j) { float x = -halfWidth + (j* dx); float y = getHeight(x,z); vertices[i*n+j].pos = D3DXVECTOR3(x, y, z); if(y < -10.0f) vertices[i*n+j].color = BEACH_SAND; else if( y < 5.0f) vertices[i*n+j].color = LIGHT_YELLOW_GREEN; else if (y < 12.0f) vertices[i*n+j].color = DARK_YELLOW_GREEN; else if (y < 20.0f) vertices[i*n+j].color = DARKBROWN; else vertices[i*n+j].color = WHITE; } } D3D10_BUFFER_DESC vbd; vbd.Usage = D3D10_USAGE_IMMUTABLE; vbd.ByteWidth = sizeof(Vertex) * mNumVertices; vbd.BindFlags = D3D10_BIND_VERTEX_BUFFER; vbd.CPUAccessFlags = 0; vbd.MiscFlags = 0; D3D10_SUBRESOURCE_DATA vinitData; vinitData.pSysMem = &vertices; HR(md3dDevice->CreateBuffer(&vbd, &vinitData, &mVB)); //create the index buffer std::vector<DWORD> indices(mNumFaces*3); // 3 indices per face int k = 0; for(DWORD i = 0; i < m-1; ++i) { for(DWORD j = 0; j < n-1; ++j) { indices[k] = i*n+j; indices[k+1] = i*n+j+1; indices[k+2] = (i*1)*n+j; indices[k+3] = (i*1)*n+j; indices[k+4] = i*n+j+1; indices[k+5] = (i*1)*n+j+1; k+= 6; } } D3D10_BUFFER_DESC ibd; ibd.Usage = D3D10_USAGE_IMMUTABLE; ibd.ByteWidth = sizeof(DWORD) * mNumFaces*3; ibd.BindFlags = D3D10_BIND_INDEX_BUFFER; ibd.CPUAccessFlags = 0; ibd.MiscFlags = 0; D3D10_SUBRESOURCE_DATA iinitData; iinitData.pSysMem = &indices; HR(md3dDevice->CreateBuffer(&ibd, &iinitData, &mIB)); } void Box::Draw() { UINT stride = sizeof(Vertex); UINT offset = 0; md3dDevice->IASetVertexBuffers(0, 1, &mVB, &stride, &offset); md3dDevice->IASetIndexBuffer(mIB, DXGI_FORMAT_R32_UINT, 0); md3dDevice->DrawIndexed(mNumFaces*3, 0 , 0); } //Box.h #ifndef _BOX_H #define _BOX_H #include "d3dUtil.h" Box.h class Box { public: Box(); ~Box(); void init(ID3D10Device* device, float m, float n, float dx); void Draw(); float getHeight(float x, float z)const; private: DWORD mNumVertices; DWORD mNumFaces; ID3D10Device* md3dDevice; ID3D10Buffer* mVB; ID3D10Buffer* mIB; }; #endif Thanks again for the help

    Read the article

  • Detect movie being played (Windows)

    - by modosansreves
    Watching a movie is quite a different user activity. User doesn't touch neither mouse nor keyboard. Yet he 'actively' uses the computer. Thus, screensaver shouldn't run, indexing should be performed with care etc. On the other side, playing video requires either using direct write to video memory, or DirectShow, or some other API. This may be the key to the answer. What is the Dead Simple Way to determine that a video is being played?

    Read the article

  • how many color combinations in a 24 bit image

    - by numerical25
    I am reading a book and I am not sure if its a mistake or I am misunderstanding the quote. It reads... Nowadays every PC you can buy has hardware that can render images with at least 16.7 million individual colors. Rather than have an array with thousands of color entries, the images instead contain explicit color values for each pixel. A 24-bit display, of course, uses 24 bits, or 3 bytes per pixel, for color information. This gives 1 byte, or 256 distinct values each, for red, green, and blue. This is generally called true color, because 256^3 (16.7 million) He says 1 byte is equal to 256 distinct values. 1 byte = 8 bits. 8^2 bits = 64 combinations of colors right ?? It's not adding up right to me. I know it might be something simple to understand, but I don't understand.

    Read the article

  • Is it possible to capture audio output and apply effects to it?

    - by Ciaran
    Using .NET and DirectSound I want to be able to take all output sound that is coming from my audio device and apply effects to it. I've had a quick look at the docs on MSDN and there doesn't seem to be any explanation as to how to do something like this. I've read elsewhere that you'd be better off writing a driver to sit in front of your real audio driver and have that do whatever you want with the sound. Any ideas anyone to push me in the right direction?

    Read the article

  • ID3DXAnimationController.RegisterAnimationSet - How exactly is this supposed to work?

    - by TrespassersW
    I have a mesh file that contains the skinned mesh that I want, and then a bunch of separate animation files that contain various AnimationSets. I'd like to have my program dynamically build the list of AnimationSets available to a mesh at run-time. I know I can combine these into one mesh file using MView, but that isn't practical for what I'm planning. I thought this would be pretty simple since ID3DXAnimationController.RegisterAnimationSet seems like it exists to do exactly this and the MView mesh viewer program can do this. But when I call RegisterAnimationSet using an animation from a different file, it fails with an unhelpful Invalid Call return value. Both the skinned mesh and the animation were exported from the same 3DS file, so I'm pretty certain that they are compatible. Here's my code: var anim : ID3DXAnimationSet; am : IDxAnimMesh; begin fAnim := ResMgr.AnimFetch('man01.x'); am := ResMgr.AnimFetch('a_rigtest.x'); DXCheck(am.Controller.GetAnimationSet(0,anim)); DXCheck(fAnim.Controller.RegisterAnimationSet(anim)); end; The file "man01.x" contains a default animation. And "a_rigtest.x" contains an animation exported from a different portion of the timeline fromt the same 3DS file. So it seems like they should be compatible. MView combines them with no trouble. Am I doing something wrong? Does anyone know how this is supposed to work? Or better yet, does anyone know where I could find the source code to MView? Any help would be appreciated.

    Read the article

  • Cloning ID3DXMesh with declration that has 12 floats breaks?

    - by meds
    I have the following vertex declration: struct MESHVERTInstanced { float x, y, z; // Position float nx, ny, nz; // Normal float tu, tv; // Texcoord float idx; // index of the vertex! float tanx, tany, tanz; // The tangent const static D3DVERTEXELEMENT9 Decl[6]; static IDirect3DVertexDeclaration9* meshvertinstdecl; }; And I declare it as such: const D3DVERTEXELEMENT9 MESHVERTInstanced::Decl[] = { { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, { 0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 }, { 0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }, { 0, 32, D3DDECLTYPE_FLOAT1, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1 }, { 0, 36, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 0 }, D3DDECL_END() }; What I try to do next is copy an ID3DXMesh into another one with the new vertex declaration as such: model->CloneMesh( model->GetOptions(), MESHVERTInstanced::Decl, gd3dDevice, &pTempMesh ); When I try to get the FVF size of pTempMesh (D3DXGetFVFVertexSize(pTempMesh-GetFVF())) I get '0' though the size should be 48. The whole thing is fine if I don't have the last declaration, '{ 0, 36, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 0 },' in it and the CloneMesh function does not return a FAIL. I've also tried using different declarations such as D3DDECLUSAGE_TEXCOORD and that has worked fine, returning a size of 48. Is there something specific about D3DDECLUSAGE_TANGENT I don't know? I'm at a complete loss as to why this isn't working...

    Read the article

  • ANY material writen in/for DELPHI around the graphics topic?

    - by José Eduardo
    Does anyone knows ANY material writen in/for DELPHI around the graphics topic? Planning to build a software for medical imaging processing . Thinking in 3D UI to absorve the power of nvidias GTX graphics card, and some real-time 2D processing integrated with high-end scanners. Please dont take this as a "rant" but, we have zillions of C++ books writen about that kind of topic and nothing for pascal/delphi. If you have some experience could you comment about that? Is it better to learn c++, to have access to that material? Can i go with delphi? I have experience with delphi, but none with graphics... And i have a deadline... Thanks.

    Read the article

  • Calculating the Angle Between Two vectors Using Dot Product

    - by P. Avery
    I'm trying to calculate the angle between two vectors so that I can rotate a character in the direction of an object in 3D space. I have two vectors( character & object), loc_look, and modelPos respectively. For simplicity's sake I am only trying to rotate along the up axis...yaw. loc_look = D3DXVECTOR3 (0, 0, 1), modelPos = D3DXVECTOR3 (0, 0, 15); I have written this code which seems to be the correct calculations. My problem arises, seemingly, because the rotation I apply to the character's look vector(loc_look) exceeds the value of the object's position (modelPos). Here is my code: BOOL CEntity::TARGET() { if(graphics.m_model->m_enemy) { D3DXVECTOR3 modelPos = graphics.m_model->position; D3DXVec3Normalize(&modelPos, &modelPos); //D3DXVec3Normalize(&loc_look, &loc_look); float dot = D3DXVec3Dot(&loc_look, &modelPos); float yaw = acos(dot); BOOL neg = (loc_look.x > modelPos.x) ? true : false; switch ( neg ) { case false: Yaw(yaw); return true; case true: Yaw(-yaw); return true; } } else return false; } I rotate the character's orientation matrix with the following code: void CEntity::CalculateOrientationMatrix(D3DXMATRIX *orientationMatrix) { D3DXMatrixRotationAxis(&rotY, &loc_up, loc_yaw); D3DXVec3TransformCoord(&loc_look, &loc_look, &rotY); D3DXVec3TransformCoord(&loc_right, &loc_right, &rotY); D3DXMatrixRotationAxis(&rotX, &loc_right, loc_pitch); D3DXVec3TransformCoord(&loc_look, &loc_look, &rotX); D3DXVec3TransformCoord(&loc_up, &loc_up, &rotX); D3DXMatrixRotationAxis(&rotZ, &loc_look, loc_roll); D3DXVec3TransformCoord(&loc_up, &loc_up, &rotZ); D3DXVec3TransformCoord(&loc_right, &loc_right, &rotZ); *orientationMatrix *= rotX * rotY * rotZ; orientationMatrix->_41 = loc_position.x; orientationMatrix->_42 = loc_position.y; orientationMatrix->_43 = loc_position.z; //D3DXVec3Normalize(&loc_look, &loc_look); SetYawPitchRoll(0,0,0); // Reset Yaw, Pitch, & Roll Amounts } Also to note, the modelPos.x increases by 0.1 each iteration so the character will face the object as it moves along the x-axis... Now, when I run program, in the first iteration everything is fine(I haven't rotated the character yet). On the second iteration, the loc_look.x value is greater than the modelPos.x value(I rotated the character too much using the angle specified with the dot product calculations in the TARGET function). Therefore on the second iteration my code will rotate the character left to adjust for the difference in the vectors' x values... How can I tighten up the measurements so that I do not rotate my character's look vector by too great a value?

    Read the article

  • matrix = *((fxMatrix*)&d3dMatrix); //Evil?

    - by Xilliah
    I've been using matrix = *((fxMatrix*)&d3dMatrix); for quite a while. It worked fine until my screen turned black and received a bucket of frustration on my desk. fxMatrix contains 4 fxVectors. fxVector used to be 16 bytes, but now it was suddenly 20. This was because it inherited fxStreamable, which added the vTable. So one solution is of course just to not inherit fxStreamable, and leave a comment saying that it must always be 16 bytes and never more. Another solution would be to make conversion functions, and copy the matrix completely. This makes it more secure, but has an impact on the performance. I suppose this is the best idea. Another solution is to not convert at all, and stick to D3DXMATRIX, but this makes the engine inconsistent and I personally really dislike this idea. What is your opinion?

    Read the article

  • SetMatrix() does not copy all values to HLSL

    - by Tili
    Hi, I want to use the contents of a vector of D3DXMatrices to my shader. m_pLightMatrices->SetMatrixArray(&currentLightMatrices[0].m[0][0],0,numLights); As we know the internals of a vector this poses no problems (as it is just a dynamic array). Now when I access this matrix in hlsl to fill up a struct I get this strange behavior: struct LightTest { float3 LightPos; float LightRange; float4 LightDiffuse; float3 LightAtt; }; float4x4 currentLight = gLights[0]; LightTest lt; lt.LightPos = currentLight._m00_m01_m02; //{0,0,0} lt.LightDiffuse = currentLight[1].rgba; //{0,0,0,0} lt.LightRange = currentLight._m03; //this gives me a value lt.LightAtt = currentLight[2].xyz; //{0,0,0} While debugging I see that my matrix is nicely filled with the variables I want. When I try to hardcode check what is in the struct I get all zero's, except the LightRange. As you can see I tried different methods of accessing the float4x4 but without any other results. Why oh why is hlsl not copying all my variables ?

    Read the article

  • understanding of FPS and the methods they use

    - by numerical25
    Just looking on resources that break down how frames per second work. I know it has something to do with keeping track of Ticks and figure out how many ticks occured between each frame. But I never ran into any resources on why exactly you have to use the methods you use in order to get a smooth frame work. I am trying to get a thourough understanding of this. Can any explain or provide any good resources ? Thanks

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >