Package d3d11.tutorials

Examples of d3d11.tutorials.Tutorial2Ex


    ppRTV.set(pointerTo(rtView));
    immediateContext.OMSetRenderTargets(1, ppRTV, null);
    ppRTV.release();
   
    // Set viewport
    D3D11_VIEWPORT vp = new D3D11_VIEWPORT();
    vp.Width(800).Height(600).MinDepth(0).MaxDepth(1).TopLeftX(0).TopLeftY(0);
    immediateContext.RSSetViewports(1, pointerTo(vp));
   
    // Clear screen with some color
    final Pointer<Float> pColor = allocateFloats(4).setFloats(new float[] {0.7f, 0.8f, 0.3f, 1.0f});
   
View Full Code Here


    ID3D11Texture2D backBuffer = swapChain.GetBuffer(0, ID3D11Texture2D.class);
    final ID3D11RenderTargetView rtView = device.CreateRenderTargetView(backBuffer, null);
    backBuffer.Release();

    immediateContext.OMSetRenderTargets(rtView, null);
    immediateContext.RSSetViewport(new D3D11_VIEWPORT(frame.getWidth(), frame.getHeight()));
   
    // Shader
    String shaders = "float4 VS( float4 Pos : POSITION ) : SV_POSITION    \n" +
             "{                            \n" +
             "  return Pos;                      \n" +
View Full Code Here

    ID3D11Texture2D backBuffer = swapChain.GetBuffer(0, ID3D11Texture2D.class);
    final ID3D11RenderTargetView rtView = device.CreateRenderTargetView(backBuffer, null);
    backBuffer.Release();

    immediateContext.OMSetRenderTargets(rtView, null);
    immediateContext.RSSetViewport(new D3D11_VIEWPORT(frame.getWidth(), frame.getHeight()));
   
    // Shader
    String shaders =   "cbuffer perFrame : register( b0 )            \n" +
              "{                            \n" +
              "  matrix world;                    \n" +
View Full Code Here

                  Flags1,
                  Flags2,
                  ppCode,
                  ppErrors);
      if(result != 0) {
        ID3D10Blob errors = ppErrors.get().getNativeObject(ID3D10Blob.class);
        if(errors != null) {
          Pointer<Byte> pMessage = allocateArray(Byte.class, errors.GetBufferSize());
          errors.GetBufferPointer().copyBytesTo(pMessage, errors.GetBufferSize());
         
          errors.Release();
          throw new D3DCompilerException(pMessage.getCString(), result);
        }
      }
     
      return ppCode.get().getNativeObject(ID3D10Blob.class);
View Full Code Here

    Pointer<Pointer<ID3D10Blob>> ppCode = allocatePointer(ID3D10Blob.class);
    Pointer<Pointer<ID3D10Blob>> ppErrorMsgs = allocatePointer(ID3D10Blob.class);
    int result = D3DCompile(pointerToCString(vertexShader), vertexShader.length(), null, null, null, pointerToCString("VS"), pointerToCString("vs_5_0"), 0, 0, ppCode, ppErrorMsgs);
    assertEquals(0, result);
   
    ID3D10Blob vsCode = ppCode.get().getNativeObject(ID3D10Blob.class);
    Pointer<Pointer<ID3D11VertexShader>> ppVS = allocatePointer(ID3D11VertexShader.class);
    result = device.CreateVertexShader(vsCode.GetBufferPointer(), (int)vsCode.GetBufferSize(), null, ppVS);
    assertEquals(0, result);
   
    ID3D11VertexShader vs = ppVS.get().getNativeObject(ID3D11VertexShader.class);
    result = vs.Release();
    assertEquals(0, result);
