How to do OpenGL live text-rendering for a GUI?

EDIT2: Sean Barrett just released Bitmap fonts for C/C++ 3D programmers. EDIT: another code gem that’s worth a look is Font Stash which leverages Sean Barrett’s stb_truetype.h. You can create a texture in which you render all the characters of your font. Then you just draw textured quads with orthographic projection and proper texture coordinates: … Read more

Is it safe to use the CSS rule “text-rendering: optimizelegibility;” on all text?

No: there have been many bugs over the years on various platforms which cause text not to be displayed or displayed incorrectly (see below). If your goal is to enable ligatures, there’s actually standard property font-variant-ligatures defined in CSS Fonts Level 3 which offers full control: font-variant-ligatures: common-ligatures; font-variant-ligatures: common-ligatures discretionary-ligatures historical-ligatures; See font-variant for … Read more

How to convert a string to an image?

use ImageDraw.text – but it doesn’t do any formating, it just prints string at the given location img = Image.new(‘RGB’, (200, 100)) d = ImageDraw.Draw(img) d.text((20, 20), ‘Hello’, fill=(255, 0, 0)) to find out the text size: text_width, text_height = d.textsize(‘Hello’) When creating image, add an aditional argument with the required color (white): img = … Read more

Vertical (rotated) text in HTML table

.box_rotate { -moz-transform: rotate(7.5deg); /* FF3.5+ */ -o-transform: rotate(7.5deg); /* Opera 10.5 */ -webkit-transform: rotate(7.5deg); /* Saf3.1+, Chrome */ filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083); /* IE6,IE7 */ -ms-filter: “progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083)”; /* IE8 */ } <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vitae porta lectus. Suspendisse dolor mauris, scelerisque ut diam vitae, dictum ultricies est. Cras sit amet … Read more

Draw text in OpenGL ES

Rendering text to a texture is simpler than what the Sprite Text demo make it looks like, the basic idea is to use the Canvas class to render to a Bitmap and then pass the Bitmap to an OpenGL texture: // Create an empty, mutable bitmap Bitmap bitmap = Bitmap.createBitmap(256, 256, Bitmap.Config.ARGB_4444); // get a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)