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

📄 videomanrendererogl.h

📁 VideoMan is a very easy image acquisition library. It is able to manage many video inputs at the sam
💻 H
字号:
#pragma once
#include <windows.h>
#include <gl\gl.h>
#include "VideoManRenderer.h"
#include <vector>
#include <assert.h>

#pragma comment(lib,"opengl32.lib")


//#include <gl\glu.h>
//#include <gl\glut.h>

/** 
	SUPPORTED FORMATS:
	-RGB24, BGR24
	-RGB32, BGR32
	-GREY16			
	-GREY8
*/


class RendererOGLInput : 
	public RendererInput
{
public:
	RendererOGLInput( void );
	virtual ~RendererOGLInput( void );

	GLuint texture;
	float tu1,tu2,tv1,tv2; //texture coordinates		
	unsigned int oglTextureFormat; //RGB24 RGB32
	unsigned int internalFormat;
	GLenum dataType;
	
};


class VideoManRendererOGL :
	public VideoManRenderer
{
public:
	VideoManRendererOGL(void);
	virtual ~VideoManRendererOGL(void);

	bool addVideoInput( VideoInput *video );
	inline void renderInputs();
	inline void renderInput( size_t v );
	inline void updateTexture( size_t v, const char *image );
	inline void updateTexture( size_t v );

	void deleteVideoInput( size_t inputIndex );
	
	/** \brief Activate all the video inputs. In the next render all the inputs will be shown		
	*/
	void activateAllVideoInputs();

	/** \brief Activate the video input number v. In the next render only this input will be shown
		\param v [in] The video input index		
	*/
	void activateVideoInput( size_t v );

	/** \brief Deactivate all the video inputs. In the next render any of the inputs will be shown
	*/
	void deactivateAllVideoInputs();

	/** \brief Deactivate the video input number v. In the next render this input will not be shown
		\param v [in] The video input index
	*/
	void deactivateVideoInput( size_t v );

	/** \brief Check if this video input is activated or not
		\param v [in] the video input index
	*/
	bool isActivated( size_t v );

	void changeVisualizationMode( int vM );

	void changeMainVisualizationInput( const size_t &v );
	
	/** \brief Notify to the renderer the change of the screen
		\param left [in] the x coordinate of the top left corner of the region where the renderer must draw
		\param bottom [in] the y coordinate of the bottom left corner of the region where the renderer must draw
		\param width [in] the width of the region where the renderer must draw
		\param height [in] the height of the region where the renderer must draw
	*/
	void changeScreenSize( int left, int bottom, int width, int height );	 

	void calculateAspectRatio( int left, int bottom, int width, int height, size_t index );

	void changeScreenSizeV0( int left, int bottom, int width, int height );

	void changeScreenSizeV1( int left, int bottom, int width, int height );

	int screenToImageCoords( float &x, float &y );	
	bool imageToScreenCoords( const size_t &v, float &x, float &y );
	bool getScreenCoords( const size_t &v, int &left, int &bottom, int &width, int &height );

	/** \brief Get the coordinates of the input texture
		\param input [in] the video input index
		\param left,up,right,bottom [out] the texture coordinates
	*/
	void getTextureCoords( const size_t &input, float &left, float &bottom, float &right, float &up );

	/** \brief Activate the renderer viewport of this video input
		\param v [in] the video input index
	*/
	inline void activateViewport( const size_t &v );

	/** \brief Activate the renderer texture of this video input
		\param v [in] the video input index
	*/
	inline void activateTexture( const size_t &v );

	void setVerticalFlip( const size_t &v, bool value );

	bool getVerticalFlip( const size_t &v );

	void setHorizontalFlip( const size_t &v, bool value );

	bool getHorizontalFlip( const size_t &v );


private:

	bool generateTexture( RendererInput *input );
		
	std::vector<RendererOGLInput> inputList;
};

⌨️ 快捷键说明

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