GithubHelp home page GithubHelp logo

Comments (2)

SilverTiger avatar SilverTiger commented on May 24, 2024 3

Thanks for reading the tutorial!

Yes, you are right. It is not recommended to use AWT, and I want to remove that dependency (see issue #4). When this is done I will update the tutorial and put the AWT stuff to the appendix section. But right now I hadn't the time to fully implement Fonts with STB, but basically you have to do the following to create a bitmap with the glyphs:

stbtt_PackBegin(packContext, bitmap, imageWidth, imageHeight, 0, 1);
stbtt_PackFontRange(packContext, fontBuffer, 0, fontHeight, 32, chardata);
stbtt_PackEnd(packContext);

After that you can get the glyphs by calling stbtt_GetPackedQuad(chardata, imageWidth, imageHeight, i, xpos, ypos, quad, true); which will give you a STBTTAlignedQuad containing the vertex and texture coordinates. This demo may help you implementing it.

I will change the Font class to use STB if I have time, after that I'm thinking of doing some advanced tutorials like using NanoVG or creating audio with OpenAL.

from lwjgl3-tutorial.

Speiger avatar Speiger commented on May 24, 2024 1

I personally would not get rid of this tutorial because some people might want to write their own UI engine and will have this good resource no longer left to learn from.

Also the step of "Swing" could be outsourced to a different program and then have a loader that just converts the texture and a text file into a proper text Loader not requiring Swing or AWT.

from lwjgl3-tutorial.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.