atomes 1.1.15
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
ogl_text.c File Reference

Functions to prepare OpenGL rendering for text. More...

#include "global.h"
#include "glview.h"
+ Include dependency graph for ogl_text.c:

Go to the source code of this file.

Macros

#define PANGO_TEXT_SIZE   500
 
#define OUTLINE_WIDTH   3
 
#define GL_CLAMP_TO_EDGE   0x812F
 
#define GL_TEXTURE_WRAP_R   0x8072
 

Functions

void update_string_instances (glsl_program *glsl, object_3d *obj)
 Update OpenGL string texture instances.
 
int * paint_bitmap (vec4_t color, GLfloat a, int cw, int ch, unsigned char *buff)
 paint bitmap data using color
 
object_3dcreate_string_texture (int cwidth, int cheight, int *pixels)
 OpenGL 3D string object rendering.
 
object_3dgl_pango_render_layout (PangoLayout *layout, GLenum texture, int id, screen_string *this_string)
 OpenGL 3D pango layout object rendering.
 
ColRGBAopposite_color (ColRGBA col)
 compute the opposite color
 
void render_string (int glsl, int id, screen_string *this_string)
 render a screen string
 
void debug_string (screen_string *this_string)
 debug screen string data
 
void render_all_strings (int glsl, int id)
 render all string to be rendered for a label list
 
screen_stringwas_not_rendered_already (char *word, screen_string *list)
 check if a string was not already rendered and the corresponding screen string created
 
void add_string_instance (screen_string *string, vec3_t pos, atom *at, atom *bt, atom *ct)
 add an instance to a screen string
 
void add_string (char *text, int id, ColRGBA col, vec3_t pos, float lshift[3], atom *at, atom *bt, atom *ct)
 Add a screen string to the list of screen string to render.
 
void prepare_string (char *text, int id, ColRGBA col, vec3_t pos, float lshift[3], atom *at, atom *bt, atom *ct)
 prepare a screen string to be rendered
 

Variables

int measures_drawing
 
int type_of_measure
 
GLuint textures_id [2]
 
const int OUTLINE_BRUSH [2 *OUTLINE_WIDTH+1][2 *OUTLINE_WIDTH+1]
 
gboolean render_format
 

Detailed Description

Functions to prepare OpenGL rendering for text.

Author
Sébastien Le Roux sebas.nosp@m.tien.nosp@m..lero.nosp@m.ux@i.nosp@m.pcms..nosp@m.unis.nosp@m.tra.f.nosp@m.r

Definition in file ogl_text.c.

Macro Definition Documentation

◆ GL_CLAMP_TO_EDGE

#define GL_CLAMP_TO_EDGE   0x812F

Definition at line 59 of file ogl_text.c.

◆ GL_TEXTURE_WRAP_R

#define GL_TEXTURE_WRAP_R   0x8072

Definition at line 63 of file ogl_text.c.

◆ OUTLINE_WIDTH

#define OUTLINE_WIDTH   3

Definition at line 56 of file ogl_text.c.

◆ PANGO_TEXT_SIZE

#define PANGO_TEXT_SIZE   500

Definition at line 55 of file ogl_text.c.

Function Documentation

◆ add_string()

void add_string ( char * text,
int id,
ColRGBA col,
vec3_t pos,
float lshift[3],
atom * at,
atom * bt,
atom * ct )

Add a screen string to the list of screen string to render.

Parameters
textthe text to render
idthe label id
colthe color
posthe position
lshiftlabel position shift on x, y and z, if any
atthe 1st atom, if any (bond or angle measure string)
btthe 2nd atom, if any (bond or angle measure string)
ctthe 3rd atom, if any (angle measure string)

Definition at line 655 of file ogl_text.c.

◆ add_string_instance()

void add_string_instance ( screen_string * string,
vec3_t pos,
atom * at,
atom * bt,
atom * ct )

add an instance to a screen string

