naev 0.12.5
opengl_render.c File Reference

This file handles the opengl rendering routines. More...

#include "opengl_render.h"
#include "camera.h"
#include "gui.h"
#include "opengl.h"
Include dependency graph for opengl_render.c:

Go to the source code of this file.

Macros

#define OPENGL_RENDER_VBO_SIZE   256

Functions

void gl_beginSolidProgram (mat4 projection, const glColour *c)
void gl_endSolidProgram (void)
void gl_beginSmoothProgram (mat4 projection)
void gl_endSmoothProgram ()
void gl_renderRect (double x, double y, double w, double h, const glColour *c)
 Renders a rectangle.
void gl_renderRectEmpty (double x, double y, double w, double h, const glColour *c)
 Renders a rectangle.
void gl_renderRectH (const mat4 *H, const glColour *c, int filled)
 Renders a rectangle.
void gl_renderCross (double x, double y, double r, const glColour *c)
 Renders a cross at a given position.
void gl_renderTriangleEmpty (double x, double y, double a, double s, double length, const glColour *c)
 Renders a triangle at a given position.
void gl_renderDepthRawH (GLuint depth, const mat4 *projection, const mat4 *tex_mat)
void gl_renderDepthRaw (GLuint depth, uint8_t flags, double x, double y, double w, double h, double tx, double ty, double tw, double th, double angle)
void gl_renderTextureDepthRawH (GLuint texture, GLuint depth, const mat4 *projection, const mat4 *tex_mat, const glColour *c)
void gl_renderTextureDepthRaw (GLuint texture, GLuint depth, uint8_t flags, double x, double y, double w, double h, double tx, double ty, double tw, double th, const glColour *c, double angle)
void gl_renderTextureRawH (GLuint texture, const mat4 *projection, const mat4 *tex_mat, const glColour *c)
 Texture blitting backend.
void gl_renderTextureRaw (GLuint texture, uint8_t flags, double x, double y, double w, double h, double tx, double ty, double tw, double th, const glColour *c, double angle)
 Texture blitting backend.
void gl_renderTexture (const glTexture *texture, double x, double y, double w, double h, double tx, double ty, double tw, double th, const glColour *c, double angle)
 Texture blitting backend.
void gl_renderSDF (const glTexture *texture, double x, double y, double w, double h, const glColour *c, double angle, double outline)
 SDF Texture blitting backend.
void gl_renderTextureInterpolateRawH (GLuint ta, GLuint tb, double inter, const mat4 *projection, const mat4 *tex_mat, const glColour *c)
 Texture blitting backend for interpolated texture.
void gl_renderTextureInterpolate (const glTexture *ta, const glTexture *tb, double inter, double x, double y, double w, double h, double tx, double ty, double tw, double th, const glColour *c)
 Texture blitting backend for interpolated texture.
void gl_gameToScreenCoords (double *nx, double *ny, double bx, double by)
 Converts in-game coordinates to screen coordinates.
mat4 gl_gameToScreenMatrix (mat4 lhs)
 Return a transformation which converts in-game coordinates to screen coordinates.
void gl_screenToGameCoords (double *nx, double *ny, int bx, int by)
 Converts screen coordinates to in-game coordinates.
void gl_renderSprite (const glTexture *sprite, double bx, double by, int sx, int sy, const glColour *c)
 Blits a sprite, position is relative to the player.
void gl_renderSpriteScale (const glTexture *sprite, double bx, double by, double scalew, double scaleh, int sx, int sy, const glColour *c)
 Blits a sprite, position is relative to the player.
void gl_renderSpriteRotate (const glTexture *sprite, double bx, double by, double angle, int sx, int sy, const glColour *c)
 Blits a sprite, position is relative to the player with rotation.
void gl_renderSpriteScaleRotate (const glTexture *sprite, double bx, double by, double scalew, double scaleh, double angle, int sx, int sy, const glColour *c)
 Blits a sprite, position is relative to the player with scaling and rotation.
