summaryrefslogtreecommitdiff
path: root/src/render/gl_2d.h
blob: 25dbd4df4adca46df54624ad2ba402ee8dc2633e (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
#pragma once
#include "gl.h"
#include "gl_batch.h"

using GL_BATCH2D = GL_BATCH<VERTEX>;
extern GL_SHADER_PROGRAM* gl_2d_init( GL_DATA* gl, VEC2 screensize, const char* shadername );


extern void gl_2d_batch_setup( GL_BATCH2D* batch );
extern void gl_2d_line( GL_SHADER_PROGRAM* gl2d, VEC2 start, VEC2 end, CLR col );
extern void gl_2d_rect( GL_SHADER_PROGRAM* gl2d, VEC2 origin, VEC2 dimensions, CLR col );
extern void gl_2d_frect( GL_SHADER_PROGRAM* gl2d, VEC2 origin, VEC2 dimensions, CLR col );
extern void gl_2d_circle( GL_SHADER_PROGRAM* gl2d, VEC2 origin, F32 radius, CLR col, U32 res = 48 );
extern void gl_2d_fcircle( GL_SHADER_PROGRAM* gl2d, VEC2 origin, F32 radius, CLR col, U32 res = 48 );
extern void gl_2d_polygon( GL_SHADER_PROGRAM* gl2d, VERTEX* vertices, U32 vertices_count );
extern void gl_2d_textured_polygon(
  GL_SHADER_PROGRAM* gl2d,
  VERTEX* vertices,
  U32 vertices_count,
  GL_TEX2D* tex
);
extern void gl_2d_textured_frect(
  GL_SHADER_PROGRAM* gl2d,
  VEC2 origin,
  VEC2 dim,
  GL_TEX2D* texture,
  CLR col = { 1.f, 1.f, 1.f, 1.f },
  VEC2* uv = 0,
  F32 rotation = 0.F
);

extern void gl_2d_line( GL_BATCH2D* batch, VEC2 start, VEC2 end, CLR col );
extern void gl_2d_rect( GL_BATCH2D* batch, VEC2 origin, VEC2 dimensions, CLR col );
extern void gl_2d_frect( GL_BATCH2D* batch, VEC2 origin, VEC2 dimensions, CLR col );
extern void gl_2d_circle( GL_BATCH2D* batch, VEC2 origin, F32 radius, CLR col, U32 res = 48 );
extern void gl_2d_fcircle( GL_BATCH2D* batch, VEC2 origin, F32 radius, CLR col, U32 res = 48 );
extern void gl_2d_polygon( GL_BATCH2D* batch, VERTEX* vertices, U32 vertices_count );
extern void gl_2d_textured_polygon(
  GL_BATCH2D* batch,
  VERTEX* vertices,
  U32 vertices_count,
  GL_TEX2D* tex
);
extern void gl_2d_textured_frect(
  GL_BATCH2D* batch,
  VEC2 origin,
  VEC2 dim,
  GL_TEX2D* texture,
  CLR col = { 1.f, 1.f, 1.f, 1.f },
  VEC2* uv = 0,
  F32 rotation = 0.F
);