Function:font2tex
From S2PLOT
font2tex
Use a named freetype2 font to create a texture map.
Prototype
unsigned int font2tex(char *fontfilename, char *text, int fontsizepx, int border);
Description
This function is only available if the [[
See Also
Code Example
#include <stdio.h>
#include <stdlib.h>
#include "s2plot.h"
int main(int argc, char *argv[])
{
fprintf(stderr,"Press <shift>-<w> to write VRML\n");
fprintf(stderr,"Creates VRML file: test.wrl\n");
s2opend("/s2mono", argc, argv); /* Open in mono mode */
s2swin(-1.,1., -1.,1., -1.,1.); /* Set the window coordinates */
pushVRMLname("BOX"); /* Create a new VRML object name */
s2box("BCDE",0,0,"BCDE",0,0,"BCDE",0,0);
/* This will not appear in the VRML */
int i, N = 100; /* Loop variables */
XYZ xyz; /* Point location */
COLOUR col; /* Point colour */
pushVRMLname("POINTS"); /* Create a new VRML object name */
for (i=0;i<N;i++) {
xyz.x = drand48()*2.0 - 1.0; /* Random positions */
xyz.y = drand48()*2.0 - 1.0;
xyz.z = drand48()*2.0 - 1.0;
col.r = drand48()*2.0 - 1.0; /* Random colours */
col.g = drand48()*2.0 - 1.0;
col.b = drand48()*2.0 - 1.0;
ns2vthpoint(xyz, col, 2); /* Draw current point */
}
pushVRMLname("ANON"); /* Restore default VRML object name */
s2show(1); /* Open the s2plot window */
return 1;
}
Back to S2PLOT function list.