fonts in Opengl

good morning, I have a problem with a project I’m doing in OpenGL,
but a problem I do not know how to begin to do this,

what I want is a sphere of OpenGL (glutsolidsphere) might
insert a letter (just like a billiard ball) but that this
in the contours of the sphere (3D) that is not flat but have
curves is the area, and try to download the FreeType but
achievement to make it work (using the visual c 2008), I hope I can get a
idea of how to do it. thanks.

Render the text to a 2D texture.
Apply the 2D to the sphere.
Read about FBO (GL_EXT_framebuffer_object) if you don’t know how to render to a texture.

Code examples are here

and there are various articles on the net.

V-man do you have projective texturing in mind or something else?

john you can also create a texture atlas with glyphs and apply those, not absolutely necessary to render to texture. There are utilities that can help you with that. The big question for you is probably how to generate those texture coordinates.

sorry for the question, but as rendering the letters, I am beginning to
OpenGL, the examples I found are not very clear on the copy and fbo
Paste the examples I found and I get errors, any help please c.

No, he should just apply it to the sphere. Of course, your text needs to be small. It should not cover the entire texture. You could make a “8” ball or any other pool ball this way.

forgiveness that is so slow, but the truth is that I have no idea how
First, what libraries need?, any instance in which I can base,

Probably the simplest thing would be to model your sphere in a modeling program, apply the texture in using whatever mapping method you want, then importing this model into you app.

Thanks for responding,
But I’m from 0.
Firstly as I can model … what program do I need?, as I can make
export? some algorithm?
use visual c 2008.

thanks for answering

Forget the modeling program.
If you want to learn GL, get the Red Book and learn the basics. The Red Book is online. It covers GL 1.1. It shows how to use GLUT, GLU and GL. I think they use AUX for loading BMP files which is dead and gone now. Use DevIL to load image files, which is here

Oh no, not devil. It’s a bad program for beginners, since you need a lot of libraries and it’s just a wrapper over different libraries anyways. Instead check this out:

This is the best.

Oh no, not devil. It’s a bad program for beginners, since you need a lot of libraries and it’s just a wrapper over different libraries anyways.

Any image loading utility should essentially be wrappers around libraries code. The point in using them is that you don’t have to waste precious time writing those wrappers yourself.

I’d avoid DevIL due to its terrible interface (OpenGL-style objects is not a good idea, and unlike regular OpenGL, this one doesn’t gain any backwards-compatibility from it) and the fact that development on it has stalled. I personally swear by FreeImage.

This is the best.

A bare C file is nothing that I would call “the best” of anything. It doesn’t even come with a header, let alone instructions (and no: reading the code doesn’t count).

Ok, let me try to convince you, my texture loading with stb_image looks like this:

      GLTexture2a texture;

      if (!texture.image_data_ptr)
        texture.image_data_ptr = stbi_load(r->first.file_string().c_str(),
          &texture.x, &texture.y, &texture.comp, STBI_default);

        if (!texture.image_data_ptr)
          throw std::runtime_error("error loading image '" +
            r->first.file_string() + "': " + stbi_failure_reason());
        // else do nothing
      // else do nothing

      GLenum format;

      switch (texture.comp)
        case STBI_grey:
          format = GL_LUMINANCE;

        case STBI_grey_alpha:
          format = GL_LUMINANCE_ALPHA;

        case STBI_rgb:
          format = GL_RGB;

        case STBI_rgb_alpha:
          format = GL_RGBA;

          BOOST_VERIFY(!"unsupported number of channels");

      glGenTextures(1, &texture.texture_object);
      glBindTexture(GL_TEXTURE_2D, texture.texture_object);

      if (r->first.filename().rfind(".mipmap.") != std::string::npos)
        glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
      // else do nothing



See you just call stbi_load(), you get the data and that’s it. It’s a single .c file that handles .jpg, .png, .bmp, .tga, … The .c file serves both as a header file and implementation. It’s the best.

I agree with the OpenGL interface look of DevIL is useless, but it is a good lib. You just get yourself zlib, libjpeg, libpng libtiff and I think that’s all.

I was impressed with this library when I wanted to open some half-life 2 textures (VTF).
The new version supported VTF so I just updated the header, lib and dll.