void gl_renderSpriteInterpolate (const glTexture *sa, const glTexture *sb, double inter, double bx, double by, int sx, int sy, const glColour *c)
 Blits a sprite interpolating, position is relative to the player.
void gl_renderSpriteInterpolateScale (const glTexture *sa, const glTexture *sb, double inter, double bx, double by, double scalew, double scaleh, int sx, int sy, const glColour *c)
 Blits a sprite interpolating, position is relative to the player.
void gl_renderStaticSprite (const glTexture *sprite, double bx, double by, int sx, int sy, const glColour *c)
 Blits a sprite, position is in absolute screen coordinates.
void gl_renderStaticSpriteInterpolate (const glTexture *sa, const glTexture *sb, double inter, double bx, double by, int sx, int sy, const glColour *c)
 Blits a sprite interpolating, position is relative to the player.
void gl_renderStaticSpriteInterpolateScale (const glTexture *sa, const glTexture *sb, double inter, double bx, double by, double scalew, double scaleh, int sx, int sy, const glColour *c)
 Blits a sprite interpolating, position is relative to the player.
void gl_renderScaleSprite (const glTexture *sprite, double bx, double by, int sx, int sy, double bw, double bh, const glColour *c)
 Blits a scaled sprite, position is in absolute screen coordinates.
void gl_renderScale (const glTexture *texture, double bx, double by, double bw, double bh, const glColour *c)
 Blits a texture scaling it.
void gl_renderScaleAspect (const glTexture *texture, double bx, double by, double bw, double bh, const glColour *c)
 Blits a texture scaling it to fit a rectangle, but conserves aspect ratio.
void gl_renderStatic (const glTexture *texture, double bx, double by, const glColour *c)
 Blits a texture to a position.
void gl_renderShader (double x, double y, double w, double h, double r, const SimpleShader *shd, const glColour *c, int center)
 Renders a simple shader.
void gl_renderShaderH (const SimpleShader *shd, const mat4 *H, const glColour *c, int center)
 Renders a simple shader with a transformation.
void gl_renderCircle (double cx, double cy, double r, const glColour *c, int filled)
 Draws a circle.
void gl_renderCircleH (const mat4 *H, const glColour *c, int filled)
 Draws a circle.
void gl_renderLine (double x1, double y1, double x2, double y2, const glColour *c)
 Draws a line.
void gl_clipRect (int x, int y, int w, int h)
 Sets up 2d clipping planes around a rectangle.
void gl_unclipRect (void)
 Clears the 2d clipping planes.
int gl_initRender (void)
 Initializes the OpenGL rendering routines.
void gl_exitRender (void)
 Cleans up the OpenGL rendering routines.

Variables

static gl_vbo * gl_renderVBO = 0
gl_vbo * gl_squareVBO = 0
static gl_vbo * gl_squareEmptyVBO = 0
gl_vbo * gl_circleVBO = 0
static gl_vbo * gl_lineVBO = 0
static gl_vbo * gl_triangleVBO = 0
static int gl_renderVBOtexOffset = 0
static int gl_renderVBOcolOffset = 0

Detailed Description

This file handles the opengl rendering routines.

There are two coordinate systems: relative and absolute.

Relative:

  • Everything is drawn relative to the player, if it doesn't fit on screen it is clipped.
  • Origin (0., 0.) would be ontop of the player.

Absolute:

  • Everything is drawn in "screen coordinates".
  • (0., 0.) is bottom left.
  • (SCREEN_W, SCREEN_H) is top right.

Note that the game actually uses a third type of coordinates for when using raw commands. In this third type, the (0.,0.) is actually in middle of the screen. (-SCREEN_W/2.,-SCREEN_H/2.) is bottom left and (+SCREEN_W/2.,+SCREEN_H/2.) is top right.

Definition in file opengl_render.c.

Macro Definition Documentation

◆ OPENGL_RENDER_VBO_SIZE

#define OPENGL_RENDER_VBO_SIZE   256

Size of VBO.

Definition at line 36 of file opengl_render.c.

Function Documentation

◆ gl_beginSmoothProgram()

