Jump to content
  • Advertisement

Claudio

Member
  • Content count

    125
  • Joined

  • Last visited

Community Reputation

121 Neutral

About Claudio

  • Rank
    Member
  1. Claudio

    draw point

    Hi. My problem is: how can I draw a single point onto the screen ? I use DirectX 9. I've thinked to the mesh (an object in a file with extension "*.x") but is there an alternative solution ? for example, without using Mesh ? Is there a solution to my problem ?
  2. Claudio

    Refresh Rate Monitor

    Quote:Original post by Evil Steve If the monitors are on different adapters, then yes - just specify the adapter index instead of D3DADAPTER_DEFAULT. If both monitors appear as the same adapter, I don't think there's any way to do it - there doesn't seem to be any way to do it with GDI either. Why do you need that information though? There's almost nothing you can do with it. Hi. Thanks. The refresh rate of the monitor is used to display a text, only for a determinate period of time.
  3. Hi. I use DirectX 9. My problem is: how can I get the refreshrate of the both two monitor ? that are connected to the computer ? I use "GetAdapterDisplayMode": - for the primary monitor: D3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &D3DDisplayMode); - for the secondary monitor ? what has to be the first input of the function "GetAdapterDisplayMode" ?
  4. Claudio

    image file as background

    Quote:Original post by Evil Steve A sprite is always on top of 3D geometry. You could disable Z-writes, that should work. Add this line after the D3DSprite->Begin(NULL); line: D3DDev->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); And then I re-set as "true" the value of "D3DRS_ZWRITEENABLE" (because i use "D3DRS_ZWRITEENABLE" in my code as "true"): D3DSprite->Begin(NULL); D3DDev->SetRenderState(D3DRS_ZWRITEENABLE, FALSE); D3DSprite->Draw(D3DT9TextureBackground, NULL, NULL, &D3DXVECTOR3(0.0f, 0.0f, 0.0f), 0xFFFFFFFF); D3DSprite->End(); D3DDev->SetRenderState(D3DRS_ZWRITEENABLE, TRUE); // here is the cycle of the 3D object for the visual rendering Is right in this way ?
  5. Hi. I use DirectX 9. My problem is: I've got an image file with extension "*.tga" and I want to displaied this image as background of the application. Obviously, the virtual object has to be displaied in front of the background and this is my problem. The image file is loaded as Texture ("D3DXCreateTextureFromFile") and I'm using the Sprite to draw the texture on the screen as background. D3DDev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xAABBCCEE, 1.0f, 0); // // // set index buffer and vertex declaration: // // // hRes = D3DDev->SetIndices(D3DIB); if (FAILED(hRes)) return hRes; hRes = D3DDev->SetVertexDeclaration(D3DVD); if (FAILED(hRes)) return hRes; // // // visual rendering: // // // hRes = D3DDev->BeginScene(); // sprite: D3DSprite->Begin(NULL); D3DSprite->Draw(D3DT9TextureBackground, NULL, NULL, &D3DXVECTOR3(0.0f, 0.0f, 0.0f), 0xFFFFFFFF); D3DSprite->End(); // 3D object: unsigned int Passes; D3DEffect->Begin(&Passes, 0); for (unsigned int i = 0; i < Passes; i++) { D3DEffect->BeginPass(i); hRes = D3DMesh->DrawSubset(0); D3DEffect->EndPass(); } // for (unsigned int i = 0; i < Passes; i++) D3DEffect->End(); D3DDev->EndScene(); D3DDev->Present(NULL, NULL, NULL, NULL); where: - D3DDev is the D3D device - D3DEffect is the effect - D3DSprite is the sprite The problem could be the transparency ? that is just supported by the format file ("*.tga").
  6. Claudio

    Render() Frequency

    Quote:Original post by Evil Steve Your presentation interval is set to D3DPRESENT_INTERVAL_DEFAULT, which mean you'll render at the refresh rate of your monitor. You can call your Render() function as often as you like, but Present() will block to the refresh rate of your monitor. Hi. How can I get the frequency of the monitor ? Is there one function so ?
  7. Claudio

    Render() Frequency

    Quote:Original post by Claudio DirectX 9. "Render()" Hi. I didn't show my function "render()". Excuse me. Here is the function: render() { D3DDev->Clear(...); D3DDev->SetIndices(...); D3DDev->SetVertexDeclaration(...); D3DDev->BeginScene(); unsigned int Passes; D3DEffect->Begin(&Passes, 0); for (unsigned int i = 0; i < Passes; i++) { D3DEffect->BeginPass(i); D3DMesh->DrawSubset(0); D3DEffect->EndPass(); } D3DEffect->End(); D3DDev->EndScene(); D3DDev->Present(...); } where: - "(...)" are the various parameters of the various fuction - D3DDev is the D3D device - D3DMesh is the 3D object - D3DEffect is the effect (loading from a file "*.fx") And the D3D is defined as: // // // D3D present parameters: // // // D3DPRESENT_PARAMETERS D3Dpp; ZeroMemory(&D3Dpp, sizeof(D3Dpp)); // Fill of the structure D3Dpp D3Dpp.BackBufferWidth = nWidth; // width of the back buffer D3Dpp.BackBufferHeight = nHeight; // height of the back buffer D3Dpp.BackBufferFormat = D3DFMT_X8R8G8B8; D3Dpp.BackBufferCount = 2; // number of back buffer D3Dpp.MultiSampleType = D3DMULTISAMPLE_NONE; D3Dpp.MultiSampleQuality = 0; D3Dpp.SwapEffect = D3DSWAPEFFECT_FLIP; D3Dpp.hDeviceWindow = hWindow; D3Dpp.Windowed = true; D3Dpp.EnableAutoDepthStencil = true; D3Dpp.AutoDepthStencilFormat = D3DFMT_D16; D3Dpp.Flags = 0; D3Dpp.FullScreen_RefreshRateInHz = 0; D3Dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
  8. Hi. I use DirectX 9. My question is: what is the frequency that the function "Render()" is called ? In other way what is the frequency refresh of the visual rendering phase ? It's imposted in the cpp code ? with the DirectX paramter ? --> .frequency ? Thanks.
  9. Claudio

    Gradient Background

    Quote:Original post by Erik Rufelt See Tutorial 2: Rendering Vertices. You can make the vertices have different colors, and the triangle will automatically draw a gradient between them. Once you have that, you only need to create two triangles and stretch them to cover the screen. Hi. Thanks. In my virtual scene, now there's only one 3D object. With your solution, there will be a bit problem because both the two big triangular meshes both the my 3D object will be show in wireframe, when the wireframe mode will be activeted. In you solution: - two vertices of the three vertices (of the both two triangular meshes) have got the same color and the remanent one vertex have another color - so, the Gouraud Shading will be applied, trough the Shader Effect ("*.fx") applied only to the two big meshes - no using the transformations for the two big meshes because my 3D object can rotate with the mouse Thanks.
  10. Hi. I use DirectX 9. My problem is: how can I create a background that is the scale of color from color1 (in rgb) to color2 (in rgb) in only one direction on the screen (for example from left to right or from top to bottom) ? My ideas are the follow: idea 1 - loading a texture (image) that is the desired background idea 2 - use the function "clear(...)" in the rendering function, where the scale color is created by my new function using the input parameter "RECT" of the same function "clear" ? What do you think about my ideas ? Are they (almost one) possible ? and not impossible to implement ? Or are there another solutions to my problem ? Thanks.
  11. Claudio

    Phong Shader

    Quote:Original post by Claudio Quote:Original post by Gage64 On this line: HRESULT hResGetDecl = GetD3DMesh()->GetDeclaration(Decl); Are you sure that GetD3DMesh doesn't return NULL? What is the exact error message you are getting? The error (in the cpp file) is the follow: *** Source Snippet Removed *** The function "GetD3DMesh()" return "NULL" in this case. So, D3DMesh is lost because it return "NULL". The strange case is: - the D3DMesh (of the 3D object) is not NULL, if I don't use (in the pixel shader in the effect file "*.fx") the float3 "fragment.position" to determine the color of the pixel - else the D3DMesh (of the 3D object) is NULL So, is the problem in the effect file "*.fx" ? [Edited by - Claudio on October 21, 2009 8:21:47 AM]
  12. Claudio

    Phong Shader

    Quote:Original post by Claudio I use DirectX 9 and the Phong Shading is not considered in DirectX. So, I've to write the Phong Shading in the Shader (in the effect file "*.fx"). But when I use the function "SetRenderState" in the file cpp, what "D3DRS_SHADEMODE" have I to use ? Have I to set the shade mode as "D3DSHADE_PHONG" because the Phong Shading is not considered in the DirectX 9 ? or "D3DSHADE_FORCE_DWORD". I think that I've not to use "D3DSHADE_FLAT" because I don't want the Flat Shading. Is correct this ? Someone can help me ?
  13. Claudio

    Phong Shader

    Quote:Original post by Gage64 On this line: HRESULT hResGetDecl = GetD3DMesh()->GetDeclaration(Decl); Are you sure that GetD3DMesh doesn't return NULL? What is the exact error message you are getting? The error (in the cpp file) is the follow: Unhandled exception in 0x00403a3f in file.exe: 0xC0000005: Access violation reading the location 0x00000000. If the same code in the Pixel Shader is in the Vertex Shader, the color of the 3D object is displied. [Edited by - Claudio on October 21, 2009 8:47:21 AM]
  14. Claudio

    Phong Shader

    Quote:Original post by Gage64 On this line: HRESULT hResGetDecl = GetD3DMesh()->GetDeclaration(Decl); Are you sure that GetD3DMesh doesn't return NULL? What is the exact error message you are getting? The function "GetD3DMesh" is created by me and it return the D3DMesh of the 3D object (loaded by the DirectX file "*.x"). This function is created for passing from a file to another file the D3DMesh of the 3D object. My opinion is that on the effect file "*.fx" because, the error appear only using the variable "fragment.position" of the position in the Pixel Shader. So, the cause can be located in the Pixel Shader. Can it right ? or wrong ?
  15. Claudio

    Phong Shader

    Quote:Original post by Claudio Quote:Original post by Gage64 Quote:Original post by Claudio Appear an error about "access violation" in referement of getting the number of vertices of the mesh of the 3D object. It sounds like the error is in the application code, so whether or not the shader code is correct is irrelevant. Use the debugger to find the code that causes the crash and post it here. Hi. My opinion is that the Shader is correct but is incorrect in the cpp application code. Maybe the error could be in the declaration of the vertex and, in particolar, in the association of the declaration to the D3DMesh. Hi. One problem is the follow line: struct Fragment { float4 normal : NORMAL } while it has to be: struct Fragment { float3 normal : TEXCOORD0 } But theere is always the problem in part. I think that the proble is the variable: fragment.position in the pixel shader "BasicPixelShader".
  • 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!