Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (293)
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  
  wireframe mode  (Read 1454 times)
0 Members and 1 Guest are viewing this topic.
Offline Middy

Junior Member




Java games rock!


« Posted 2003-08-20 21:54:58 »

Is it possible?

When do I get my makeMyGameAsILike() extension?
Offline Mac_Systems

Junior Member




I love my Java


« Reply #1 - Posted 2003-08-20 22:13:40 »

Erm ?

Please specify your question a bit more precise  Grin

Sure is Wireframe rendering possible ...

- Jens

The Network is the Music
http://www.mac-systems.de
Offline Mojomonkey

Senior Member




ooh ooh eee eeee


« Reply #2 - Posted 2003-08-21 00:55:22 »

Do you mean:

glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

??

If so... yes. You can do that.

Don't send a man to do a monkey's work.
Games published by our own members! Check 'em out!
Play the free demo of Revenge of the Titans!
Offline Chman

Junior Member




Nothing more that... Java games are cool !


« Reply #3 - Posted 2003-08-21 10:20:25 »

And to switch back to solid mode, use :

glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

Smiley
++
Chman
Offline Middy

Junior Member




Java games rock!


« Reply #4 - Posted 2003-08-21 10:39:13 »

I want to render my aster with a vireframe instead of filled quadrants


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  
package dts.client.impspace;

import org.lwjgl.opengl.GL;

import dts.client.e3d.StaticModel;
import dts.client.e3d.Texture;
import dts.client.e3d.Coord;

public class Aster extends StaticModel {
     
      private double _radius;      
      private Texture _texture;
      private int            _n=100;//precision of grade divisions
     private Coord _coord = new Coord(0.0f,0.0f,0.0f);
      public Aster(float radius,Texture texture)
      {
            super();
            //setRotation(new Coord(-90.0f,1.0f,0.0f));
           _radius=radius;
            _texture=texture;
            compile();
      }
     
      public void compile()
      {
            GL.glNewList(_handle,GL.GL_COMPILE);
            GL.glColor3f(1.0f,1.0f,1.0f);
            this.render(0);
            GL.glEndList();
      }
     
      public void draw(long t)
      {
            //processPosition();
           GL.glColor3f(1.0f,1.0f,1.0f);
            GL.glCallList(_handle);
      }
     
      public void render(int mode)
      {
            super.render(mode);
// TODO : redo without GLU            int quadric=GLU.gluNewQuadric();
//            GLU.gluQuadricNormals(quadric,GLU.GLU_SMOOTH);
//            GLU.gluQuadricTexture(quadric, true);
           _texture.bind();
//            GLU.gluSphere(quadric,_radius,60,60);
           
            //dont want to change varible name lazy
           double r      = _radius;
            int n      = _n;
            Coord  c      = _coord;
           
            final double PI       = Math.PI;
            final double TWOPI = Math.PI *2.0f;
            final double PID2       = Math.PI * 0.5f;

            int i,j;
            double theta1,theta2,theta3;
            //Coord e,p;
           Coord e= new Coord();
            Coord p= new Coord();
           
            if (r < 0)
                  r = -r;
            if (n < 0)
               n = -n;
            if (n < 4 || r <= 0) {
               GL.glBegin(GL.GL_POINTS);
               GL.glVertex3f(c.getX(),c.getY(),c.getZ());
               GL.glEnd();
               return;
            }
            for (j=0;j<n/2;j++) {
               theta1 = j * TWOPI / n - PID2;
               theta2 = (j + 1) * TWOPI / n - PID2;

               GL.glBegin(GL.GL_QUAD_STRIP);
               for (i=0;i<=n;i++) {
                    theta3 = i * TWOPI / n;
             
                    e.setX((float)(Math.cos(theta2) * Math.cos(theta3)));
                    e.setY((float)(Math.sin(theta2)));
                    e.setZ((float)(Math.cos(theta2) * Math.sin(theta3)));
                    p.setX((float)(c.getX() + r * e.getX()));
                    p.setY((float)(c.getY() + r * e.getY()));
                    p.setZ((float)(c.getZ() + r * e.getZ()));

                    GL.glNormal3f(e.getX(),e.getY(),e.getZ());
                    GL.glTexCoord2f(i/(float)n,2*(j+1)/(float)n);
                    GL.glVertex3f(p.getX(),p.getY(),p.getZ());

                    e.setX((float)(Math.cos(theta1) * Math.cos(theta3)));
                    e.setY((float)(Math.sin(theta1)));
                    e.setZ((float)(Math.cos(theta1) * Math.sin(theta3)));
                    p.setX((float)(c.getX() + r * e.getX()));
                    p.setY((float)(c.getY() + r * e.getY()));
                    p.setZ((float)(c.getZ() + r * e.getZ()));

                    GL.glNormal3f(e.getX(),e.getY(),e.getZ());
                    GL.glTexCoord2f(i/(float)n,2*j/(float)n);
                    GL.glVertex3f(p.getX(),p.getY(),p.getZ());
               }
               GL.glEnd();
            }
      }
}

When do I get my makeMyGameAsILike() extension?
Offline Middy

Junior Member




Java games rock!


« Reply #5 - Posted 2003-08-21 10:43:11 »

nm added this and it worked

[code]GL.glPolygonMode(GL.GL_FRONT_AND_BACK,GL.GL_LINE);
[/CODE]

When do I get my makeMyGameAsILike() extension?
Offline Middy

Junior Member




Java games rock!


« Reply #6 - Posted 2003-08-21 11:01:23 »

heh... next question.. if I want to show the wires as well as the texture... how would I proceed.. I plan to use the wires and longtitude and latitude

When do I get my makeMyGameAsILike() extension?
Offline princec
« League of Dukes »

JGO Kernel


Medals: 196
Projects: 3


Eh? Who? What? ... Me?


« Reply #7 - Posted 2003-08-21 14:55:36 »

Draw it twice; once with textures, the second time, using line mode.

Cas Smiley

Offline Middy

Junior Member




Java games rock!


« Reply #8 - Posted 2003-08-21 15:40:07 »

Changed it to this... I render it twice.. but should i create two asters?

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  
package dts.client.impspace;

import org.lwjgl.opengl.GL;

import dts.client.e3d.StaticModel;
import dts.client.e3d.Texture;
import dts.client.e3d.Coord;

public class Aster extends StaticModel {
     
      private double _radius;      
      private Texture _texture;
      private int            _n=50;//precision of grade divisions
     private Coord _coord = new Coord(0.0f,0.0f,0.0f);
      public Aster(float radius,Texture texture)
      {
            super();
            //setRotation(new Coord(-90.0f,1.0f,0.0f));
           _radius=radius;
            _texture=texture;
            compile();
      }
     
      public void compile()
      {
            GL.glNewList(_handle,GL.GL_COMPILE);
            GL.glColor3f(1.0f,1.0f,1.0f);
            this.render(1);
            this.render(0);
           
            GL.glEndList();
      }
     
      public void draw(long t)
      {
            //processPosition();
           GL.glColor3f(1.0f,1.0f,1.0f);
            GL.glCallList(_handle);
      }
     
      public void render(int mode)
      {
            super.render(mode);
// TODO : redo without GLU            int quadric=GLU.gluNewQuadric();
//            GLU.gluQuadricNormals(quadric,GLU.GLU_SMOOTH);
//            GLU.gluQuadricTexture(quadric, true);
           _texture.bind();
//            GLU.gluSphere(quadric,_radius,60,60);
           
            //dont want to change varible name lazy
           double r      = _radius;
            int n      = _n;
            Coord  c      = _coord;
           
            final double PI       = Math.PI;
            final double TWOPI = Math.PI *2.0f;
            final double PID2       = Math.PI * 0.5f;
            if (mode==1)GL.glPolygonMode(GL.GL_FRONT_AND_BACK,GL.GL_LINE);
           
            if(mode==0)GL.glPolygonMode(GL.GL_FRONT_AND_BACK,GL.GL_FILL);

            int i,j;
           
            double theta1,theta2,theta3;
            //Coord e,p;
           Coord e= new Coord();
            Coord p= new Coord();
           
            if (r < 0)
                  r = -r;
            if (n < 0)
               n = -n;
            if (n < 4 || r <= 0) {
               GL.glBegin(GL.GL_POINTS);
               GL.glVertex3f(c.getX(),c.getY(),c.getZ());
               GL.glEnd();
               return;
            }
            for (j=0;j<n/2;j++) {
               theta1 = j * TWOPI / n - PID2;
               theta2 = (j + 1) * TWOPI / n - PID2;

               GL.glBegin(GL.GL_TRIANGLE_STRIP);
               for (i=0;i<=n;i++) {
                    theta3 = i * TWOPI / n;
             
                    e.setX((float)(Math.cos(theta2) * Math.cos(theta3)));
                    e.setY((float)(Math.sin(theta2)));
                    e.setZ((float)(Math.cos(theta2) * Math.sin(theta3)));
                    p.setX((float)(c.getX() + r * e.getX()));
                    p.setY((float)(c.getY() + r * e.getY()));
                    p.setZ((float)(c.getZ() + r * e.getZ()));

                    GL.glNormal3f(e.getX(),e.getY(),e.getZ());
                    GL.glTexCoord2f(i/(float)n,2*(j+1)/(float)n);
                    GL.glVertex3f(p.getX(),p.getY(),p.getZ());

                    e.setX((float)(Math.cos(theta1) * Math.cos(theta3)));
                    e.setY((float)(Math.sin(theta1)));
                    e.setZ((float)(Math.cos(theta1) * Math.sin(theta3)));
                    p.setX((float)(c.getX() + r * e.getX()));
                    p.setY((float)(c.getY() + r * e.getY()));
                    p.setZ((float)(c.getZ() + r * e.getZ()));

                    GL.glNormal3f(e.getX(),e.getY(),e.getZ());
                    GL.glTexCoord2f(i/(float)n,2*j/(float)n);
                    GL.glVertex3f(p.getX(),p.getY(),p.getZ());
               }
               GL.glEnd();
            }
      }
}

When do I get my makeMyGameAsILike() extension?
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (67 views)
2013-05-17 21:29:12

alaslipknot (76 views)
2013-05-16 21:24:48

gouessej (109 views)
2013-05-16 00:53:38

gouessej (104 views)
2013-05-16 00:17:58

theagentd (115 views)
2013-05-15 15:01:13

theagentd (104 views)
2013-05-15 15:00:54

StreetDoggy (149 views)
2013-05-14 15:56:26

kutucuk (172 views)
2013-05-12 17:10:36

kutucuk (170 views)
2013-05-12 15:36:09

UnluckyDevil (179 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.087 seconds with 20 queries.