Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Screen_GL.h
Go to the documentation of this file.
1 // Screen_GL.h
3 // OpenGL Screen implmentation
4 //
6 
7 #ifndef _SCREEN_GL
8 #define _SCREEN_GL
9 
10 #include <gl\freeglut.h>
11 #include "framework\Frm_Material.h"
12 #include "GL\Manager_Texture.h"
13 
14 class Screen_GL
15 {
16  public:
17  Screen_GL(void):_Gfx2D(false){};
18  ~Screen_GL(void){};
19  bool Init(void);
20  void Shape(uint16 pw, uint16 ph);
21  void Start_Draw(void){ClearScreen();};
22  void End_Draw(void){glutSwapBuffers();};
23  void SetColor(uchar pr, uchar pg, uchar pb){glColor4f(pr/255, pg/255, pb/255, 1.0f);};
24  void SetFont(void* pFont);
25  void Print(std::string pText, Frm::Vertex pV);
26  void PrintFPS(uint32 pDelta);
27 
28  void SelectTexture(uint16 pID){glBindTexture(GL_TEXTURE_2D, _TxtMgr.GetID(pID));};
29  void SetMaterial(Frm::Material* &pMaterial);
30 
31  void TwoD(void);
32  void ThreeD(void);
33 
34  bool Load(uchar pType, std::string &pFileName);
35  bool Unload(uchar pType, uint16 pIndex);
36  uint16 SetTextureID(std::string &pFileName){return _TxtMgr.SetTexture(pFileName);};
37  void Reset(void); //reloads Textures
39 
40  //Methods for texture conversions on loading (temporary)
41  void SetTargetType(uchar pTargetType){_TxtMgr.SetTargetType(pTargetType);};
42  void SetTranspColor(uchar pr, uchar pg, uchar pb){_TxtMgr.SetTranspColor(pr, pg, pb);};
43 
44  private:
45  bool _Gfx2D; //tells the type of projection: 2D or 3D
46  void ClearScreen(void);
47  bool InitGLScene(GLvoid);
48 
49  void* _cFont; //current glut font
50  bool BitmapFont;
51 
52  //Specialized Texture Manager for OpenGL
53  Manager_Texture _TxtMgr;
54 };
55 
56 #endif
Definition: Frm_Material.h:14
Definition: Manager_Texture.h:22
const GLuint GetID(uint16 pIndex)
Definition: Manager_Texture.h:32
void SetTranspColor(uchar pr, uchar pg, uchar pb)
Definition: Manager_Texture.h:27
void SetTargetType(uchar &pTargetType)
Definition: Manager_Texture.h:26
uint16 SetTexture(std::string &pFileName)
Definition: Manager_Texture.cpp:94
Definition: Screen_GL.h:15
void Reset(void)
~Screen_GL(void)
Definition: Screen_GL.h:18
void TwoD(void)
void PrintFPS(uint32 pDelta)
void ThreeD(void)
bool Load(uchar pType, std::string &pFileName)
uint16 GetRessSize(uchar pType)
void End_Draw(void)
Definition: Screen_GL.h:22
void SetTranspColor(uchar pr, uchar pg, uchar pb)
Definition: Screen_GL.h:42
bool Unload(uchar pType, uint16 pIndex)
void Shape(uint16 pw, uint16 ph)
void SetFont(void *pFont)
void SetColor(uchar pr, uchar pg, uchar pb)
Definition: Screen_GL.h:23
uint16 SetTextureID(std::string &pFileName)
Definition: Screen_GL.h:36
void Start_Draw(void)
Definition: Screen_GL.h:21
void SelectTexture(uint16 pID)
Definition: Screen_GL.h:28
Screen_GL(void)
Definition: Screen_GL.h:17
void SetMaterial(Frm::Material *&pMaterial)
bool Init(void)
void SetTargetType(uchar pTargetType)
Definition: Screen_GL.h:41
void Print(std::string pText, Frm::Vertex pV)
void glutSwapBuffers(void)
unsigned short int uint16
Definition: Frm_types.h:14
unsigned char uchar
Definition: Frm_types.h:16
unsigned long int uint32
Definition: Frm_types.h:15