0,
(int)(9 * sizeOf(Float.class)));
D3D11_SUBRESOURCE_DATA initData = new D3D11_SUBRESOURCE_DATA();
initData.pSysMem(pointerToFloats(0.0f, 1.0f, 0.5f, 1f, -0.5f, 0.5f, -0.5f, -0.5f, 0.5f));
initData.SysMemPitch(0).SysMemSlicePitch(0);
final ID3D11Buffer vertexBuffer = device.CreateBuffer(bufferDesc, initData);
JNIEnv env = JAWTUtils.getJNIEnv();
JAWT jawt = JAWTUtils.getJAWT(env);
while(frame.isEnabled()) {
if(frame.isVisible())
JAWTUtils.withLockedSurface(env, jawt, frame, new LockedComponentRunnable() {
@Override
public void run(Component comp, long peer) {
immediateContext.ClearRenderTargetView(pointerTo(rtView), pointerToFloats(0.0f, 0.125f, 0.3f, 1.0f));
int stride = (int) (sizeOf(Float.class) * 3);
immediateContext.IASetVertexBuffers(0, 1, pointerToPointer(pointerTo(vertexBuffer)), pointerToInt(stride), pointerToInt(0));
immediateContext.IASetInputLayout(layout);
immediateContext.VSSetShader(pointerTo(vs), null, 0);
immediateContext.PSSetShader(pointerTo(ps), null, 0);
immediateContext.IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
immediateContext.Draw(3, 0);
swapChain.Present(0, 0);
}
});
try {
Thread.sleep(5);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
vs.Release();
ps.Release();
layout.Release();
vertexBuffer.Release();
swapChain.Release();
device.Release();
}