Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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 1477 times)
0 Members and 1 Guest are viewing this topic.
Offline weston

Junior Member





« Posted 2005-01-15 20: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: 1


pixels! :x


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

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

Just create those.

http://www.lmnopc.com/bitmapfontbuilder/

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

弾幕 ☆ @mahonnaiseblog
Offline weston

Junior Member





« Reply #2 - Posted 2005-01-16 22: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
Online princec

JGO Kernel


Medals: 342
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #3 - Posted 2005-01-17 10: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 09:55:38 »

A java binding to FreeType2 ( http://www.freetype.org/ ) 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 ).

<Edit>

Already discussed few days ago. Sorry that.
Offline Dosenbier

Senior Newbie




They EXIST !!!


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

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

Advantages:
- 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

Disadvantages:
- 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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (22 views)
2014-07-24 01:59:36

Riven (20 views)
2014-07-23 21:16:32

Riven (17 views)
2014-07-23 21:07:15

Riven (20 views)
2014-07-23 20:56:16

ctomni231 (48 views)
2014-07-18 06:55:21

Zero Volt (44 views)
2014-07-17 23:47:54

danieldean (35 views)
2014-07-17 23:41:23

MustardPeter (38 views)
2014-07-16 23:30:00

Cero (53 views)
2014-07-16 00:42:17

Riven (52 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org 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‑gaming.org
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!