void gl_beginSmoothProgram ( mat4 projection)

Definition at line 62 of file opengl_render.c.

◆ gl_beginSolidProgram()

void gl_beginSolidProgram ( mat4 projection,
const glColour * c )

Definition at line 47 of file opengl_render.c.

◆ gl_clipRect()

void gl_clipRect ( int x,
int y,
int w,
int h )

Sets up 2d clipping planes around a rectangle.

Parameters
xX position of the rectangle.
yY position of the rectangle.
wWidth of the rectangle.
hHeight of the rectangle.

Definition at line 1233 of file opengl_render.c.

◆ gl_endSmoothProgram()

void gl_endSmoothProgram ( void )

Definition at line 70 of file opengl_render.c.

◆ gl_endSolidProgram()

void gl_endSolidProgram ( void )

Definition at line 55 of file opengl_render.c.

◆ gl_exitRender()

void gl_exitRender ( void )

Cleans up the OpenGL rendering routines.

Definition at line 1325 of file opengl_render.c.

◆ gl_gameToScreenCoords()

void gl_gameToScreenCoords ( double * nx,
double * ny,
double bx,
double by )

Converts in-game coordinates to screen coordinates.

Parameters
[out]nxNew screen X coord.
[out]nyNew screen Y coord.
bxGame X coord to translate.
byGame Y coord to translate.

Definition at line 608 of file opengl_render.c.

◆ gl_gameToScreenMatrix()

mat4 gl_gameToScreenMatrix ( mat4 lhs)

Return a transformation which converts in-game coordinates to screen coordinates.

Parameters
lhsMatrix to multiply by the conversion matrix.

Definition at line 628 of file opengl_render.c.

◆ gl_initRender()

int gl_initRender ( void )

Initializes the OpenGL rendering routines.

Returns
0 on success.

Definition at line 1258 of file opengl_render.c.

◆ gl_renderCircle()

void gl_renderCircle ( double cx,
double cy,
double r,
const glColour * c,
int filled )

Draws a circle.

Parameters
cxX position of the center in screen coordinates.
cyY position of the center in screen coordinates.
rRadius of the circle.
cColour to use.
filledWhether or not it should be filled.

Definition at line 1175 of file opengl_render.c.

◆ gl_renderCircleH()

void gl_renderCircleH ( const mat4 * H,
const glColour * c,
int filled )

Draws a circle.

Parameters
HTransformation matrix to draw the circle.
cColour to use.
filledWhether or not it should be filled.

Definition at line 1193 of file opengl_render.c.

◆ gl_renderCross()

void gl_renderCross ( double x,
double y,
double r,
const glColour * c )

Renders a cross at a given position.

Parameters
xX position to center at.
yY position to center at.
rRadius of cross.
cColour to use.

Definition at line 144 of file opengl_render.c.

◆ gl_renderDepthRaw()

void gl_renderDepthRaw ( GLuint depth,
uint8_t flags,
double x,
double y,
double w,
double h,
double tx,
double ty,
double tw,
double th,
double angle )

Definition at line 216 of file opengl_render.c.

◆ gl_renderDepthRawH()

void gl_renderDepthRawH ( GLuint depth,
const mat4 * projection,
const mat4 * tex_mat )

Definition at line 178 of file opengl_render.c.

◆ gl_renderLine()

void gl_renderLine ( double x1,
double y1,
double x2,
double y2,
const glColour * c )

Draws a line.

Parameters
x1X position of the first point in screen coordinates.
y1Y position of the first point in screen coordinates.
x2X position of the second point in screen coordinates.
y2Y position of the second point in screen coordinates.
cColour to use.

Definition at line 1213 of file opengl_render.c.

◆ gl_renderRect()

void gl_renderRect ( double x,
double y,
double w,
double h,
const glColour * c )

Renders a rectangle.

Parameters
xX position to render rectangle at.
yY position to render rectangle at.
wRectangle width.
hRectangle height.
cRectangle colour.

Definition at line 87 of file opengl_render.c.

◆ gl_renderRectEmpty()

void gl_renderRectEmpty ( double x,
double y,
double w,
double h,
const glColour * c )

Renders a rectangle.

Parameters
xX position to render rectangle at.
yY position to render rectangle at.
wRectangle width.
hRectangle height.
cRectangle colour.

Definition at line 105 of file opengl_render.c.

◆ gl_renderRectH()

void gl_renderRectH ( const mat4 * H,
const glColour * c,
int filled )

Renders a rectangle.

Parameters
HTransformation matrix to apply.
filledWhether or not to fill.
cRectangle colour.

Definition at line 121 of file opengl_render.c.

◆ gl_renderScale()

void gl_renderScale ( const glTexture * texture,
double bx,
double by,
double bw,
double bh,
const glColour * c )

Blits a texture scaling it.

Parameters
textureTexture to blit.
bxX position of the texture in screen coordinates.
byY position of the texture in screen coordinates.
bwWidth to scale to.
bhHeight to scale to.
cColour to use (modifies texture colour).

Definition at line 1046 of file opengl_render.c.

◆ gl_renderScaleAspect()

void gl_renderScaleAspect ( const glTexture * texture,
double bx,
double by,
double bw,
double bh,
const glColour * c )

Blits a texture scaling it to fit a rectangle, but conserves aspect ratio.

Parameters
textureTexture to blit.
bxX position of the texture in screen coordinates.
byY position of the texture in screen coordinates.
bwWidth to scale to.
bhHeight to scale to.
cColour to use (modifies texture colour).

Definition at line 1074 of file opengl_render.c.

◆ gl_renderScaleSprite()

void gl_renderScaleSprite ( const glTexture * sprite,
double bx,
double by,
int sx,
int sy,
double bw,
double bh,
const glColour * c )

Blits a scaled sprite, position is in absolute screen coordinates.

Parameters
spriteSprite to blit.
bxX position of the texture in screen coordinates.
byY position of the texture in screen coordinates.
sxX position of the sprite to use.
syY position of the sprite to use.
bwWidth of sprite to render at.
bhHeight of sprite to render at.
cColour to use (modifies texture colour).

Definition at line 1018 of file opengl_render.c.

◆ gl_renderSDF()

void gl_renderSDF ( const glTexture * texture,
double x,
double y,
double w,
double h,
const glColour * c,
double angle,
double outline )

SDF Texture blitting backend.

Parameters
textureTexture to blit.
xX position of the texture on the screen. (units pixels)
yY position of the texture on the screen. (units pixels)
wWidth on the screen. (units pixels)
hHeight on the screen. (units pixels)
cColour to use (modifies texture colour).
angleRotation to apply (radians ccw around the center).
outlineThickness of the outline.

Definition at line 437 of file opengl_render.c.

◆ gl_renderShader()

void gl_renderShader ( double x,
double y,
double w,
double h,
double r,
const SimpleShader * shd,
const glColour * c,
int center )

Renders a simple shader.

Parameters
xX position.
yY position.
wWidth.
hHeight.
rRotation or 0. to disable.
shdShader to render.
cColour to use or NULL if not necessary.
centerWhether or not to center the shader on the position and use [-1,1] coordinates or set bottom-left and use [0,1] coordinates.

Definition at line 1126 of file opengl_render.c.

◆ gl_renderShaderH()

void gl_renderShaderH ( const SimpleShader * shd,
const mat4 * H,
const glColour * c,
int center )

Renders a simple shader with a transformation.

Parameters
shdShader to render.
HTransformation matrix.
cColour to use or NULL if not necessary.
centerWhether or not to center the shader on the position and use [-1,1] coordinates or set bottom-left and use [0,1] coordinates.

Definition at line 1147 of file opengl_render.c.

◆ gl_renderSprite()

void gl_renderSprite ( const glTexture * sprite,
double bx,
double by,
int sx,
int sy,
const glColour * c )

Blits a sprite, position is relative to the player.

Since position is in "game coordinates" it is subject to all sorts of position transformations.

Parameters
spriteSprite to blit.
bxX position of the texture relative to the player.
byY position of the texture relative to the player.
sxX position of the sprite to use.
syY position of the sprite to use.
cColour to use (modifies texture colour).

Definition at line 679 of file opengl_render.c.

◆ gl_renderSpriteInterpolate()

void gl_renderSpriteInterpolate ( const glTexture * sa,
const glTexture * sb,
double inter,
double bx,
double by,
int sx,
int sy,
const glColour * c )

Blits a sprite interpolating, position is relative to the player.

Since position is in "game coordinates" it is subject to all sorts of position transformations.

Interpolation is: sa*inter + sb*1.-inter)

Parameters
saSprite A to blit.
sbSprite B to blit.
interAmount to interpolate.
bxX position of the texture relative to the player.
byY position of the texture relative to the player.
sxX position of the sprite to use.
syY position of the sprite to use.
cColour to use (modifies texture colour).

Definition at line 852 of file opengl_render.c.

◆ gl_renderSpriteInterpolateScale()

void gl_renderSpriteInterpolateScale ( const glTexture * sa,
const glTexture * sb,
double inter,
double bx,
double by,
double scalew,
double scaleh,
int sx,
int sy,
const glColour * c )

Blits a sprite interpolating, position is relative to the player.

Since position is in "game coordinates" it is subject to all sorts of position transformations.

Interpolation is: sa*inter + sb*1.-inter)

Parameters
saSprite A to blit.
sbSprite B to blit.
interAmount to interpolate.
bxX position of the texture relative to the player.
byY position of the texture relative to the player.
scalewX scale factor.
scalehY scale factor.
sxX position of the sprite to use.
syY position of the sprite to use.
cColour to use (modifies texture colour).

Definition at line 878 of file opengl_render.c.

◆ gl_renderSpriteRotate()

void gl_renderSpriteRotate ( const glTexture * sprite,
double bx,
double by,
double angle,
int sx,
int sy,
const glColour * c )

Blits a sprite, position is relative to the player with rotation.

Since position is in "game coordinates" it is subject to all sorts of position transformations.

Parameters
spriteSprite to blit.
bxX position of the texture relative to the player.
byY position of the texture relative to the player.
angleAngle to rotate when rendering.
sxX position of the sprite to use.
syY position of the sprite to use.
cColour to use (modifies texture colour).

Definition at line 763 of file opengl_render.c.

◆ gl_renderSpriteScale()

void gl_renderSpriteScale ( const glTexture * sprite,
double bx,
double by,
double scalew,
double scaleh,
int sx,
int sy,
const glColour * c )

Blits a sprite, position is relative to the player.

Since position is in "game coordinates" it is subject to all sorts of position transformations.

Parameters
spriteSprite to blit.
bxX position of the texture relative to the player.
byY position of the texture relative to the player.
scalewScaling of width.
scalehScaling of height.
sxX position of the sprite to use.
syY position of the sprite to use.
cColour to use (modifies texture colour).

Definition at line 721 of file opengl_render.c.

◆ gl_renderSpriteScaleRotate()

void gl_renderSpriteScaleRotate ( const glTexture * sprite,
double bx,
double by,
double scalew,
double scaleh,
double angle,
int sx,
int sy,
const glColour * c )

Blits a sprite, position is relative to the player with scaling and rotation.

Since position is in "game coordinates" it is subject to all sorts of position transformations.

Parameters
spriteSprite to blit.
bxX position of the texture relative to the player.
byY position of the texture relative to the player.
scalewScaling of width.
scalehScaling of height.
angleAngle to rotate when rendering.
sxX position of the sprite to use.
syY position of the sprite to use.
cColour to use (modifies texture colour).

Definition at line 807 of file opengl_render.c.

◆ gl_renderStatic()

void gl_renderStatic ( const glTexture * texture,
double bx,
double by,
const glColour * c )

Blits a texture to a position.

Parameters
textureTexture to blit.
bxX position of the texture in screen coordinates.
byY position of the texture in screen coordinates.
cColour to use (modifies texture colour).

Definition at line 1099 of file opengl_render.c.

