Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ImageGLCanvas.h
1 //
2 // VTBuilder ImageGLCanvas.h
3 //
4 // Copyright (c) 2001-2012 Virtual Terrain Project
5 // Free for all uses, see license.txt for details.
6 //
7 
8 #ifndef HELPERH
9 #define HELPERH
10 
11 #include "vtdata/Projections.h"
12 #include "vtdata/MathTypes.h"
13 
15 class vtMiniDatabuf;
16 class ImageGLCanvas;
17 class TilingOptions;
18 
19 void WriteMiniImage(const vtString &fname, const TilingOptions &opts,
20  uchar *rgb_bytes, vtMiniDatabuf &output_buf,
21  int iUncompressedSize, ImageGLCanvas *pCanvas);
22 void CheckCompressionMethod(TilingOptions &opts);
23 
24 #if USE_OPENGL
25 #include "wx/glcanvas.h"
26 void DoTextureCompress(uchar *rgb_bytes, vtMiniDatabuf &output_buf,
27  GLuint &iTex, bool bAlpha);
28 
29 //
30 // ImageGLCanvas class:
31 // We need to open an OpenGL context in order to do the texture compression,
32 // so we may as well draw something into it, since it requires little extra
33 // work, and provides interesting visual feedback to the user.
34 //
35 class ImageGLCanvas : public wxGLCanvas
36 {
37 public:
38  ImageGLCanvas(wxWindow *parent, const wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
39  const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxT(""),
40  int* gl_attrib = NULL);
41  ~ImageGLCanvas();
42 
43  void OnPaint(wxPaintEvent& event);
44  void OnSize(wxSizeEvent& event);
45  void OnEraseBackground(wxEraseEvent& event) {} // Do nothing, to avoid flashing.
46 
47  GLuint m_iTex;
48  wxGLContext *m_context;
49 protected:
50  DECLARE_EVENT_TABLE()
51 };
52 
53 #endif // USE_OPENGL
54 
55 #if SUPPORT_SQUISH
56 void DoTextureSquish(uchar *rgb_bytes, vtMiniDatabuf &output_buf, bool bFast);
57 #endif
58 
59 #endif // HELPERH