Is there any difference in quality between SDF and TTF fonts if the font is never zoomed / rotated? - opengl

I am trying to understand Signed Distance Field font rendering and from what I understand they are used to preserve quality when zooming, rotating rendered fonts. Is there any difference in the quality of a TTF font (rendered onto a texture) vs a font rendered via SDF if the font is never zoomed or rotated? For example, in a 2D game would there be any improvement in rendering via SDF vs a TTF font rendered onto a texture (other than reduced memory usage)?

Related

Proper way to rotate TrueType font glyphs. Freetype lib, OpenGL rendering

Now i am using FreeType library to fill texture atlas with font glyphs in order to render strings as a sprites with texture from atlas.
Then i want to add glyph rotation(and scaling) effects. But let's just talk about rotation now.
Should i just apply this transformations to my textured sprites(quads, pair of triangles...etc) OR rotate glyphs in "font coordinate system" using FreeyType's FT_Glyph_Transform()/FT_Set_Transform() then get transformed glyph bitmap using FT_Load_Char() with FT_LOAD_RENDER flag or FT_Glyph_To_Bitmap(), upload this rotated glyph bitmap to texture atlas and then render the sprite?
Confusing quote from freetype doc
https://freetype.org/freetype2/docs/tutorial/step1.html
The transformation is applied to every glyph that is loaded through
FT_Load_Glyph and is completely independent of any hinting process.
This means that you won't get the same results if you load a glyph at
the size of 24 pixels, or a glyph at the size of 12 pixels scaled by 2
through a transformation, because the hints are computed differently
(except if you have disabled hints).
Rotation usually disables hinting.
So, hinting is disabled, right? Are there any image quality advantages expected then? May be i really should just rotate my sprite and don't bother?

How to use a complex OpenGL as background in QGraphicsScene?

I'm trying to create a display with a complex OpenGL image and some spinboxes on the image. Using http://doc.qt.digia.com/qq/qq26-openglcanvas.html I'm able to have a two layers object (inheriting from QGraphicsScene) with a simple OpenGL image as background and the controls on foreground.
So, now I'm trying to display my true OpenGL image as background. This image is created by:
A quad mapped on a structure,
Some small 2D objects represented by 2D textures with alpha channel and specific shaders, drawn on the quad (upper z value)
Some polylines.
With this image I have some strange behavior. The 2D textured objects are drawn with a white background. Some experiments seem to indicate that, in the drawing of this complex OpenGL image the alpha channel is disabled.
I tried different configurations for the QGLWidget used as viewport of the QGraphicsView but without result.
So I need help to be able to create this OpenGL image with the right transparency effects.

Need help understanding Sprite & Texture

I recently started looking at cocos2d game development.
What's the difference between sprite and texture?
Maybe I could through in 'bitmap' in there. What is a bitmap?
They all seem to be the same thing as 2d image.
A texture is an in-memory image that the device can draw onto the screen.
A sprite actually draws the texture, or just a specific rectangle of the texture, on the screen. The sprite can be scaled, rotated, positioned, skewed, tinted (colorized) among other things.
Multiple sprites can share the same texture. The texture is only loaded to memory once regardless of how many sprites are using the same texture. Moreover with CCSpriteBatchNode you can "batch" the drawing of all sprites that are using the same texture to achieve better performance.
A bitmap is a general term for a computer image where each pixel is represented by one or more bits. There's also the image format BMP which is/was popular on Windows. Most people would just say "image" these days as there are other forms of "bitmaps" that are not images. For example in AI code you often have bitmaps (arrays of bits) that represent state information of the AI or pathfinding algorithms for all areas of the game world. Ie each area in the world could have a "blocking" bit, or a "resource" bit that helps the AI making decisions.
See also Wikipedia:
Texture Mapping
Bitmap
you can load texture into memory, for example your file with image is texture. sprite is object with set of parameters, several of them are pointer to the texture, size and texture coordinate.
you can load texture 2048x2048 into memory, then create sprite with part of this texture.

Video as voxels in OpenGL

Any good references on displaying sequence of images from a video as voxel data in OpenGL? I want to display all these images at once as a cuboid with 50% alpha and navigate using keyboard or mouse.
Check out this tutorial on setting up a 3D texture.
If you then render slices through the texture array with the appropriate UVW coordinates you will get what you are after.

How to scale a sprite image without losing color key information?

I'm currently developing a simple application that displays map and draws some markers on it. I'm developing for Windows Mobile, so I decided to use DirectDraw and Imaging interfaces to make the application fast and pretty. The map moves when user moves finger on the touchscreen, so the whole map moving/scrolling animation has to be fast, but it is not.
On every map update I have to draw portion of the map, control buttons, and markers - buttons and markers are preloaded on DirectDraw surface as a mipmap. So the only thing I do is BitBlit from the mipmap to a back buffer, and from the back buffer to a primary surface (I can't use page flipping due to the windowed mode of my application).
Previously I used premultiplied-alpha surface with 32 bit ARGB pixel format for images mipmap, everything was looking good, but drawing entire "scene" was horribly slow - i could forget about smooth map scrolling. Now I'm using mipmap with native (RGB565) pixel format and fuchsia (0xFF00FF) color key. Drawing is much better.
My mipmap surface is generated on program loading - images are loaded from files, scaled (with filtering) and drawn on mipmap. The problem is, that image scaling process blends pixel colors, and those pixels which are on the border of a sprite region are blended with surrounding fuchsia pixels resulting semi-fuchsia color that is not treated as color key. When I do blitting with color key option, sprites have small fuchsia-like borders, and it looks really bad.
How to solve this problem? I can use alpha blitting, but it is too slow - even in ARGB 1555 format.