ryanm
« League of Dukes » Senior Member    Projects: 1
Used to be bleb
|
 |
«
Posted
2007-12-09 14:30:30 » |
|
Howdy
I've been picking through spgl with a view to appropriating the clever stuff that I haven't the fortitude to reinvent, starting with the com.shavenpuppy.jglib.renderer stuff. I suspect that if I mess up the implementation of the State object, I'll bork the sorting and any performance benefit will disappear.
Does anyone have any concrete examples of State objects, and/or the Shaders that produce them, that I can peruse? Even trivial ones would be a great help.
Cheers
|
|
|
|
|
princec
|
 |
«
Reply #1 - Posted
2007-12-09 16:36:55 » |
|
Yeah, I do believe I used it to render the backgrounds in Alien Flux. But it's very simple stuff unfortunately. The trick is to get your States sorted so that the most expensive state changes are called least often. Cas 
|
|
|
|
ryanm
« League of Dukes » Senior Member    Projects: 1
Used to be bleb
|
 |
«
Reply #2 - Posted
2007-12-09 20:17:37 » |
|
Yeah, I do believe I used it to render the backgrounds in Alien Flux. But it's very simple stuff unfortunately.
Anything is good. Is the source available anywhere? I take it you don't use it anymore? I suppose it's just sprites all over the shop for your stuff nowadays... Just as a sanity check of what I'm thinking: from most expensive to least - Shader programs
- texture id
- server attributes
- client attributes
- any more?
Encode the expensive stuff into the top bits of the sort order, and the expensive changes should be minimised. Are there any gotchas with the radix sort? Do I need to worry about the range of sort order values being too expansive? Cheers
|
|
|
|
|
Games published by our own members! Check 'em out!
|
|
princec
|
 |
«
Reply #3 - Posted
2007-12-10 02:41:28 » |
|
I'll dig up some source when I get home. As for RadixSort, as far as I know there are no gotchas at all. Just make sure you give different integer IDs to each state as appropriate (texture ID for example makes a good sort index for it). Cas 
|
|
|
|
ryanm
« League of Dukes » Senior Member    Projects: 1
Used to be bleb
|
 |
«
Reply #4 - Posted
2007-12-10 12:46:40 » |
|
Champion, I'll see how that goes.
Next to fall under my avaricious eye: Font rendering...
|
|
|
|
|
princec
|
 |
«
Reply #5 - Posted
2007-12-10 14:50:11 » |
|
My font rendering code is quite nice but really it needs to be ditched and incorporated in to the sprite engine so that glyphs are just sprites. Cas 
|
|
|
|
ryanm
« League of Dukes » Senior Member    Projects: 1
Used to be bleb
|
 |
«
Reply #6 - Posted
2007-12-17 11:50:31 » |
|
Well that went well.  Java output on the top, followed by mine, and then the packed texture. Changes made: - Glyphs hold their own image data, rather than the Font
- Floating-point layout
- More dynamic - glyphs can be added as needed
- Font generator substantially refactored
- Uses the rectangle packer
I've flung it all up Google code if anyone wants a look. So, in summary, huzzah for the spgl! edit: Incidentally, does anyone have any recommendations for fonts that definitely have kerning values? I've scanned through the 103 fonts on this system and not found any kerning pairs, so I'm wondering if there aren't any or if I've borked the kerning computation. edit2: Nevermind, found the problem (which, incidentally, existed in SPGL too). Text rendering with kerning now works.
|
|
|
|
|
princec
|
 |
«
Reply #7 - Posted
2007-12-20 16:00:28 » |
|
ooh what problem was that? (Not that I've ever had a problem  ) Cas 
|
|
|
|
ryanm
« League of Dukes » Senior Member    Projects: 1
Used to be bleb
|
 |
«
Reply #8 - Posted
2007-12-20 20:35:46 » |
|
On line 474 of FontConverter you call drawGlyphVector() directly on the special graphics object, rather than using a TextLayout - which is apparently where the kerning information appears from. - and passing in the graphics object. The Javadocs refer to using a TextLayout, it just doesn't happen in the code. Also, Java doesn't render with kerning by default, you need to derive the font with the appropriate TextAttribute map. Haven't tested that one myself, but that's what the docs say. The code that works for me is linked above. Hmmm, sounding like a bit of an ingrate here  I'm not, honest!
|
|
|
|
|
brackeen
|
 |
«
Reply #9 - Posted
2007-12-21 02:24:22 » |
|
Oh, interesting. I had been trying to figure out how to get kerning info, but it my experience KERNING_ON didn't do anything (even with fonts that obviously have kerning in other apps).
What font are you using?
|
|
|
|
|
Games published by our own members! Check 'em out!
|
|
ryanm
« League of Dukes » Senior Member    Projects: 1
Used to be bleb
|
 |
«
Reply #10 - Posted
2007-12-21 11:12:28 » |
|
Running 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| private static void kerningHunt() { String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); System.out.println( fonts.length + " Available font families : " );
for( String fontname : fonts ) { System.out.println( "Hunting for kerning in " + fontname ); FontFactory ff = new FontFactory( fontname );
boolean found = false;
for( int i = 0; i < defaultCharSet.length() && !found; i++ ) { for( int j = 0; j < defaultCharSet.length() && !found; j++ ) { char prev = defaultCharSet.charAt( i ); char next = defaultCharSet.charAt( j ); float k = ff.computeKerning( prev, next );
if( k != 0 ) { found = true; System.out.println( "\tkerning found!" ); } } } } } |
Gave me the output 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
| 106 Available font families : Hunting for kerning in AlArabiya kerning found! Hunting for kerning in AlBattar kerning found! Hunting for kerning in AlHor kerning found! Hunting for kerning in AlManzomah kerning found! Hunting for kerning in AlMateen-Bold Hunting for kerning in AlMohanad kerning found! Hunting for kerning in AlMothnna-Bold Hunting for kerning in AlYermook kerning found! Hunting for kerning in AnjaliOldLipi Hunting for kerning in AR PL ShanHeiSun Uni Hunting for kerning in AR PL ZenKai Uni Hunting for kerning in Arab kerning found! Hunting for kerning in Bitstream Charter Hunting for kerning in Bitstream Vera Sans kerning found! Hunting for kerning in Bitstream Vera Sans Mono Hunting for kerning in Bitstream Vera Serif kerning found! Hunting for kerning in Century Schoolbook L Hunting for kerning in Cortoba kerning found! Hunting for kerning in Courier 10 Pitch Hunting for kerning in DejaVu Sans kerning found! Hunting for kerning in DejaVu Sans Condensed kerning found! Hunting for kerning in DejaVu Sans Light kerning found! Hunting for kerning in DejaVu Sans Mono Hunting for kerning in DejaVu Serif kerning found! Hunting for kerning in DejaVu Serif Condensed kerning found! Hunting for kerning in Dialog Hunting for kerning in DialogInput Hunting for kerning in Dimnah kerning found! Hunting for kerning in Dingbats Hunting for kerning in Electron kerning found! Hunting for kerning in FreeMono Hunting for kerning in FreeSans kerning found! Hunting for kerning in FreeSerif kerning found! Hunting for kerning in Furat kerning found! Hunting for kerning in Garuda Hunting for kerning in Gentium kerning found! Hunting for kerning in GentiumAlt kerning found! Hunting for kerning in Granada kerning found! Hunting for kerning in Graph kerning found! Hunting for kerning in Hani kerning found! Hunting for kerning in Haramain kerning found! Hunting for kerning in Hor kerning found! Hunting for kerning in Japan kerning found! Hunting for kerning in Jet kerning found! Hunting for kerning in Kayrawan kerning found! Hunting for kerning in Khalid kerning found! Hunting for kerning in Kochi Gothic Hunting for kerning in Kochi Mincho Hunting for kerning in Lohit Gujarati Hunting for kerning in Lohit Hindi Hunting for kerning in Lohit Punjabi Hunting for kerning in Lohit Tamil Hunting for kerning in Loma kerning found! Hunting for kerning in Lucida Bright Hunting for kerning in Lucida Sans Hunting for kerning in Lucida Sans Typewriter Hunting for kerning in Luxi Mono Hunting for kerning in Luxi Sans kerning found! Hunting for kerning in Luxi Serif kerning found! Hunting for kerning in Mallige Hunting for kerning in MalOtf Hunting for kerning in Mashq kerning found! Hunting for kerning in Mashq-Bold kerning found! Hunting for kerning in Metal kerning found! Hunting for kerning in MgOpen Canonica kerning found! Hunting for kerning in MgOpen Cosmetica Hunting for kerning in MgOpen Modata kerning found! Hunting for kerning in MgOpen Moderna kerning found! Hunting for kerning in Monospaced Hunting for kerning in Mukti Narrow Hunting for kerning in Nada kerning found! Hunting for kerning in Nagham kerning found! Hunting for kerning in Nice kerning found! Hunting for kerning in Nimbus Mono L Hunting for kerning in Nimbus Roman No9 L Hunting for kerning in Nimbus Sans L Hunting for kerning in Norasi kerning found! Hunting for kerning in OpenSymbol Hunting for kerning in Ostorah kerning found! Hunting for kerning in Ouhod-Bold Hunting for kerning in Petra kerning found! Hunting for kerning in Phetsarath OT Hunting for kerning in Purisa Hunting for kerning in Rachana_w01 Hunting for kerning in Rasheeq-Bold Hunting for kerning in Rehan kerning found! Hunting for kerning in Salem kerning found! Hunting for kerning in SansSerif Hunting for kerning in Serif Hunting for kerning in Shado kerning found! Hunting for kerning in Sharjah kerning found! Hunting for kerning in Sindibad kerning found! Hunting for kerning in Standard Symbols L Hunting for kerning in Tarablus kerning found! Hunting for kerning in Tholoth kerning found! Hunting for kerning in Tlwg Typist Hunting for kerning in TlwgMono Hunting for kerning in TlwgTypewriter Hunting for kerning in UnBatang Hunting for kerning in UnDotum Hunting for kerning in URW Bookman L Hunting for kerning in URW Chancery L Hunting for kerning in URW Gothic L Hunting for kerning in URW Palladio L Hunting for kerning in utkal Hunting for kerning in Vemana2000 |
I tried to attach the list of kerning values that I found, but it's too big for the boards 
|
|
|
|
|
ryanm
« League of Dukes » Senior Member    Projects: 1
Used to be bleb
|
 |
«
Reply #11 - Posted
2007-12-21 11:32:52 » |
|
Also, I don't find any kerning information unless I derive the source font like so: 1 2 3
| Map<TextAttribute, Object> attributes = new HashMap<TextAttribute, Object>(); attributes.put( TextAttribute.KERNING, TextAttribute.KERNING_ON ); srcFont = java.awt.Font.decode( fontName ).deriveFont( attributes ); |
|
|
|
|
|
brackeen
|
 |
«
Reply #12 - Posted
2007-12-21 20:58:34 » |
|
Ah, you know what it is, a Java 6 implementation by a certain, uh, "fruit" company currently ignores KERNING_ON. Weird. The Sun implementation uses it.
BTW you don't have to use TextLayout or the faux Graphics2D - using font.layoutGlyphVector() has kerning.
Sorry to hijack the thread!
|
|
|
|
|
princec
|
 |
«
Reply #13 - Posted
2007-12-22 12:18:55 » |
|
Yeah, can't say I ever noticed kerning not working using the code as it is. It Just Worked. Cas 
|
|
|
|
|