Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  OpenGL text  (Read 3221 times)
0 Members and 1 Guest are viewing this topic.
Offline weston
« Posted 2005-01-15 19:39:08 »

it seems like every tutorial I can find on doing text with opengl is either windows only or uses a black and white texture wtih all the characters on it. Well, I'm not going windows only so I seem to be stuck with the latter option. My question is about displaying this type of font so that the letters are not translucent. It seems to me that the only option I have for blending mode is: GL_SRC_ALPHA, GL_ONE as long as the texture is black and white. Since this will always result in a translucent texture. So what I'm wondering is if there is another blend mode I could use, if I should start looking for textures with white characters and a transparent background so I can use: GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, or other solutions people have found to get around this.

for(int i = 1; i > 0; i++)
     System.out.println(i+" cups of java downed");
Offline oNyx

JGO Coder

Medals: 2

pixels! :x

« Reply #1 - Posted 2005-01-15 20:58:47 »

>if I should start looking for textures with white characters
>and a transparent background

Just create those.

Or write your own tool... or use the one from SPGL.

弾幕 ☆ @mahonnaiseblog
Offline weston
« Reply #2 - Posted 2005-01-16 21:32:03 »

found the solution. By using the LUMINANCE_ALPHA format instead of RGBA. Now I can use GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA with grayscale images to get transparent backgrounds and fully opaque foregrounds (yeah, I'm still a bit of an ogl newb). I'm now using a modification of spgl's FontConverter that doesn't require other spgl classes. I think I'll write a simple gui for it just so I can view all the fonts on my system...

p.s. I would recommend looking at spgl's font stuff to anyone else looking for a nice way to do text with OpenGL, there is a lot to know (and now I know more than I ever wanted to..) about text/fonts.

for(int i = 1; i > 0; i++)
     System.out.println(i+" cups of java downed");
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

« JGO Spiffy Duke »

Medals: 1033
Projects: 3
Exp: 20 years

Eh? Who? What? ... Me?

« Reply #3 - Posted 2005-01-17 09:43:14 »

God knows it took me long enough to figure out!

Cas Smiley

Offline Deadcow

Senior Newbie

Back from beyond ... Moo!

« Reply #4 - Posted 2005-01-18 08:55:38 »

A java binding to FreeType2 ( ) may be quite an elegant way to go. It is very lightweight, portable and flexible, and allow to render glyphs from almost any kind of font file to a memory buffer dynamically. I'll be glad to see it be part of lwjgl's util library ( i can even participate if someone is interested ).


Already discussed few days ago. Sorry that.
Offline Dosenbier

Senior Newbie

They EXIST !!!

« Reply #5 - Posted 2005-01-18 11:09:10 »

Another way of doing it could be the use of bitplanes (the code for it is somewhere in the redbook)

- You can color the bitplane u are drawing in any way you like.
- No blending needed, and the background is fully transparent.
- Very clear fonts / no scaling could screw up your quality

- you can't use them as textures in 3d, just for 2d text rendering in the foreground
- you just have one font size available for each  bitplane-font you are  creating.

But for GUI use it should do the job.

Nonsense makes the world go round.

Pages: [1]
  ignore  |  Print  

EgonOlsen (74 views)
2018-06-10 19:43:48

EgonOlsen (55 views)
2018-06-10 19:43:44

EgonOlsen (74 views)
2018-06-10 19:43:20

DesertCoockie (254 views)
2018-05-13 18:23:11

nelsongames (154 views)
2018-04-24 18:15:36

nelsongames (154 views)
2018-04-24 18:14:32

ivj94 (895 views)
2018-03-24 14:47:39

ivj94 (156 views)
2018-03-24 14:46:31

ivj94 (808 views)
2018-03-24 14:43:53

Solater (172 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!