◆ gl_renderStaticSprite()

void gl_renderStaticSprite ( const glTexture * sprite,
double bx,
double by,
int sx,
int sy,
const glColour * c )

Blits a sprite, position is in absolute screen coordinates.

Parameters
spriteSprite to blit.
bxX position of the texture in screen coordinates.
byY position of the texture in screen coordinates.
sxX position of the sprite to use.
syY position of the sprite to use.
cColour to use (modifies texture colour).

Definition at line 917 of file opengl_render.c.

◆ gl_renderStaticSpriteInterpolate()

void gl_renderStaticSpriteInterpolate ( const glTexture * sa,
const glTexture * sb,
double inter,
double bx,
double by,
int sx,
int sy,
const glColour * c )

Blits a sprite interpolating, position is relative to the player.

Since position is in "game coordinates" it is subject to all sorts of position transformations.

Interpolation is: sa*inter + sb*1.-inter)

Parameters
saSprite A to blit.
sbSprite B to blit.
interAmount to interpolate.
bxX position of the texture in screen coordinates.
byY position of the texture in screen coordinates.
sxX position of the sprite to use.
syY position of the sprite to use.
cColour to use (modifies texture colour).

Definition at line 951 of file opengl_render.c.

◆ gl_renderStaticSpriteInterpolateScale()

void gl_renderStaticSpriteInterpolateScale ( const glTexture * sa,
const glTexture * sb,
double inter,
double bx,
double by,
double scalew,
double scaleh,
int sx,
int sy,
const glColour * c )

Blits a sprite interpolating, position is relative to the player.

Since position is in "game coordinates" it is subject to all sorts of position transformations.

Interpolation is: sa*inter + sb*1.-inter)

Parameters
saSprite A to blit.
sbSprite B to blit.
interAmount to interpolate.
bxX position of the texture in screen coordinates.
byY position of the texture in screen coordinates.
scalewX scale factor.
scalehY scale factor.
sxX position of the sprite to use.
syY position of the sprite to use.
cColour to use (modifies texture colour).

Definition at line 978 of file opengl_render.c.

◆ gl_renderTexture()

void gl_renderTexture ( const glTexture * texture,
double x,
double y,
double w,
double h,
double tx,
double ty,
double tw,
double th,
const glColour * c,
double angle )

Texture blitting backend.

Parameters
textureTexture to blit.
xX position of the texture on the screen. (units pixels)
yY position of the texture on the screen. (units pixels)
wWidth on the screen. (units pixels)
hHeight on the screen. (units pixels)
txX position within the texture. [0:1]
tyY position within the texture. [0:1]
twTexture width. [0:1]
thTexture height. [0:1]
cColour to use (modifies texture colour).
angleRotation to apply (radians ccw around the center).

Definition at line 417 of file opengl_render.c.

◆ gl_renderTextureDepthRaw()

void gl_renderTextureDepthRaw ( GLuint texture,
GLuint depth,
uint8_t flags,
double x,
double y,
double w,
double h,
double tx,
double ty,
double tw,
double th,
const glColour * c,
double angle )

Definition at line 288 of file opengl_render.c.

◆ gl_renderTextureDepthRawH()

void gl_renderTextureDepthRawH ( GLuint texture,
GLuint depth,
const mat4 * projection,
const mat4 * tex_mat,
const glColour * c )

Definition at line 243 of file opengl_render.c.

◆ gl_renderTextureInterpolate()

void gl_renderTextureInterpolate ( const glTexture * ta,
const glTexture * tb,
double inter,
double x,
double y,
double w,
double h,
double tx,
double ty,
double tw,
double th,
const glColour * c )

Texture blitting backend for interpolated texture.

Value blitted is ta*inter + tb*(1.-inter).

Parameters
taTexture A to blit.
tbTexture B to blit.
interAmount of interpolation to do.
xX position of the texture on the screen.
yY position of the texture on the screen.
wWidth on the screen. (units pixels)
hHeight on the screen. (units pixels)
txX position within the texture.
tyY position within the texture.
twTexture width.
thTexture height.
cColour to use (modifies texture colour).

