My Project
RenderDeviceOpenGL.h
1 #pragma once
2 #include "RenderDevice.h"
3 
4 namespace ParaEngine
5 {
10  class RenderDevice : public RenderDeviceBase
11  {
12  public:
13  RenderDevice();
14  static RenderDevice* GetInstance();
15 
16  static HRESULT DrawPrimitive(RenderDevicePtr pd3dDevice, int nStatisticsType, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount);
17 
18  static HRESULT DrawPrimitiveUP(RenderDevicePtr pd3dDevice, int nStatisticsType,
19  D3DPRIMITIVETYPE PrimitiveType,
20  UINT PrimitiveCount,
21  const void* pVertexStreamZeroData,
22  UINT VertexStreamZeroStride);
23 
24 
25  static HRESULT DrawIndexedPrimitive(RenderDevicePtr pd3dDevice, int nStatisticsType, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex, UINT NumVertices, UINT indexStart, UINT PrimitiveCount);
26 
27  static HRESULT DrawIndexedPrimitiveUP(RenderDevicePtr pd3dDevice, int nStatisticsType,
28  D3DPRIMITIVETYPE PrimitiveType,
29  UINT MinVertexIndex,
30  UINT NumVertices,
31  UINT PrimitiveCount,
32  const void * pIndexData,
33  D3DFORMAT IndexDataFormat,
34  const void* pVertexStreamZeroData,
35  UINT VertexStreamZeroStride);
36 
38  static bool CheckRenderError(const char* filename = NULL, const char* func = NULL, int nLine = 0);
39 
42  static bool ReadPixels(int nLeft, int nTop, int nWidth, int nHeight, void* pDataOut, DWORD nDataFormat = 0, DWORD nDataType = 0);
43 
44  public:
45  HRESULT RendererRecreated();
46 
47  HRESULT SetRenderState(D3DRENDERSTATETYPE State, DWORD Value);
48  HRESULT SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value);
49  HRESULT SetClipPlane(DWORD Index, const float* pPlane);
50  HRESULT SetTexture(DWORD Stage, DeviceTexturePtr_type pTexture);
51  HRESULT SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value);
52  HRESULT GetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue);
53  HRESULT SetIndices(IndexBufferDevicePtr_type pIndexData);
54  HRESULT SetStreamSource(UINT StreamNumber, VertexBufferDevicePtr_type pStreamData, UINT OffsetInBytes, UINT Stride);
55  HRESULT SetTransform(D3DTRANSFORMSTATETYPE State, DeviceMatrix_ptr pMatrix);
56  HRESULT SetFVF(DWORD FVF);
57  void SetCursorPosition(int X, int Y, DWORD Flags);
58  HRESULT SetVertexDeclaration(VertexDeclarationPtr pDecl);
59  HRESULT CreateVertexDeclaration(VertexElement* pVertexElements, VertexDeclarationPtr* ppDecl);
60  HRESULT BeginScene();
61  HRESULT EndScene();
62  HRESULT Clear(DWORD Count, const void* pRects, DWORD Flags, DWORD Color, float Z, DWORD Stencil);
63 
64  HRESULT SetViewport(const D3DVIEWPORT9* pViewport);
65  HRESULT GetViewport(D3DVIEWPORT9* pViewport);
66 
67  HRESULT SetScissorRect(RECT* pRect);
68  HRESULT GetScissorRect(RECT* pRect);
69 
71  void BeginRenderTarget(int nWidth, int nHeight);
72  void EndRenderTarget();
73  bool IsUsingRenderTarget();
74  public:
75  // following function is unique to opengl renderer
76  static uint32 GetStencilBits();
77 
78 
79  protected:
80  void GetScreenSize(int &nScreenWidth, int &nScreenHeight);
81  static void ApplyBlendingModeChange();
82  };
83 }
different physics engine has different winding order.
Definition: EventBinding.h:32
Definition: ManagedDef.h:18
Definition: minilua.c:225
void BeginRenderTarget(int nWidth, int nHeight)
this is only used by Opengl render target.
Definition: RenderDeviceOpenGL.cpp:455
static bool ReadPixels(int nLeft, int nTop, int nWidth, int nHeight, void *pDataOut, DWORD nDataFormat=0, DWORD nDataType=0)
read a block of pixels from the frame buffer this emulate: glReadPixels().
Definition: RenderDeviceOpenGL.cpp:710
static bool CheckRenderError(const char *filename=NULL, const char *func=NULL, int nLine=0)
check render error and print to log.
Definition: RenderDeviceOpenGL.cpp:385