Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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  
  Updating to LWJGL 0.7  (Read 1410 times)
0 Members and 1 Guest are viewing this topic.
Offline Mojomonkey

Senior Member




ooh ooh eee eeee


« Posted 2003-09-02 13:00:58 »

Working on getting my stuff from 0.6 to 0.7.

Couple questions.

1. Have you removed Quadrics??? I understand that you were wanting to move all quadrics (sphere, cylinder, etc) to native Java, but why, oh why, did you remove it before the new version was ready??

2. Can you point me to a good example to use for obtaining matrix information via glGetFloatv.


Don't send a man to do a monkey's work.
Offline princec

JGO Kernel


Medals: 364
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2003-09-02 15:48:17 »

1. Coz our implementation, though it sorta worked, was too clunky. The JOGL GLU stuff is the right way to go, being implemented in pura Java, and we might have to pinch it.

2.
1  
2  
3  
4  
FloatBuffer matrix = ByteBuffer.allocateDirect(64).order(ByteOrder.nativeOrder()).asFloatBuffer();
...
matrix.clear();
GL.glGetFloat(GL.GL_MODELVIEW_MATRIX, matrix);

Offline Mojomonkey

Senior Member




ooh ooh eee eeee


« Reply #2 - Posted 2003-09-03 11:23:41 »

Ok, things are going well now. I have most everything working now. Just a few anomilies. First, my bitmap font is not displaying. I can't see anything wrong with what I'm doing...

here's the old code:

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  
public void print(int x, int y, String text, int set) {
        if (set > 1) {
            set = 1;
        } else if (set < 0) {
            set = 0;
        }

        TextureManager.getTextureManager().bind(texId);
       
        //set the GL states to how we want them.
       if(isBlended) {
            gl.enable(GL.BLEND);
        }
        gl.disable(GL.DEPTH_TEST);
        gl.enable(GL.TEXTURE_2D);
        gl.matrixMode(GL.PROJECTION);
        gl.pushMatrix();
        gl.loadIdentity();
        gl.ortho(0, gl.getWidth(), 0, gl.getHeight(), -1, 1);
        gl.matrixMode(GL.MODELVIEW);
        gl.pushMatrix();
        gl.loadIdentity();
        gl.translated(x, y, 0);
        gl.listBase(base - 32 + (128 * set));

        //Put the string into a "pointer"
       ByteBuffer scratch = ByteBuffer.allocateDirect(text.getBytes().length);
        scratch.put(text.getBytes());
        gl.color4f(red,green,blue,alpha);
        //call the list for each letter in the string.
       gl.callLists(
            text.length(),
            GL.BYTE,
            Sys.getDirectBufferAddress(scratch));
       
        //reset the GL states.
       if(isBlended) {
            gl.disable(GL.BLEND);
        }
        gl.matrixMode(GL.PROJECTION);
        gl.popMatrix();
        gl.matrixMode(GL.MODELVIEW);
        gl.popMatrix();
        gl.enable(GL.DEPTH_TEST);
        gl.disable(GL.TEXTURE_2D);
    }



and the ported code:

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  
public void print(int x, int y, String text, int set) {
        if (set > 1) {
            set = 1;
        } else if (set < 0) {
            set = 0;
        }

        TextureManager.getTextureManager().bind(texId);

        //set the GL states to how we want them.
       if (isBlended) {
            GL.glEnable(GL.GL_BLEND);
        }
        GL.glDisable(GL.GL_DEPTH_TEST);
        GL.glEnable(GL.GL_TEXTURE_2D);
        GL.glMatrixMode(GL.GL_PROJECTION);
        GL.glPushMatrix();
        GL.glLoadIdentity();
        GL.glOrtho(0, Window.getWidth(), 0, Window.getHeight(), -1, 1);
        GL.glMatrixMode(GL.GL_MODELVIEW);
        GL.glPushMatrix();
        GL.glLoadIdentity();
        GL.glTranslatef(x, y, 0);
        GL.glListBase(base - 32 + (128 * set));

        //Put the string into a "pointer"
       ByteBuffer scratch =
            ByteBuffer.allocateDirect(text.getBytes().length);
        scratch.put(text.getBytes());
        GL.glColor4f(red, green, blue, alpha);
        //call the list for each letter in the string.
       GL.glCallLists(scratch);

        //reset the GL states.
       if (isBlended) {
            GL.glDisable(GL.GL_BLEND);
        }
        GL.glMatrixMode(GL.GL_PROJECTION);
        GL.glPopMatrix();
        GL.glMatrixMode(GL.GL_MODELVIEW);
        GL.glPopMatrix();
        GL.glEnable(GL.GL_DEPTH_TEST);
        GL.glDisable(GL.GL_TEXTURE_2D);
    }


The main difference being:

1  
2  
3  
4  
5  
6  
7  
//Put the string into a "pointer"
       ByteBuffer scratch =
            ByteBuffer.allocateDirect(text.getBytes().length);
        scratch.put(text.getBytes());
        GL.glColor4f(red, green, blue, alpha);
        //call the list for each letter in the string.
       GL.glCallLists(scratch);


Yet nothing displays to the screen. All the remaining code stayed the same (except for the static GL calls), but I can also put up anything else you'd like to see.

Don't send a man to do a monkey's work.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline nala-naj

Senior Newbie




Java games rock!


« Reply #3 - Posted 2003-09-03 13:15:16 »

i think you need a scrach.flip() after your scratch.put(...) but i could be wrong Cheesy
Offline Mojomonkey

Senior Member




ooh ooh eee eeee


« Reply #4 - Posted 2003-09-03 13:25:28 »

Not only were you not wrong... you were right! Thanks a lot nala.

Don't send a man to do a monkey's work.
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #5 - Posted 2003-09-04 22:02:09 »

I'd also chuck in a .order(ByteOrder.nativeOrder()) as well if I were you, just to avoid headaches later.

Hellomynameis Charlie Dobbie.
Offline nala-naj

Senior Newbie




Java games rock!


« Reply #6 - Posted 2003-09-05 01:31:11 »

i agree... good catch  Grin
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.

TehJavaDev (13 views)
2014-08-28 18:26:30

CopyableCougar4 (25 views)
2014-08-22 19:31:30

atombrot (38 views)
2014-08-19 09:29:53

Tekkerue (31 views)
2014-08-16 06:45:27

Tekkerue (31 views)
2014-08-16 06:22:17

Tekkerue (19 views)
2014-08-16 06:20:21

Tekkerue (29 views)
2014-08-16 06:12:11

Rayexar (66 views)
2014-08-11 02:49:23

BurntPizza (42 views)
2014-08-09 21:09:32

BurntPizza (34 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!