Jump to content

  • Log In with Google      Sign In   
  • Create Account

Key_46

Member Since 25 Sep 2005
Offline Last Active Yesterday, 06:10 PM

Topics I've Started

Nvidia SDK sample not working correctly

28 January 2012 - 05:02 AM

Hello everyone, something weird is happening, 2 days ago I downloaded the Parallax Mapping sample from NVidia's DirectX10 SDK, the sample was pre-build so i just ran it. The effects are working fine except for silhouette effect:

http://i.imgur.com/Xr7xB.jpg

Recompiling the sample locally not helped. I posted this problem on NVidia forums and I was replied that the Sample works perfectly on other systems. I remember downloading this SDK somewhere in the past and everything worked fine. Other individual samples are also working fine with and without recompiling. Already update video driver but didn't help.

What could be the cause of this problem? Microsoft's HLSL compiler? Driver-Hardware compatibility?

[SOLVED][DX10] Point sprites and the z-buffer

11 July 2011 - 07:16 PM

I am implementing the ParticlesGS sample in my engine and i came up with a problem... the rendering order is screwed, the only good situation is when i have additive blending, but in my case i have some smoke particles that doen't look nice. So is there a workaround with z-buffering and blend states or i need to hardcode a sorting on the CPU? Because if i had to implement a CPU solution then the whole idea of using GS is worthless, right?

[Solved] Strange problem rendering to a texture

02 August 2010 - 05:56 AM

Hi, i am trying to draw a white rectangle to a texture and then render the texture in a fullscreen quad, but the final result is quite odd.

Here is the code:



//Creates the render target
HRESULT Graphics_CreateRT()
{
HRESULT hr;

//Create the texture, g_presentParams.BackBufferFormat is X8B8G8B8
if(HRFAILED(g_pd3dDevice->CreateTexture(g_presentParams.BackBufferWidth, g_presentParams.BackBufferHeight, 1,
D3DUSAGE_RENDERTARGET, g_presentParams.BackBufferFormat, D3DPOOL_DEFAULT, &g_pRTTexture, NULL)))
{
//Do something...
return hr;
}

//Create the depth buffer
if(HRFAILED(g_pd3dDevice->CreateDepthStencilSurface(g_presentParams.BackBufferWidth, g_presentParams.BackBufferHeight,
D3DFMT_D16, D3DMULTISAMPLE_NONE, 0, TRUE, &g_pRTStencil, NULL)))
{
//Do something...
return hr;
}

return S_OK;
}


//Initialize DirectX device
HRESULT Graphics_Init( HWND hWnd )
{
HRESULT hr;

// Create the D3D object, which is needed to create the D3DDevice.
if((g_pD3D = Direct3DCreate9(D3D_SDK_VERSION)) == NULL)
return E_FAIL;

//Set up the present parameters
ZeroMemory(&g_presentParams, sizeof(g_presentParams));
g_presentParams.Windowed = TRUE;
g_presentParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
g_presentParams.BackBufferFormat = D3DFMT_UNKNOWN;
g_presentParams.EnableAutoDepthStencil = TRUE;
g_presentParams.AutoDepthStencilFormat = D3DFMT_D16;

//Antialiasing
//g_presentParams.MultiSampleType = D3DMULTISAMPLE_8_SAMPLES;

//Create the Direct3D device
if(HRFAILED(g_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &g_presentParams, &g_pd3dDevice)))
{
return hr;
}

// Device state would normally be set here
g_pd3dDevice->SetRenderState(D3DRS_LIGHTING, false);
/*g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
g_pd3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
g_pd3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);*/


//Set the back color
g_backColor = D3DCOLOR_XRGB(0, 128, 255);

//Create the vertex declaration
if(HRFAILED(Vertex::CreateVDecl(g_pd3dDevice, &g_pVDecl)))
{
//Do something more than useles...
return hr;
}

//Create the Quad
if(HRFAILED(Quad::PrepareQuad(1.0f, 1.0f,
g_pd3dDevice, &g_pQuadVB, &g_pQuadIB)))
{
//Do something more than useles...
return hr;
}

//Create the test render target
if(HRFAILED(Graphics_CreateRT()))
return hr;

return S_OK;
}


//Render a white rectangle
VOID Graphics_RenderScene()
{
// Clear the backbuffer to a blue color
g_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, g_backColor, 1.0f, 0);

// Begin the scene
if(FAILED(g_pd3dDevice->BeginScene()))
return;

// Rendering of scene objects can happen here
if(FAILED(g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,
0, 0, 4, 0, 2)))
{
}

// End the scene
g_pd3dDevice->EndScene();
}


//Render a full screen quad with a specific texture
VOID Graphics_RenderFullScreenQuad(LPDIRECT3DTEXTURE9 texture)
{
// Clear the backbuffer to a blue color
g_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(255,0,0,0), 1.0f, 0);

//Prepare the matrix
D3DXMATRIX scale;
D3DXMatrixScaling(&scale, (float)g_presentParams.BackBufferWidth,
(float)g_presentParams.BackBufferHeight, 1.0f);
g_pd3dDevice->SetTransform(D3DTS_WORLD, &scale);


// Begin the scene
if(FAILED(g_pd3dDevice->BeginScene()))
return;

//Set the texture
g_pd3dDevice->SetTexture(0, texture);

// Rendering of scene objects can happen here
if(FAILED(g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,
0, 0, 4, 0, 2)))
{
}

// End the scene
g_pd3dDevice->EndScene();
}