Parameters
stringthe screen string to increase
posthe position
atthe 1st atom, if any (bond or angle measure string)
btthe 2nd atom, if any (bond or angle measure string)
ctthe 3rd atom, if any (angle measure string)

Definition at line 601 of file ogl_text.c.

◆ create_string_texture()

object_3d * create_string_texture ( int cwidth,
int cheight,
int * pixels )

OpenGL 3D string object rendering.

Parameters
cwidthwidth
cheightheight
pixelsthe data to render

Definition at line 183 of file ogl_text.c.

◆ debug_string()

void debug_string ( screen_string * this_string)

debug screen string data

Parameters
this_string

Definition at line 525 of file ogl_text.c.

◆ gl_pango_render_layout()

object_3d * gl_pango_render_layout ( PangoLayout * layout,
GLenum texture,
int id,
screen_string * this_string )

OpenGL 3D pango layout object rendering.

Parameters
layoutthe Pango layout
texturethe OpenGL texture type
idthe label id
this_stringthe screen string

Definition at line 298 of file ogl_text.c.

◆ opposite_color()

ColRGBA * opposite_color ( ColRGBA col)

compute the opposite color

Parameters
colinput color

Definition at line 399 of file ogl_text.c.

◆ paint_bitmap()

int * paint_bitmap ( vec4_t color,
GLfloat a,
int cw,
int ch,
unsigned char * buff )

paint bitmap data using color

Parameters
colorthe color
aopacity
cwwidth
chheight
buffthe data to paint

Definition at line 117 of file ogl_text.c.

◆ prepare_string()

void prepare_string ( char * text,
int id,
ColRGBA col,
vec3_t pos,
float lshift[3],
atom * at,
atom * bt,
atom * ct )

prepare a screen string to be rendered

Parameters
textthe text to render
idthe label id
colthe color
posthe position
lshiftlabel position shift on x, y and z, if any
atthe 1st atom, if any (bond or angle measure string)
btthe 2nd atom, if any (bond or angle measure string)
ctthe 3rd atom, if any (angle measure string)

Definition at line 691 of file ogl_text.c.

◆ render_all_strings()

void render_all_strings ( int glsl,
int id )

render all string to be rendered for a label list

Parameters
glslshader id
idlabel id

Definition at line 549 of file ogl_text.c.

◆ render_string()

void render_string ( int glsl,
int id,
screen_string * this_string )

render a screen string

Parameters
glslthe shader id
idthe label id
this_stringthe screen string to render

Definition at line 418 of file ogl_text.c.

◆ update_string_instances()

void update_string_instances ( glsl_program * glsl,
object_3d * obj )
extern

Update OpenGL string texture instances.

Parameters
glslthe target glsl
obj

Definition at line 414 of file ogl_shading.c.

◆ was_not_rendered_already()

screen_string * was_not_rendered_already ( char * word,
screen_string * list )

check if a string was not already rendered and the corresponding screen string created

Parameters
wordthe string to render
listthe screen string list

Definition at line 571 of file ogl_text.c.

Variable Documentation

◆ measures_drawing

int measures_drawing
extern

Definition at line 67 of file d_measures.c.

◆ OUTLINE_BRUSH

const int OUTLINE_BRUSH[2 *OUTLINE_WIDTH+1][2 *OUTLINE_WIDTH+1]
Initial value:
= {{ 10, 30, 45, 50, 45, 30, 10 },
{ 30, 65, 85, 100, 85, 65, 30 },
{ 45, 85, 200, 256, 200, 85, 45 },
{ 50, 100, 256, 256, 256, 100, 50 },
{ 45, 85, 200, 256, 200, 85, 45 },
{ 30, 65, 85, 100, 85, 65, 30 },
{ 10, 30, 45, 50, 45, 30, 10 }}

Definition at line 72 of file ogl_text.c.

◆ render_format

gboolean render_format

Definition at line 172 of file ogl_text.c.

◆ textures_id

GLuint textures_id[2]

Definition at line 70 of file ogl_text.c.

◆ type_of_measure

int type_of_measure
extern

Definition at line 66 of file d_measures.c.