Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (116)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / JOGL Development / New Question about the Vertex pointers on: 2003-08-05 23:59:19
First thank you to all who helped me get my vertex pointers working!!!

My question is now about multiple vertex pointers..

lets say i load 2 or more shapes from external files.. I load int via vertex pointers.. ( right now i do this for one )...  is there any trick in doing it for two or more.. ie

do i need to signal that its a new shape?
do i just continue to make vertext pointers after pointers and just call drawarrays when im done.?

Thanks,
JMG
2  Games Center / Featured Games / Re: Wurm Online on: 2003-08-05 10:15:36
Hey Mark,

Just wanted to let you know that wurm is looking great. The details about mouse movement ect.. are minor and essential easy fixes..  keep up the good work.

JMG
3  Java Game APIs & Engines / JOGL Development / Re: Help Plz on: 2003-08-04 20:59:46
thank you.. this is what i was hoping to find.. i will analize it Smiley

Grin Grin Grin Grin Grin

JMG
4  Java Game APIs & Engines / JOGL Development / Re: Help Plz on: 2003-08-04 19:48:49
ok.. ive made some corrections to the code.. but it still does not work.. as before this is all the code.. if its missing i didnt write it.. so plz comment..

the result of running this is still the same.. black screen
no errors.

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  
import net.java.games.jogl.*;
import net.java.games.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.nio.*;

public class Test {
   
    private FloatBuffer vertexBuffer;
    private float[] data = {    4.0f, 5.0f, 6.0f, 7.0f,
                                1.0f, 2.0f, 6.0f, 5.0f,
                                0.0f, 1.0f, 5.0f, 4.0f,
                                0.0f, 3.0f, 2.0f, 1.0f,
                                0.0f, 4.0f, 7.0f, 3.0f,
                                2.0f, 3.0f, 7.0f, 6.0f,
                            };
   
   
 
    public Test(){
        JFrame frame = new JFrame("Vertex Array Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(800,600);
        GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
        frame.getContentPane().add("Center",canvas);
        Renderer renderer = new Renderer();
        canvas.addGLEventListener(renderer);
        Animator animator = new Animator(canvas);
        frame.setVisible(true);
        animator.start();
    }
   
   
    public void prepareData(GLDrawable glDrawable){
        GL gl = glDrawable.getGL();
        gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
        gl.glColor3f(1.0f,0.0f,0.0f);
       
        vertexBuffer = BufferUtils.newFloatBuffer(data.length);
        vertexBuffer.put(data);
       
        gl.glVertexPointer(4, gl.GL_FLOAT, 0, vertexBuffer);
        gl.glFlush();
    }
   
   
   
    // MAIN STATEMENT
   public static void main(String[] args){
       Test test = new Test();
    }
 

 

// GL RENDERER
class Renderer implements GLEventListener {
       
        public void display(net.java.games.jogl.GLDrawable glDrawable) {
            GL gl = glDrawable.getGL();
            gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
            gl.glLoadIdentity();
            gl.glTranslatef(0.0f,0.0f,10.0f);
            gl.glDrawElements(GL.GL_QUADS,data.length,GL.GL_FLOAT,vertexBuffer);
        }
       
        public void displayChanged(net.java.games.jogl.GLDrawable glDrawable, boolean param, boolean param2) {
        }
       
        public void init(net.java.games.jogl.GLDrawable glDrawable) {
            GL gl = glDrawable.getGL();
            gl.glShadeModel(GL.GL_SMOOTH);
            gl.glClearColor(0.0f,0.0f,0.0f,0.0f);
            gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
            gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
            prepareData(glDrawable);
            gl.glFlush();
        }
       
        public void reshape(GLDrawable glDrawable, int x, int y, int width, int height) {
            GL gl = glDrawable.getGL();
            GLU glu = glDrawable.getGLU();
            if(height == 0){
                height=1;
            }
            gl.glViewport(0, 0, width, height);
            gl.glMatrixMode(GL.GL_PROJECTION);
            gl.glLoadIdentity();
            glu.gluPerspective(45.0f, (float)width/height,0.1f, 100.0f);
            gl.glMatrixMode(GL.GL_MODELVIEW);
            gl.glLoadIdentity();
        }
   
}
}
5  Java Game APIs & Engines / JOGL Development / Re: Help Plz on: 2003-08-04 18:45:48
i have removed that line.. same result.. black screen Sad
6  Java Game APIs & Engines / JOGL Development / Re: Help Plz on: 2003-08-04 18:29:18
ok.. here is all the logic as one big class.. copy and past into a class called Test to run.. all i get still is a blank screen.. would appreciate any help ppl can provide.


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  
import net.java.games.jogl.*;
import net.java.games.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.nio.*;

public class Test {
   
