File: GlDriver.hpp

package info (click to toggle)
openlayer 2.1-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,368 kB
  • ctags: 2,295
  • sloc: ansic: 10,432; cpp: 9,890; xml: 109; makefile: 89; sh: 36
file content (84 lines) | stat: -rw-r--r-- 2,591 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef GL_DRIVER_HPP
#define GL_DRIVER_HPP

#include "Includes.hpp"
#include "Internal.hpp"
#include "Vec2D.hpp"
#include "Setup.hpp"
#include "Rgba.hpp"
#include "Declspec.hpp"

#include <string>


// The OpenGL driver routines //


namespace ol {


class OlTextureInfo;


class OL_LIB_DECLSPEC GlDriver {
public:

	virtual ~GlDriver(){}

   virtual bool SetupProgram( bool setupKeyboard, bool setupMouse, bool setupTimer ) = 0;
   virtual bool SetupScreen( int width, int height, bool fullscreen,
                             int colorDepth, int zDepth, int refreshRate ) = 0;

   virtual OlTextureInfo UploadTexture( OL_MEMORY_IMG *bmp, bool isSolid ) = 0;
   virtual OlTextureInfo UploadTexture( float *data, OlTextureInfo textureInfo ) = 0;

   virtual OL_MEMORY_IMG *GetMemoryBitmap( int width, int height, int bpp, unsigned char *pixelData ) = 0;
   virtual int GetImageColorDepth( OL_MEMORY_IMG *bmp ) = 0;
   virtual bool SaveMemoryBitmap( OL_MEMORY_IMG *bmp, std::string filename ) = 0;
   virtual void DestroyMemoryBitmap( OL_MEMORY_IMG *bmp ) = 0;
   virtual Rgba GetPixel( OL_MEMORY_IMG *img, int x, int y ) = 0;
   
   virtual std::string GetExecutablePath() = 0;
   virtual std::string ToAbsolutePathname( std::string pathname ) = 0;

   static void Set( GlDriver *driver );
   static GlDriver *Get();

   static bool IsExtensionAlvailable( std::string extensionName );

   //static glEnum GetBytesPerPixel( glEnum textureFormat, int colorDepth = Setup::GetColorDepth() );

protected:
   
   const static std::string TEXTURE_NOT_POWER_OF_TWO_EXT;

private:
   static GlDriver *activeDriver;
};



class OL_LIB_DECLSPEC AllegroGLDriver : public GlDriver {
public:
	virtual ~AllegroGLDriver(){}
   virtual bool SetupProgram( bool setupKeyboard, bool setupMouse, bool setupTimer );
   virtual bool SetupScreen( int width, int height, bool fullscreen,
                             int colorDepth, int zDepth, int refreshRate );
   virtual OlTextureInfo UploadTexture( OL_MEMORY_IMG *bmp, bool isSolid );
   virtual OlTextureInfo UploadTexture( GLfloat *data, OlTextureInfo textureInfo );

   virtual OL_MEMORY_IMG *GetMemoryBitmap( int width, int height, int bpp, unsigned char *pixelData );
   virtual int GetImageColorDepth( OL_MEMORY_IMG *bmp );
   virtual bool SaveMemoryBitmap( OL_MEMORY_IMG *bmp, std::string filename );
   virtual void DestroyMemoryBitmap( OL_MEMORY_IMG *bmp );
   virtual Rgba GetPixel( OL_MEMORY_IMG *img, int x, int y );
   
   virtual std::string GetExecutablePath();
   virtual std::string ToAbsolutePathname( std::string pathname );
};



}

#endif