View Full Code Here

    Pointer<Pointer<ID3D10Blob>> ppCode = allocatePointer(ID3D10Blob.class);
    Pointer<Pointer<ID3D10Blob>> ppErrorMsgs = allocatePointer(ID3D10Blob.class);
    int result = D3DCompile(pointerToCString(vertexShader), vertexShader.length(), null, null, pointerTo(handler), pointerToCString("VS"), pointerToCString("vs_5_0"), 0, 0, ppCode, ppErrorMsgs);
    assertEquals(0, result);

    ID3D10Blob vsCode = ppCode.get().getNativeObject(ID3D10Blob.class);
    Pointer<Pointer<ID3D11VertexShader>> ppVS = allocatePointer(ID3D11VertexShader.class);
    result = device.CreateVertexShader(vsCode.GetBufferPointer(), (int)vsCode.GetBufferSize(), null, ppVS);
    assertEquals(0, result);

    ID3D11VertexShader vs = ppVS.get().getNativeObject(ID3D11VertexShader.class);
    result = vs.Release();
    assertEquals(0, result);
View Full Code Here

             "{                            \n" +
             "  return float4( 0.0f, 1.0f, 0.0f, 1.0f );      \n" +
             "}";
   
    // Compiling for vertex shader and input layout
    ID3D10Blob code = D3DCompile(shaders, null, null, null, "VS", "vs_5_0", 0, 0);
   
    // Create input layout
    D3D11_INPUT_ELEMENT_DESC layoutDesc = new D3D11_INPUT_ELEMENT_DESC("POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0);
    final ID3D11InputLayout layout = device.CreateInputLayout(new D3D11_INPUT_ELEMENT_DESC[] { layoutDesc }, code);
    immediateContext.IASetInputLayout(layout);
   
    // Creating vertex shader
    final ID3D11VertexShader vs = device.CreateVertexShader(code, null);
    code.Release();
   
    // Creating pixel shader
    code = D3DCompile(shaders, null, null, null, "PS", "ps_5_0", 0, 0);
    final ID3D11PixelShader ps = device.CreatePixelShader(code, null);
    code.Release();
   
    // Create vertex buffer
    D3D11_BUFFER_DESC bufferDesc = new D3D11_BUFFER_DESC(D3D11_BIND_VERTEX_BUFFER,
                               D3D11_USAGE_DEFAULT,
                               D3D11_CPU_ACCESS_NONE,
View Full Code Here

              "{                            \n" +
              "  return float4( 0.0f, 1.0f, 0.0f, 1.0f );      \n" +
              "}";
   
    // Compiling for vertex shader and input layout
    ID3D10Blob code = D3DCompile(shaders, null, null, null, "VS", "vs_5_0", 0, 0);
   
    // Create input layout
    D3D11_INPUT_ELEMENT_DESC layoutDesc = new D3D11_INPUT_ELEMENT_DESC("POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0);
    final ID3D11InputLayout layout = device.CreateInputLayout(new D3D11_INPUT_ELEMENT_DESC[] { layoutDesc }, code);
    immediateContext.IASetInputLayout(layout);
   
    // Creating vertex shader
    final ID3D11VertexShader vs = device.CreateVertexShader(code, null);
    code.Release();
   
    // Creating pixel shader
    code = D3DCompile(shaders, null, null, null, "PS", "ps_5_0", 0, 0);
    final ID3D11PixelShader ps = device.CreatePixelShader(code, null);
    code.Release();
   
    // Create vertex buffer
    D3D11_BUFFER_DESC bufferDesc = new D3D11_BUFFER_DESC(D3D11_BIND_VERTEX_BUFFER,
                               D3D11_USAGE_DEFAULT,
                               D3D11_CPU_ACCESS_NONE,
View Full Code Here

              null,
              pDeviceContext);
   
    assertEquals(0, result);
   
    device = new ID3D11Device(pDevice.get());
    immediateContext = new ID3D11DeviceContext(pDeviceContext.get());
  }
View Full Code Here

        null,
        pDeviceContext);

    assertEquals(0, result);

    device = new ID3D11Device(pDevice.get());
    immediateContext = new ID3D11DeviceContext(pDeviceContext.get());
  }
View Full Code Here

TOP

Related Classes of d3d11.tutorials.Tutorial2Ex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.