//Render the whole stuff
VOID Graphics_Render()
{
if(g_pd3dDevice == NULL)
return;

LPDIRECT3DSURFACE9 pOldRT;
LPDIRECT3DSURFACE9 pOldDS;
LPDIRECT3DSURFACE9 pRTSurface;

//Render Target
g_pRTTexture->GetSurfaceLevel(0, &pRTSurface);
g_pd3dDevice->GetRenderTarget(0, &pOldRT);
g_pd3dDevice->SetRenderTarget(0, pRTSurface);
pRTSurface->Release();

//Depth Buffer
g_pd3dDevice->GetDepthStencilSurface(&pOldDS);
g_pd3dDevice->SetDepthStencilSurface(g_pRTStencil);

//Render the quad
Graphics_RenderScene();

g_pd3dDevice->SetDepthStencilSurface(pOldDS);
g_pd3dDevice->SetRenderTarget(0, pOldRT);
pOldDS->Release();
pOldRT->Release();

Graphics_RenderFullScreenQuad(g_pRTTexture);

// Present the backbuffer contents to the display
g_pd3dDevice->Present(NULL, NULL, NULL, NULL);
}







When i run only RenderScene() without changing the RT, everything draws fine, the DrawFullScreenQuad() is ok too, i've tested it with a custom texture to validade UV coords and it's ok...

Now, the problem is, when i render the scene to the RT and draw the quad with the RT texture i only got the correct draw in the first frame, the others are empty (RenderScene's Clear color only), the little rectangle disappears. I checked all the DirectX Calls and none fails. I have also compared the code with Shadow Mapping example in DirectX SDK but is almost identical.

PS.: I have an Update() method before Graphics_Render() to reset rectangle's world matrix, and to make it rotate.

[Edited by - Key_46 on August 6, 2010 12:57:00 PM]

Problem using transparency in textures

01 April 2009 - 12:32 PM

Hi, in my program (on windows vista) i am loading a 32-bit PNG image using SDL_Image and rendering it in a quad, but i can't get the Alpha map to work. Load texture:
SDL_Surface* img = IMG_Load(file);

glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
SDL_PixelFormat* format = img->format;

GLint level = 0;
if(format->Amask)
{
	level = GL_RGBA;
}
else
{
	level = GL_RGB;
}

glGenTextures(1, pOut);
glBindTexture(GL_TEXTURE_2D, *pTextures[0]);
	glTexImage2D(GL_TEXTURE_2D,0,level,img->w,img->h,0,level,GL_UNSIGNED_BYTE,(GLvoid*)img->pixels);
Rendering:
glBindTexture(GL_TEXTURE_2D, pTextures[0]);
glDisable( GL_DEPTH_TEST );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
//already tested with GL_ONE

glBegin(GL_QUAD_STRIP);

glTexCoord2f(0,0);
glVertex2f(l, t);

glTexCoord2f(0,1);
glVertex2f(l, b);

glTexCoord2f(1,0);
glVertex2f(r, t);

glTexCoord2f(1,1);
glVertex2f(r, b);

glEnd();
SDL_GL_SwapBuffers();

Problem With NVIDIA CUDA: nvcuda.dll not found

22 November 2008 - 11:13 PM

Hi, i have an ASUS g50vt notebook with a GeForce 9800M GS and i decided to install some development tool, all tools are working fine (including PhysX Hardware simulations), except CUDA, when i run the video decoder example from the SDK i get a "nvcuda.dll not found" error, some other examples run in device emulation mode. The Device Query example only shows my CPU as CUDA Capable. I am using Windows Vista Home Premium with driver 179.14, and nvcuda.dll is located in C:\Windows\SysWOW64. i've already tried to uninstall driver and install it again, the same with Toolkit and CUDA SDK (in this exact order), but with no success. What is the problem? How to solve it? Thanks. The info report: [Display] Processor: Intel® Core™2 Duo CPU P8400 @ 2.26GHz (2261 MHz) Operating System: Windows Vista ™ Home Premium, 64-bit (Service Pack 1) DirectX version: 10.0 GPU processor: GeForce 9800M GT (i don't know why it says GT, the notebook specs says GS) Driver version: 179.14 Stream processors: 64 Core clock: 530 MHz Shader clock: 1325 MHz Memory clock: 799 MHz (1598 MHz data rate) Memory interface: 256-bit Total available graphics memory: 2303 MB Dedicated video memory: 512 MB System video memory: 0 MB Shared system memory: 1791 MB Video BIOS version: 62.94.3C.00.01 IRQ: 16 Bus: PCI Express x1 [Components] nvCplUIR.dll 2.2.250.00 NVIDIA Control Panel nvCpl.cpl 2.2.250.00 NVIDIA Control Panel Applet nvExpBar.dll 1.5.740.18 NVIDIA Control Panel nvCplUI.exe 2.2.250.00 NVIDIA Control Panel nvViTvSR.dll 7.15.11.7914 NVIDIA Video and TV Server nvViTvS.dll 7.15.11.7914 NVIDIA Video and TV Server nvDispSR.dll 7.15.11.7914 NVIDIA Display Server NVMCTRAY.DLL 7.15.11.7914 NVIDIA Media Center Library nvDispS.dll 7.15.11.7914 NVIDIA Display Server NVCPL.DLL 7.15.11.7914 NVIDIA Compatible Windows Vista Display driver, Version 179.14 nvGameSR.dll 7.15.11.7914 NVIDIA 3D Settings Server nvGameS.dll 7.15.11.7914 NVIDIA 3D Settings Server

PARTNERS