⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pbuffer.h

📁 PDE simulator on GPU.
💻 H
字号:
#ifndef PBUFFERS_H
#define PBUFFERS_H

#include <windows.h>
#include "extgl.h"

#define MAX_ATTRIBS     256
#define MAX_PFORMATS    256

class CFloatPBuffer
{

public: // interface
	CFloatPBuffer(int iWidth, int iHeight);
	~CFloatPBuffer();
	
	//! Call this once before use.  Set bShare to true to share lists, textures, 
	//! and program objects between the render texture context and the 
	//! current active GL context.
	bool Initialize();
	
	// !Begin drawing to the texture. (i.e. use as "output" texture)
	bool BeginCapture();
	// !End drawing to the texture.
	bool EndCapture();

	void Activate();
	void InActivate();
	
	//! Returns the width of the offscreen buffer.
	int GetWidth() const   { return _iWidth;  } 
	//! Returns the width of the offscreen buffer.
	int GetHeight() const  { return _iHeight; }     

	HGLRC        _hGLContext; // Handle to a GL context.
	///
	HPBUFFERARB GetHandle() const { return _hPBuffer;}
	
	//////Query the supported pixel format
	void QueryFormatInfo(int format,int *pformat,unsigned int nformats,int *iattributes);
	void HandleModeSwitch();
protected: // data
	int          _iWidth;     // width of the pbuffer
	int          _iHeight;    // height of the pbuffer
	bool         _bInitialized;
	
	HDC          _hDC;        // Handle to a device context.
	HPBUFFERARB  _hPBuffer;   // Handle to a pbuffer.
	
	HDC          _hPreviousDC;
	HGLRC        _hPreviousContext;
};

bool IsPowerOfTwo(int n);

///////////////////////////////////////////////////////////////////////////////////////
//// GLOBAL variable for all use
extern CFloatPBuffer *resultBuffer;
extern CFloatPBuffer *pbuffer[10];

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -