File: GLPrimitiveRenderer.h

package info (click to toggle)
bullet 2.83.7%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 48,772 kB
  • sloc: cpp: 355,312; lisp: 12,087; ansic: 11,969; python: 644; makefile: 116; xml: 27
file content (67 lines) | stat: -rw-r--r-- 1,289 bytes parent folder | download
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
#ifndef _GL_PRIMITIVE_RENDERER_H
#define _GL_PRIMITIVE_RENDERER_H

//#include "OpenGLInclude.h"

struct PrimVec2
{
	PrimVec2(float x, float y)
	{
		p[0] = x;
		p[1] = y;
	}
	float p[2];
};

struct PrimVec4
{
	PrimVec4() {}
	PrimVec4(float x,float y, float z, float w)
	{
		p[0] = x;
		p[1] = y;
		p[2] = z;
		p[3] = w;
        
	}
    
	float p[4];
};

typedef struct
{
    PrimVec4 position;
    PrimVec4 colour;
	PrimVec2 uv;
} PrimVertex;


class GLPrimitiveRenderer
{
    int m_screenWidth;
    int m_screenHeight;

	struct PrimInternalData*	m_data;
    
    void loadBufferData();
    
public:
    
    GLPrimitiveRenderer(int screenWidth, int screenHeight);
    virtual ~GLPrimitiveRenderer();
	
	void drawRect(float x0, float y0, float x1, float y1, float color[4]);
    void drawTexturedRect(float x0, float y0, float x1, float y1, float color[4], float u0,float v0, float u1, float v1, int useRGBA=0);
	void drawTexturedRect3D(const PrimVertex& v0,const PrimVertex& v1,const PrimVertex& v2,const PrimVertex& v3,float viewMat[16],float projMat[16], bool useRGBA = true);
    void drawLine();//float from[4], float to[4], float color[4]);
    void setScreenSize(int width, int height);
    
	PrimInternalData*	getData()
	{
		return m_data;
	}

};

#endif//_GL_PRIMITIVE_RENDERER_H