    private FloatBuffer vertexBuffer;
    private FloatList tmpBuffer = new FloatList();
    private float[] data = {    4.0f, 5.0f, 6.0f, 7.0f,
                                1.0f, 2.0f, 6.0f, 5.0f,
                                0.0f, 1.0f, 5.0f, 4.0f,
                                0.0f, 3.0f, 2.0f, 1.0f,
                                0.0f, 4.0f, 7.0f, 3.0f,
                                2.0f, 3.0f, 7.0f, 6.0f,
                            };
   
   
 
    public Test(){
        JFrame frame = new JFrame("Vertex Array Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(800,600);
        GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
        frame.getContentPane().add("Center",canvas);
        Renderer renderer = new Renderer();
        canvas.addGLEventListener(renderer);
        Animator animator = new Animator(canvas);
        frame.setVisible(true);
        animator.start();
    }
   
   
    public void prepareData(GLDrawable glDrawable){
        GL gl = glDrawable.getGL();
        gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
        gl.glColor3f(1.0f,0.0f,0.0f);
        gl.glVertexPointer(4, gl.GL_FLOAT, 0, vertexBuffer);
        gl.glFlush();
    }
   
   
   
    // MAIN STATEMENT
   public static void main(String[] args){
       Test test = new Test();
    }
 

//  A CONVIENCE CLASS TO STORE FLOAT DATA
class FloatList{
             ArrayList list = new ArrayList();

        public void add(float f){
            list.add(Float.toString(f));
        }

        public float get(int i){
            return Float.parseFloat((String)this.list.get(i));
        }

        public float[] getData(){
            float[] data = new float[this.list.size()];
            for(int i=0;i<this.list.size();i++){
                data[i] = get(i);
            }
            return data;
        }

        public void setData(float[] data){
            list = new ArrayList();
            for(int i=0;i<data.length;i++){
                this.list.add(Float.toString(data[i]));
            }
        }

        public int size(){
            return this.list.size();
        }
}
 

// GL RENDERER
class Renderer implements GLEventListener {
       
        public void display(net.java.games.jogl.GLDrawable glDrawable) {
            GL gl = glDrawable.getGL();
            gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
            gl.glLoadIdentity();
            gl.glTranslatef(0.0f,0.0f,10.0f);
            gl.glDrawElements(GL.GL_QUADS,data.length,GL.GL_FLOAT,vertexBuffer);
        }
       
        public void displayChanged(net.java.games.jogl.GLDrawable glDrawable, boolean param, boolean param2) {
        }
       
        public void init(net.java.games.jogl.GLDrawable glDrawable) {
            GL gl = glDrawable.getGL();
            gl.glShadeModel(GL.GL_SMOOTH);
            gl.glClearColor(0.0f,0.0f,0.0f,0.0f);
            gl.glClearDepth(GL.GL_DEPTH_TEST);
            gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
            gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
            prepareData(glDrawable);
            gl.glFlush();
        }
       
        public void reshape(GLDrawable glDrawable, int x, int y, int width, int height) {
            GL gl = glDrawable.getGL();
            GLU glu = glDrawable.getGLU();
            if(height == 0){
                height=1;
            }
            gl.glViewport(0, 0, width, height);
            gl.glMatrixMode(GL.GL_PROJECTION);
            gl.glLoadIdentity();
            glu.gluPerspective(45.0f, (float)width/height,0.1f, 100.0f);
            gl.glMatrixMode(GL.GL_MODELVIEW);
            gl.glLoadIdentity();
        }
   
}
}


Grin
7  Java Game APIs & Engines / JOGL Development / Re: Help Plz on: 2003-08-04 18:09:29
ok.. i understand that i missed a method call i have tried serveral variations.. all i get now is a blank screen or native exceptions.. im creating a single class test case to try and show all code im using and post it up here... its really bugging me that this is not working properly.

Any help that people can provide would be appreaciated. Final working code when i get this solved will be posted here cause i dont want anyone to have to go through this same fustration.

JMG
8  Java Game APIs & Engines / JOGL Development / Re: Help Plz on: 2003-08-04 13:07:34
check all of the above still no joy...

i hate to ask to be handle held.. but the fact that i get no errors makes this one a hard one to trouble shoot.

would someone have a very basic example of working code that uses vertex arrays to draw a shape...

Im sure i will be able to reference your contribution and learn what ive done wrong.. thanks.

JMG
9  Java Game APIs & Engines / JOGL Development / Re: Help Plz on: 2003-08-04 12:42:22
Angry
no joy.. man this is fustrating.. Smiley
so far everything was going great till i decided to learn how to draw this way Smiley

if anyone had a simple working demo it would be great!

10  Java Game APIs & Engines / JOGL Development / Re: Help Plz on: 2003-08-04 12:33:34
Ive tried reversing the values making them all negative .. same results.
11  Java Game APIs & Engines / JOGL Development / Help Plz on: 2003-08-04 12:22:21
Hi all,

Below is a piece of code im working on.
Im playing with vertex arrays.. but im not getting any output on the screen.

This section of code represents a shape.. my render will forward calls to draw and init when its display and init are called..

Right now all i get is a black screen.

Guidance would be appreciated.. as i want to understand what im doing wrong.

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  
package spacegame;

import java.util.*;
import java.nio.*;
import net.java.games.jogl.*;
import net.java.games.util.*;
import darkmatter.*;



public class Shape implements Model {
   
