Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1031857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T13:59:43+00:00 2026-05-16T13:59:43+00:00

I have got a crash at calling function Clearrendertargetview(). Below is the code: HWND

  • 0

I have got a crash at calling function Clearrendertargetview().

Below is the code:

HWND hwnd;

    ID3D10Device* device;
    IDXGISwapChain* swapChain;
    ID3D10RenderTargetView* renderTarget;
    D3D10_VIEWPORT  viewPort;

DXGI_SWAP_CHAIN_DESC swapchaind;

    SecureZeroMemory(&swapchaind, sizeof(DXGI_SWAP_CHAIN_DESC));

    swapchaind.BufferCount = 2;
    swapchaind.OutputWindow = hwnd;
    swapchaind.BufferDesc.Height = height;
    swapchaind.BufferDesc.Width = width;
    swapchaind.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    swapchaind.BufferDesc.RefreshRate.Numerator = 60;
    swapchaind.BufferDesc.RefreshRate.Denominator = 1;
    swapchaind.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
    swapchaind.Windowed = true;
    swapchaind.SampleDesc.Count = 1;
    swapchaind.SampleDesc.Quality = 0;
    device = NULL;
    swapChain = NULL;
    if(FAILED(D3D10CreateDeviceAndSwapChain(NULL,
                                    D3D10_DRIVER_TYPE_HARDWARE,
                                    NULL,
                                    NULL,
                                    D3D10_SDK_VERSION,
                                    &swapchaind,
                                    &swapChain,
                                    &device))) exit(11);

    ID3D10Texture2D*  backbuffer;
    if(FAILED(swapChain->GetBuffer(0, _uuidof(ID3D10Texture2D), (void**)&backbuffer))) exit(12);
    if(FAILED(device->CreateRenderTargetView(backbuffer, NULL, &renderTarget))) exit(13);
    backbuffer->Release();
    device->OMGetRenderTargets(1, &renderTarget, NULL);

    viewPort.Height = height;
    viewPort.Width = width;
    viewPort.MaxDepth = 1.0f;
    viewPort.MinDepth = 0.0f;
    viewPort.TopLeftX = 0;
    viewPort.TopLeftY = 0;

    device->RSSetViewports(1, &viewPort);
float clearColor[4] = {0.0f,0.0f,1.0f,1.0f};
device->ClearRenderTargetView(renderTarget, clearColor); //da crash iz here
renderFunc();//rendering
swapChain->Present(0,0);

Where am I wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T13:59:44+00:00Added an answer on May 16, 2026 at 1:59 pm
    device->OMGetRenderTargets(1, &renderTarget, NULL);
    

    Don’t you rather want

    device->OMSetRenderTargets(1, &renderTarget, NULL);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got this code: function init(){ if (typeof window.jQuery !== 'function') { var
I have got two pages. example.com/php.com and example.com. I use this function to set
I've got a very strange problem recently. I have a code which processes inApp
I have one application and in beta testing i got my application crash but
I have a crash dump of unmanaged C++ code. I opened it with Windbg,
I have some really weird crash here, ive got it before, but i thought
I have often heard that C can crash spectacularly. Recently I got my first
I have an NDK app out on market and got a native crash report
Have got an NSString *str = @12345.6789 and want to find out if there
I have got the requirement to find the core file in multiple box/machine and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.