Definition at line 576 of file opengl_render.c.

◆ gl_renderTextureInterpolateRawH()

void gl_renderTextureInterpolateRawH ( GLuint ta,
GLuint tb,
double inter,
const mat4 * projection,
const mat4 * tex_mat,
const glColour * c )

Texture blitting backend for interpolated texture.

Parameters
taTexture id A to blit.
tbTexture id B to blit.
interAmount of interpolation to do.
projectionProjection matrix tu use.
tex_matTexture matrix to use.
cColour to use (modifies texture colour).

Definition at line 510 of file opengl_render.c.

◆ gl_renderTextureRaw()

void gl_renderTextureRaw ( GLuint texture,
uint8_t flags,
double x,
double y,
double w,
double h,
double tx,
double ty,
double tw,
double th,
const glColour * c,
double angle )

Texture blitting backend.

Parameters
textureTexture to blit.
flagsTexture flags,.
xX position of the texture on the screen. (units pixels)
yY position of the texture on the screen. (units pixels)
wWidth on the screen. (units pixels)
hHeight on the screen. (units pixels)
txX position within the texture. [0:1]
tyY position within the texture. [0:1]
twTexture width. [0:1]
thTexture height. [0:1]
cColour to use (modifies texture colour).
angleRotation to apply (radians ccw around the center).

Definition at line 374 of file opengl_render.c.

◆ gl_renderTextureRawH()

void gl_renderTextureRawH ( GLuint texture,
const mat4 * projection,
const mat4 * tex_mat,
const glColour * c )

Texture blitting backend.

Parameters
textureTexture to blit.
projectionProjection matrix tu use.
tex_matTexture matrix to use.
cColour to use (modifies texture colour).

Definition at line 324 of file opengl_render.c.

◆ gl_renderTriangleEmpty()

void gl_renderTriangleEmpty ( double x,
double y,
double a,
double s,
double length,
const glColour * c )

Renders a triangle at a given position.

Parameters
xX position to center at.
yY position to center at.
aAngle the triangle should "face" (right is 0.)
sScaling of the triangle.
lengthLength deforming factor. Setting it to a value of other than 1. moves away from an equilateral triangle.
cColour to use.

Definition at line 162 of file opengl_render.c.

◆ gl_screenToGameCoords()

void gl_screenToGameCoords ( double * nx,
double * ny,
int bx,
int by )

Converts screen coordinates to in-game coordinates.

Parameters
[out]nxNew in-game X coord.
[out]nyNew in-game Y coord.
bxScreen X coord to translate.
byScreen Y coord to translate.

Definition at line 652 of file opengl_render.c.

◆ gl_unclipRect()

void gl_unclipRect ( void )

Clears the 2d clipping planes.

Definition at line 1247 of file opengl_render.c.

Variable Documentation

◆ gl_circleVBO

gl_vbo* gl_circleVBO = 0

Definition at line 41 of file opengl_render.c.

◆ gl_lineVBO

gl_vbo* gl_lineVBO = 0
static

Definition at line 42 of file opengl_render.c.

◆ gl_renderVBO

gl_vbo* gl_renderVBO = 0
static

VBO for rendering stuff.

Definition at line 38 of file opengl_render.c.

◆ gl_renderVBOcolOffset

int gl_renderVBOcolOffset = 0
static

VBO colour offset.

Definition at line 45 of file opengl_render.c.

◆ gl_renderVBOtexOffset

int gl_renderVBOtexOffset = 0
static

VBO texture offset.

Definition at line 44 of file opengl_render.c.

◆ gl_squareEmptyVBO

gl_vbo* gl_squareEmptyVBO = 0
static

Definition at line 40 of file opengl_render.c.

◆ gl_squareVBO

gl_vbo* gl_squareVBO = 0

Definition at line 39 of file opengl_render.c.

◆ gl_triangleVBO

gl_vbo* gl_triangleVBO = 0
static

Definition at line 43 of file opengl_render.c.