    private FloatBuffer vertexBuffer;
    private FloatList tmpBuffer = new FloatList();
    private float[] data = {    4.0f, 5.0f, 6.0f, 7.0f,
                                1.0f, 2.0f, 6.0f, 5.0f,
                                0.0f, 1.0f, 5.0f, 4.0f,
                                0.0f, 3.0f, 2.0f, 1.0f,
                                0.0f, 4.0f, 7.0f, 3.0f,
                                2.0f, 3.0f, 7.0f, 6.0f,
                            };
   
   
    public void draw(GLDrawable glDrawable) {
        GL gl = glDrawable.getGL();
        gl.glColor3f(1.0f,0.0f,0.0f);
        gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
        gl.glVertexPointer(4, gl.GL_FLOAT, 0, vertexBuffer);
       
       
        gl.glFlush();
    }    
   
    public void init(GLDrawable glDrawable) {
        GL gl = glDrawable.getGL();
        tmpBuffer.setData(data);
        vertexBuffer = BufferUtils.newFloatBuffer(tmpBuffer.size());
       
    }    
   
}
12  Java Game APIs & Engines / JOGL Development / Vertex array Help on: 2003-08-03 20:18:09
Hi all,

Ive been working through a copy of the "red book" trying to update my code... and i come to the topic of using arrays.. great they seem like a really good idea.. problem is the commands dont seem to map perfectly from the gl spec to jogl..  

Has anyone got a jogl example of defining a shape using an array  ?


Thanks,
J.
13  Games Center / Archived Projects / Re: Vertex Arrays on: 2003-08-03 20:17:03
your right.. sorry about that..
my bad
14  Games Center / Archived Projects / Vertex Arrays on: 2003-08-03 20:12:51
Hi all,

Ive been working through a copy of the "red book" trying to update my code... and i come to the topic of using arrays.. great they seem like a really good idea.. problem is the commands dont seem to map perfectly from the gl spec to jogl..

Has anyone got a jogl example of defining a shape using an array  ?


Thanks,
J.
15  Discussions / General Discussions / Re: Future of JOGL, LWJGL ? on: 2003-08-02 08:48:01
what we are basically seeing is sun finally taking the gaming industry seriously...   the cell phone gaming phenomion has taken off..  and one of two things can happen next.. it will fizzle out.. or with a little help it can become a thriving industry.

To full fill its potential ( cell phone gamming ) sun has decided to try to bring opengl to the cell phone. Great idea... but wait.. what about the desktop..   so in a seperate effort jogl has been created.... jlwgl was a seperate effort all together to meet this same need for the desktop.. its methodologies are slightly different and hence there are really two camps of java desktop gamming programmers now. both libraries have their good and bad points. And i dont see either one of them goinging away any time soon.

Pesonally i think this is an exciting time to be a java programmer. Ive been a lead programmer for the last 4 years ( in java ) and the potential for new programs to be created ( that use opengl ) are amazing.  ... And lets not forget the chance to show every C++ programmer that ever snuffed java that not only can we do what they do in games.. but we might even be able to do somethings better.! Smiley

JMG/Shadowlight/Shadejmg
(i have too many names Smiley )
16  Games Center / Archived Projects / Re: Java as a Professional Game Language on: 2003-07-31 13:55:23
im really surprise i have not seen any reference to it.. but the game Vampire the Masquerade was 90% java based. It did use some native calls.. but it was essentially a java game.. It rocked! and you had no clue that it was written in java. Best of all.. a major producer distributed it.. Activision.

17  Games Center / Archived Projects / Java as a Professional Game Language on: 2003-07-31 02:06:48
Ok.. the more research i do and the more i code.. the more i realize that some of the post are not only right but are missing the next point.. let me explain.

Java may or may not be slower than c++ under different conditions. The point made in these forums is that the difference does not matter. More often than not is is GPU processing not CPU processing that bottlenecks the process.. Ok .. so we load our models into memmory prior to displaying them .. i see no issues with that.

So hear the next point.. what are we going to do .. that will make java stand out as the next big thing.. What features can we enhance, exploit or simply take advantage of that will say.. ya that game was in java cause no other gamming language can do that...

It does not have to be something huge .. just impactful. ie.. lets say we wrap our game perfectly as a webstart.. great go to the developer website.. press a button play the latest game..  its not a big thing.. but it would be something..

i leave this thread for comments and further ideas.
18  Games Center / Archived Projects / Re: JOGL Based 3D Engine on: 2003-07-30 12:04:57
hey all.. for those of you who have been participating in this discussion check out the thread called file formats .. its a continuation of my engine building...

Grin
19  Games Center / Archived Projects / Re: File Formats on: 2003-07-30 12:02:23
Ok.. so my OBJ file loader is working awesome.. i design my models in a modeler program and poof.. i can load them in my little space 3d engine!

This got me thinking .. it would be great to share this code with the rest of you.. but there just one catch right now my loader populates a Model object wich is part of my space 3d engine ( code named DarkMatter ).... so its really of no use to anyone else no using the engine.

So here my thought as a group could we come up with a generic model for 3dModels to use in our engines.. ok.. im not expecting us all to agree..( and stick to  it ) but more or less get a concesus so that if i post my loader it contains most of the data/strutctures that will be usefull to most people... ( keep in mind loading a obj can take is along as we want.. cause you really should do it long before using it.. but draw time should be fast. )

let me know your thoughts.
ShadowLight (ShadeJMG)
Shocked
20  Games Center / Archived Projects / Re: File Formats on: 2003-07-29 23:55:02
dont worry about my above post.. i have done some research and have already begun work on an obj format (wavefront) loader.

the inital loader successfully loads the shapes and i hope to have the textures working by the weekend Smiley
21  Games Center / Archived Projects / File Formats on: 2003-07-28 23:22:21
Ok.. im working on my 3d engine and all is going great! However im at the stage where i should allow users of the engine to import models from external files. Has anyone heard of code that supports this feature yet... perferably from a copy file format like 3ds or something.

Thanks,
JMG
22  Games Center / Archived Projects / Re: JOGL Based 3D Engine on: 2003-07-28 11:07:17
Actual let me change my tone.. if i write an engine which i believe i can.. and i were to make it specialize what would the gernal population like it to be be ?

-space
-maze shooter (quake/doom )
-something else ?

23  Games Center / Archived Projects / Re: JOGL Based 3D Engine on: 2003-07-28 11:01:54
Im more concerned about learning the little intracacies involved that turning out a final product..  Smiley

My first 3d game will probably be a space related one.. it involves the least about of work...  but still intails some important concept.. ie physics, colision detection ect.. but not to the same degree that a maze shooter would.
24  Games Center / Archived Projects / Re: JOGL Based 3D Engine on: 2003-07-28 10:22:37
Quote
Do you mean like a quake-type 3d engine or what?


Yes that would be a similar comparison.. only i hope to make it a bit more flexiable so that it can be used for multiple types of games.

25  Games Center / Archived Projects / JOGL Based 3D Engine on: 2003-07-27 22:27:23
Hi Everyone,

Ive been pretty quiet on this board so far... But i wished to announce my intention to create a JOGL based 3D engine.

I dont expect this to be a quick venture to write... nor perfect the first time.. But i will post updates and provide links to demos using the engine as I go.

My congrats to puppygames you did an awesome job showing us all that java gaming is finally here. Now its time to try and see have far we can take it.



Jamie M. Guillemette aka ShadowLight
Wink
26  Games Center / Archived Projects / Re: Looking for beta testers... on: 2003-07-25 01:35:48
i managed to run the program .. but the screens did not draw properly

Sad

JMG
27  Java Game APIs & Engines / JOGL Development / Re: please help jni problem on: 2003-07-21 23:26:59
I got it working.. glitch was on my end..

any advice on a good place to start.. im a pretty seasoned java programer but im new to open gl and the jogl api in general.

Thanks,
J
28  Java Game APIs & Engines / JOGL Development / please help jni problem on: 2003-07-21 23:08:55
I get this no matter what i do..
im using the precomiple jars from june 17 ( off memmory )

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
java.lang.UnsatisfiedLinkError: no jogl in java.library.path[/glow]
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
        at java.lang.Runtime.loadLibrary0(Runtime.java:788)
        at java.lang.System.loadLibrary(System.java:834)
        at net.java.games.jogl.impl.NativeLibLoader.<clinit>(NativeLibLoader.java:45)
        at net.java.games.jogl.impl.GLContext.<clinit>(GLContext.java:50)
        at net.java.games.jogl.impl.windows.WindowsGLContextFactory.createGLContext(WindowsGLContextFactory.java:51)
        at net.java.games.jogl.GLCanvas.<init>(GLCanvas.java:66)
        at net.java.games.jogl.GLDrawableFactory.createGLCanvas(GLDrawableFactory.java:94)
        at net.java.games.jogl.GLDrawableFactory.createGLCanvas(GLDrawableFactory.java:80)
        at Gears.main(Gears.java:24)
Exception in thread "main"

Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

radar3301 (12 views)
2014-09-21 23:33:17

BurntPizza (30 views)
2014-09-21 02:42:18

BurntPizza (22 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (28 views)
2014-09-20 20:14:06

BurntPizza (32 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24: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!