summaryrefslogtreecommitdiffstats
path: root/src/k9glwidget.h
blob: 91bac852506198d50d6383405731be13e48fc0f4 (plain)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//
// C++ Interface: k9glwidget
//
// Description: 
//
//
// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2006
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef K9GLWIDGET_H
#define K9GLWIDGET_H

#include "k9common.h"

#ifdef Q_MOC_RUN
#define HAVE_OPENGL
#endif // Q_MOC_RUN

#ifdef HAVE_OPENGL

#include <tqimage.h>
#include <tqlibrary.h>
#include <tqgl.h>
#include <tqmutex.h>

typedef void (*glClear_t) (GLbitfield);
typedef void (*glRasterPos2i_t) ( GLint , GLint );
typedef void (*glPixelZoom_t) ( GLfloat , GLfloat );
typedef void (*glDrawPixels_t) ( GLsizei , GLsizei, GLenum , GLenum ,const GLvoid * );
typedef void (* glFlush_t) ( void );
typedef void (*glClearColor_t)( GLclampf , GLclampf , GLclampf , GLclampf  );
typedef void (*glShadeModel_t) ( GLenum );
typedef void (*glPixelStorei_t)( GLenum , GLint  );
typedef void (*glViewport_t) ( GLint, GLint,GLsizei , GLsizei);
typedef void (*glMatrixMode_t)( GLenum );
typedef void (*glLoadIdentity_t) (void);
typedef void (*glOrtho_t)( GLdouble , GLdouble ,GLdouble , GLdouble, GLdouble , GLdouble);
typedef void (*glDisable_t) ( GLenum );
typedef void (*glPixelTransferi_t) ( GLenum , GLint );
typedef const GLubyte * (*glGetString_t)( GLenum );
/**
	@author Jean-Michel PETIT <k9copy@free.fr>
*/
class k9GLWidget : public TQGLWidget
{
Q_OBJECT
  
public:
    void setImage(uchar *_buffer,int _width,int _height,int _len);
    static k9GLWidget * createWidget(TQWidget *parent = 0, const char *name = 0);
    ~k9GLWidget();
protected:
	void draw();
        void resizeGL(int width, int height);
	void initializeGL();
   	void paintGL();
private:
        k9GLWidget(TQWidget *parent = 0, const char *name = 0);
	TQImage m_image;
	TQMutex m_mutex;
	int m_width,m_height;
	uchar *m_buffer;
	TQLibrary * library;
	glClear_t glClear;
	glRasterPos2i_t glRasterPos2i;

	glPixelZoom_t glPixelZoom;
	glDrawPixels_t glDrawPixels;
	glFlush_t glFlush;
	glClearColor_t glClearColor;
	glShadeModel_t glShadeModel;
	glPixelStorei_t glPixelStorei;
	glViewport_t glViewport;
	glMatrixMode_t glMatrixMode;
	glLoadIdentity_t glLoadIdentity;
	glOrtho_t glOrtho;
        glDisable_t glDisable;
	glPixelTransferi_t glPixelTransferi;
	glGetString_t glGetString;
};

#else

#include <tqwidget.h>
#include <tqimage.h>

class k9GLWidget:public TQWidget
{
public:
    static k9GLWidget * createWidget(TQWidget *parent = 0, const char *name = 0) {
	return new k9GLWidget(parent,name);
    }
    void setImage(uchar *_buffer,int _width,int _height,int _len){};
private:
    k9GLWidget(TQWidget *parent = 0, const char *name = 0){};

};


#endif
#endif