c++ - How to draw texts on a 3D objects (such as sphere) -


I learn OpenGL under the Linux platform. Recently, I try to use texts created by glutBitmapCharacter () , such as the texture of some of the Quadrix objects provided by glu or glut, glutBitmapCharacter () does not return an indicator so that I can not feed it on glTexImage2D () I was Google for some time, but whatever I found is something related to Android SDK I have no experience.

All I can think is to present the texts and read it using buffer glReadPixels () , then save it to a file. Then, the pixel from the file Read back and see it in an indicator Finally, draw 3D objects as textures with these texts (i.e. feed the pointer at glTexImage2D () .)

However, it is very silly what I want to ask: what There is no other alternative way to power?

Applying text on top is not trivial with a 3D surface pure OpenGL. GLUT does not provide any tools for this. One possible option would be to apply your own text rendering methods, possibly loading the glyph, then apply a texture to the glyph and apply the texture to the polygon. There is a small assistant library, which can help you a lot.

Another option would be to load text glyph in a texture and then apply them to the form of decals on geometry. In this way you can still simulate a 2D text drawing in a flat surface (decal) and then apply to the top of a 3D object.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -