Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (602)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (649)
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  
  a renderer problem  (Read 1002 times)
0 Members and 1 Guest are viewing this topic.
Offline grego5

Junior Newbie

Java games rock!

« Posted 2004-07-31 17:33:29 »

I am having a problem.  I am just starting to play around with jogl.  I created a filled polygon which represents a wall and created a camera using the glu.gluLookAt, but when I move my location close to this polygon, I get this huge black area that goes through the polygon.  Why do I get that?  Can someone run my code and see if they know why I am getting this black area running through the object that I don't think should be there? I don't know if it is my code or jogl.

*****************one class*******************
import javax.swing.event.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.event.*;
import javax.swing.JOptionPane;
import javax.swing.event.*;
import java.util.Random;

public class LabrynthFrame extends JFrame implements GLEventListener,KeyEventDispatcher
     private int width=1030;
     private int height=900;
     private Labrynth labrynth=null;
     private GLCanvas canvas=null;
      private double eyex=0.0;
     private double eyey=0.0;
     private double eyez=4.5;
     private double centerx=0.0;
     private double centery=0.5;
       private double centerz=-100;
     private double upx=0.0;
     private double upy=1.0;
     private double upz=0.0;
     private double heading=270;

     public LabrynthFrame()
           setTitle("The Labrynth");

           GLCapabilities capabilities = new GLCapabilities();


           labrynth=new Labrynth();
            setLocation(0,0);  //the default location
           Animator animator=new Animator(canvas);


     public void init (GLDrawable drawable)

           GL gl = drawable.getGL();
           GLU glu=drawable.getGLU();





     public void display (GLDrawable drawable)
           GL gl = drawable.getGL();
           GLU glu=drawable.getGLU();






     public void reshape (GLDrawable drawable, int i, int x, int width, int height)
     public void displayChanged (GLDrawable drawable, boolean modeChanged, boolean deviceChanged)
      public boolean dispatchKeyEvent(KeyEvent event)
            double tempx=0.0;
            double tempy=0.0;
            double tempz=0.0;

                        case KeyEvent.VK_LEFT:


                       centerx=((Math.cos(Math.toRadians(heading)))*(100+eyex)  );
                       centerz=( (Math.sin(Math.toRadians(heading)))*(100+eyez) );


                       case KeyEvent.VK_RIGHT:

                       centerx=((Math.cos(Math.toRadians(heading)))*(100+eyex)  );
                       centerz=( (Math.sin(Math.toRadians(heading)))*(100+eyez) );


                       case KeyEvent.VK_UP:




                       case KeyEvent.VK_DOWN:





                       default: break;

                 }//end switch statement


           }//end event.getId


              return false;   //doesn't pass key pressed on to other listeners if true

     }//end dispatch event key

}//end of LabrynthFrame class
//***********************2nd class*****
//The Labrynth game, this class contains the Dungeon
//Created by Greg Dias


public class Labrynth
      public Labrynth()  
      }//end Labrynth constructor

     public void draw(GLDrawable drawable)

           GL gl = drawable.getGL();

                 gl.glVertex3f((float)0,(float).5,(float).5);  //top right point
                 gl.glVertex3f((float)-3.5,(float).5,(float).5); //left point
                 gl.glVertex3f((float)-3.5,(float).5,(float)3.5);//top front point
                 gl.glVertex3f((float)-3.5,(float)-.5,(float)3.5);//bottom front point
                 gl.glVertex3f((float)-3.5,(float)-.5,(float).5);//bottom back point


}//end Labrynth class
Offline Chman

Junior Devvie

Nothing more that... Java games are cool !

« Reply #1 - Posted 2004-07-31 20:09:45 »

I haven't ran your code because of my lake of time, but the thing you get is absolutly normal.

You can try to change you gluPerspective method to :


but it's not recommanded if you are using some advanced opengl functions...

Offline Mithrandir

Senior Devvie

Cut from being on the bleeding edge too long

« Reply #2 - Posted 2004-08-01 12:39:24 »

All you are doing is hitting the front clipping plane when you get close. That results in some of the object being clipped, resulting in the "black" area. If you'd changed the clear colour, then you'd see whatever colour you'd set.

The site for 3D Graphics information
Aviatrix3D JOGL Scenegraph
Programming is essentially a markup language surrounding mathematical formulae and thus, should not be patentable.
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Jesse (15 views)
2015-07-29 04:35:27

Riven (37 views)
2015-07-27 16:38:00

Riven (18 views)
2015-07-27 15:35:20

Riven (21 views)
2015-07-27 12:26:13

Riven (12 views)
2015-07-27 12:23:39

BurntPizza (30 views)
2015-07-25 00:14:37

BurntPizza (41 views)
2015-07-24 22:06:39

BurntPizza (24 views)
2015-07-24 06:06:53

NoxInc (29 views)
2015-07-22 22:16:53

NoxInc (18 views)
2015-07-22 22:13:39
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 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‑
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!