Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
Games in Android Showcase (114)
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 / Textured GL_QUADS joins in a cube enviroment on: 2007-04-07 02:49:15
Hi
i´ve created a world for my scene and all the enviroment is in a huge cube formed by 6 GL_QUADS.

gl.glPushMatrix()
  gl.glBegin(GL.GL_QUADS);
     //1st face
  gl.glEnd();

  gl.glBegin(GL.GL_QUADS);
     //2nd face
  gl.glEnd();
    .
    .
    .

  gl.glBegin(GL.GL_QUADS);
     //last face
  gl.glEnd();

gl.glPopMatrix();

The sequence above create a perfect box but the joins in limit of each quad are too visible.
I know there´s a command to hide this joins... someone can remind me hehehe? please

I´ve tried to use:

gl.glPushMatrix()
  gl.glBegin(GL.GL_QUADS);

      //1st face
      //2nd face
      //3rd face
        .
        .
        .

     //last face

  gl.glEnd();

gl.glPopMatrix();

the sequence above hide all visible joins but all faces receive the same texture.

I still not try use the last sequence shown and apply a mapped texture file. I think it can solve the problem but the situation I show in first sequence also have a solution.. I just don´t remember how
2  Java Game APIs & Engines / JOGL Development / Re: using "= new GLCanvas()" not GLDrawableFactory.getFactory().createGLCanvas() on: 2007-03-17 21:38:42
thank you.
3  Java Game APIs & Engines / JOGL Development / using "= new GLCanvas()" not GLDrawableFactory.getFactory().createGLCanvas() on: 2007-03-12 23:15:47
Can I do it in newest JOGL version?
myCanvas = new GLCanvas();

the line code bellow returns an error:
myCanvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
4  Java Game APIs & Engines / JOGL Development / Re: expected personal packages in jerome.jouvie.free.fr/OpenGl/Tutorials on: 2007-03-11 16:44:33
thanx ... the tutorial original developer sent me the link.. as soon as update the codes i´ll send you too... send me an email and I´ll reply with the zips
garrydias@gmail.com
5  Java Game APIs & Engines / JOGL Development / Re: Display lists slow when used with textures? on: 2007-03-09 05:48:59
I have not certain but I think the display  lists must be used to display severals shapes(objects). This case, if you would display 10 skybox(more or less) the display lists would be usefull.. but to display a single form I think is not needful to use display lists. "I think"
see also this website http://jerome.jouvie.free.fr/OpenGL/Tutorials/Tutorial16
6  Java Game APIs & Engines / JOGL Development / Re: Texture problems in nehe lesson on: 2007-03-09 05:36:07
Cool !!!!
God sake "dest.rewind()"  Grin and ken russel and everyone registered in javagamming.org
7  Java Game APIs & Engines / JOGL Development / expected personal packages in jerome.jouvie.free.fr/OpenGl/Tutorials on: 2007-03-09 05:20:44
does Someone know this web tutorial?

It´s so good as nehe tutorials but is in old version too. The apps are more elaborated and beauty. Have app to run on JFrame and Applet, is just to import the required package.

The camera tutorial provide you to run, strafe, jump and look up/down.

I have corrected all source codes (if someone wants.. email me).
This tutorial have many personal packages too usefull but some packages are not there.
are they:
opengl.common.Terrain
opengl.common.Vector
opengl.jogl.Tools   and
opengl.jogl.Component

By chance, does somebody have this packages or know how to get it?

 It´s a shucks do not run the remnant lessons. It will be usefull for everyone
8  Java Game APIs & Engines / JOGL Development / Re: Texture problems in nehe lesson on: 2007-03-07 15:55:42
I already atualized the nehe codes... the texture methods did not show problems
9  Java Game APIs & Engines / JOGL Development / Re: Texture problems in nehe lesson on: 2007-03-07 14:55:38
the exception returned is bellow:

Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Required 196608 remaining bytes in buffer, only had 0
   at com.sun.gluegen.runtime.BufferFactory.rangeCheckBytes(BufferFactory.java:274)
   at com.sun.opengl.impl.GLImpl.glTexImage2D(GLImpl.java:21147)
   at texturas.Lesson06$Renderer.makeRGBTexture(Lesson06.java:241)
   at texturas.Lesson06$Renderer.init(Lesson06.java:125)
   at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:72)
   at javax.media.opengl.GLCanvas$InitAction.run(GLCanvas.java:271)
   at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:189)
   at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:265)
   at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
   at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)
   at sun.awt.RepaintArea.paintComponent(Unknown Source)
   at sun.awt.RepaintArea.paint(Unknown Source)
   at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
   at java.awt.Component.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)
10  Java Game APIs & Engines / JOGL Development / Texture problems in nehe lesson on: 2007-03-07 14:50:19
Hi,
I got the code bellow and it is not loading the jpg, png an bmp textures. What kind of problem could be happen?

The lines of code responsible by textures loading are marked below in red rolor:
Obs: some methods are deleteted because the maximum caracteres are exceeded

/*
 * Lesson06.java
 *
 * Created on July 16, 2003, 11:30 AM
 */
package texturas;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.io.*;
import java.net.*;
import java.nio.*;
import javax.imageio.*;

import javax.media.opengl.*;
import javax.media.opengl.glu.*;
import com.sun.opengl.util.*;



/** Port of the NeHe OpenGL Tutorial (Lesson 6)
 * to Java using the Jogl interface to OpenGL.  Jogl can be obtained
 * at http://jogl.dev.java.net/
 *
 * @author Kevin Duling (jattier@hotmail.com)
 */
public class Lesson06
{
  static Animator animator = null;
  
  static class Renderer
    implements GLEventListener,
               KeyListener
  {
    private float   xrot;            // X Rotation ( NEW )
    private float   yrot;            // Y Rotation ( NEW )
    private float   zrot;            // Z Rotation ( NEW )
    private int texture;

    public void display(GLAutoDrawable gLDrawable)
    {
      final GL gl = gLDrawable.getGL();
      gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
      gl.glLoadIdentity();                           // Reset The View
      gl.glTranslatef(0.0f,0.0f,-5.0f);

      gl.glRotatef(xrot,1.0f,0.0f,0.0f);
      gl.glRotatef(yrot,0.0f,1.0f,0.0f);
      gl.glRotatef(zrot,0.0f,0.0f,1.0f);

      gl.glBindTexture(GL.GL_TEXTURE_2D, texture);

      gl.glBegin(GL.GL_QUADS);
        // Front Face
        gl.glTexCoord2f(0.0f, 0.0f); gl.glVertex3f(-1.0f, -1.0f,  1.0f);
        gl.glTexCoord2f(1.0f, 0.0f); gl.glVertex3f( 1.0f, -1.0f,  1.0f);
        gl.glTexCoord2f(1.0f, 1.0f); gl.glVertex3f( 1.0f,  1.0f,  1.0f);
        gl.glTexCoord2f(0.0f, 1.0f); gl.glVertex3f(-1.0f,  1.0f,  1.0f);
        // Back Face
        gl.glTexCoord2f(1.0f, 0.0f); gl.glVertex3f(-1.0f, -1.0f, -1.0f);
        gl.glTexCoord2f(1.0f, 1.0f); gl.glVertex3f(-1.0f,  1.0f, -1.0f);
        gl.glTexCoord2f(0.0f, 1.0f); gl.glVertex3f( 1.0f,  1.0f, -1.0f);
        gl.glTexCoord2f(0.0f, 0.0f); gl.glVertex3f( 1.0f, -1.0f, -1.0f);
        // Top Face
        gl.glTexCoord2f(0.0f, 1.0f); gl.glVertex3f(-1.0f,  1.0f, -1.0f);
        gl.glTexCoord2f(0.0f, 0.0f); gl.glVertex3f(-1.0f,  1.0f,  1.0f);
        gl.glTexCoord2f(1.0f, 0.0f); gl.glVertex3f( 1.0f,  1.0f,  1.0f);
        gl.glTexCoord2f(1.0f, 1.0f); gl.glVertex3f( 1.0f,  1.0f, -1.0f);
        // Bottom Face
        gl.glTexCoord2f(1.0f, 1.0f); gl.glVertex3f(-1.0f, -1.0f, -1.0f);
        gl.glTexCoord2f(0.0f, 1.0f); gl.glVertex3f( 1.0f, -1.0f, -1.0f);
        gl.glTexCoord2f(0.0f, 0.0f); gl.glVertex3f( 1.0f, -1.0f,  1.0f);
        gl.glTexCoord2f(1.0f, 0.0f); gl.glVertex3f(-1.0f, -1.0f,  1.0f);
        // Right face
        gl.glTexCoord2f(1.0f, 0.0f); gl.glVertex3f( 1.0f, -1.0f, -1.0f);
        gl.glTexCoord2f(1.0f, 1.0f); gl.glVertex3f( 1.0f,  1.0f, -1.0f);
        gl.glTexCoord2f(0.0f, 1.0f); gl.glVertex3f( 1.0f,  1.0f,  1.0f);
        gl.glTexCoord2f(0.0f, 0.0f); gl.glVertex3f( 1.0f, -1.0f,  1.0f);
        // Left Face
        gl.glTexCoord2f(0.0f, 0.0f); gl.glVertex3f(-1.0f, -1.0f, -1.0f);
        gl.glTexCoord2f(1.0f, 0.0f); gl.glVertex3f(-1.0f, -1.0f,  1.0f);
        gl.glTexCoord2f(1.0f, 1.0f); gl.glVertex3f(-1.0f,  1.0f,  1.0f);
        gl.glTexCoord2f(0.0f, 1.0f); gl.glVertex3f(-1.0f,  1.0f, -1.0f);
      gl.glEnd();

      xrot+=0.3f;
      yrot+=0.2f;
      zrot+=0.4f;
    }
   
     

    public void init(GLAutoDrawable gLDrawable)
    {
      final GL gl = gLDrawable.getGL();
      gl.glShadeModel(GL.GL_SMOOTH);              // Enable Smooth Shading
      gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);    // Black Background
      gl.glClearDepth(1.0f);                      // Depth Buffer Setup
      gl.glEnable(GL.GL_DEPTH_TEST);                     // Enables Depth Testing
      gl.glDepthFunc(GL.GL_LEQUAL);                        // The Type Of Depth Testing To Do
      gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);   // Really Nice Perspective Calculations
      gl.glEnable(GL.GL_TEXTURE_2D);
      gLDrawable.addKeyListener(this);
      texture = genTexture(gl);
      gl.glBindTexture(GL.GL_TEXTURE_2D, texture);
      BufferedImage img = readBMPImage("c:/NeHe.jpg");
      makeRGBTexture(gl, new GLU(), img, GL.GL_TEXTURE_2D, false);
        gl.glTexParameteri(GL.GL_TEXTURE_2D,GL.GL_TEXTURE_MIN_FILTER,GL.GL_LINEAR);
        gl.glTexParameteri(GL.GL_TEXTURE_2D,GL.GL_TEXTURE_MAG_FILTER,GL.GL_LINEAR);
    }

  
    public void reshape(GLAutoDrawable gLDrawable, int x, int y, int width, int height)
    {
      final GL gl = gLDrawable.getGL();
      final GLU glu = new GLU();
      
      if (height <= 0) // avoid a divide by zero error!
        height = 1;
      final float h = (float)width / (float)height;
      gl.glViewport(0, 0, width, height);
      gl.glMatrixMode(GL.GL_PROJECTION);
      gl.glLoadIdentity();
      glu.gluPerspective(45.0f, h, 1.0, 20.0);
      gl.glMatrixMode(GL.GL_MODELVIEW);
      gl.glLoadIdentity();
    }
    

    public void keyPressed(KeyEvent e)
    {
      if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
      {
        animator.stop();
        System.exit(0);
      }
    }

    

    
    private BufferedImage readBMPImage(String resourceName)
    {
      try
      {
        URL url = getResource(resourceName);
        if (url == null)
        {
          throw new RuntimeException("Error reading resource " + resourceName);
        }
        BufferedImage img = ImageIO.read(url);
        java.awt.geom.AffineTransform tx = java.awt.geom.AffineTransform.getScaleInstance(1, -1);
        tx.translate(0, -img.getHeight(null));
        AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
        img = op.filter(img, null);
        return img;
      }
      catch (IOException e)
      {
        throw new RuntimeException(e);
      }
    }
   

    private void makeRGBTexture(GL gl, GLU glu, BufferedImage img, int target, boolean mipmapped)
    {
      ByteBuffer dest = null;
      switch (img.getType())
      {
        case BufferedImage.TYPE_3BYTE_BGR:
        case BufferedImage.TYPE_CUSTOM:
        {
          byte[] data = ((DataBufferByte) img.getRaster().getDataBuffer()).getData();
          dest = ByteBuffer.allocateDirect(data.length);
          dest.order(ByteOrder.nativeOrder());
          dest.put(data, 0, data.length);
          break;
        }
        case BufferedImage.TYPE_INT_RGB:
        {
          int[] data = ((DataBufferInt) img.getRaster().getDataBuffer()).getData();
          dest = ByteBuffer.allocateDirect(data.length * BufferUtil.SIZEOF_INT);
          dest.order(ByteOrder.nativeOrder());
          dest.asIntBuffer().put(data, 0, data.length);
          break;
        }
        default:
          throw new RuntimeException("Unsupported image type " + img.getType());
      }
     
      if (mipmapped)
      {
        glu.gluBuild2DMipmaps(target, GL.GL_RGB8, img.getWidth(), img.getHeight(), GL.GL_RGB, GL.GL_UNSIGNED_BYTE, dest);
      }
      else
      {
        gl.glTexImage2D(target, 0, GL.GL_RGB, img.getWidth(), img.getHeight(), 0, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, dest);
      }
    }

    private int genTexture(GL gl)
    {
      final int[] tmp = new int[1];
      gl.glGenTextures(1, tmp, 0);
      return tmp[0];
    }
  }


  public final static URL getResource(final String filename)
  {
    // Try to load resource from jar
    URL url = ClassLoader.getSystemResource(filename);
    // If not found in jar, then load from disk
    if (url == null)
    {
      try
      {
        url = new URL("file", "localhost", filename);
      }
      catch (Exception urlException){} // ignore
    }
    return url;
  }

  /** Program's main entry point
   * @param args command line arguments.
   */
  public static void main(String[] args)
  {
    Frame frame = new Frame("Lesson 6: Texture Mapping");
    GLCanvas canvas = new GLCanvas();
    canvas.addGLEventListener(new Renderer());
    frame.add(canvas);
    frame.setSize(640, 480);
    animator = new Animator(canvas);
    frame.addWindowListener(new WindowAdapter()
    {
      public void windowClosing(WindowEvent e)
      {
        animator.stop();
        System.exit(0);
      }
    });
    frame.show();
    animator.start();
    canvas.requestFocus();
  }
}
11  Java Game APIs & Engines / JOGL Development / Re: Colision on: 2007-03-04 23:28:53
I´m using glu.gluPerspective() (real 3D). Using gluPerspective() i perceived that I would play around to find the best value to set as my world limit, like you said. Now, using gl.glOrtho() - not glu.glOrtho2D - a friend told me that I could make the X increasing based in each GLCanvas pixel but this advice did not make any sense. My intention was to find the values wich would be the limits but i thought could exist a better way. I´ll folow your last advice. thnx
12  Java Game APIs & Engines / JOGL Development / Colision on: 2007-03-04 19:24:39
Well,
i´m testing my first testing JOGL application. This application consists to move a simple poligon (GL_TRIANGLE) through my GLCanvas.
My quad translate with key events but the quad is passing over the width and height frame limits.
I´m using a 640x480 frame.
To translate my quad the X argument is increased.
What the value X must have to stop this increase and avoid the screenwidth limits trepassing???
13  Java Game APIs & Engines / JOGL Development / Normals problems on: 2007-03-01 13:34:20
Hi, i´m having problem with normals in my first 3D world.
my world dimensions is  disposed in a big cube.

When the camera is in cube I see the left ,right, front, back and botton faces but the up face is like blended.
When the camera is out cube I see the up face but don´t see the left ,right, front, back and botton faces.

Using c++ I used the GL_CULL_FACE command to resolve that problem and enabled the z buffer with GL_DEPTH_TEST.

I wrote a new application to draw a simple GL_QUAD and rotate it with mouse. Turning it in 360 degrees is possible to see only one of the faces.
How can i resolve it?Huh
14  Java Game APIs & Engines / JOGL Development / Re: Vector3f jogl implementation on: 2007-02-27 19:20:04
The Vec3f class is an equivalent class to Vector3f.
i saw Vec3f in jogl-demos?
any aid will be accept
thnx
15  Java Game APIs & Engines / JOGL Development / Vector3f jogl implementation on: 2007-02-27 17:45:33
Does exists a Vector3f implementation to  JOGL?
I got a tutorial that use this class....  probably it can´t be jogl but an j3d.
There´s a similar method or some implementation this class???
Where i can get a good camera moving tutorial???
16  Java Game APIs & Engines / JOGL Development / Re: Exceptions using eclipse on winXP OS on: 2007-02-15 18:46:54
as I supected
thanx
17  Java Game APIs & Engines / JOGL Development / Re: Exceptions using eclipse on winXP OS on: 2007-02-14 12:28:26
another doubt...
some apps don´t ran .. it gave the following message: Unable to initialize OPENGL_VERSION_1_3 OpenGL Extension

what about is it??
18  Java Game APIs & Engines / JOGL Development / Re: Exceptions using eclipse on winXP OS on: 2007-02-14 12:03:04
thanks, ken.. i was trying any way to run the app
Ultraq give the answer.. i ignored the gluegen_rt.jar in my build path configuration.
everything is running now

thank you
19  Java Game APIs & Engines / JOGL Development / Exceptions using eclipse on winXP OS on: 2007-02-10 19:35:54
Please help...
i´m using eclipse and just configured the build path to jogl-demos and many exceptions occured..
the jogl.dll is in jre/lib and in the system32 directory...  I redid the entire configuration process
The console message that i get is:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/gluegen/runtime/DynamicLookupHelper
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(Unknown Source)
   at java.security.SecureClassLoader.defineClass(Unknown Source)
   at java.net.URLClassLoader.defineClass(Unknown Source)
   at java.net.URLClassLoader.access$100(Unknown Source)
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClassInternal(Unknown Source)
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(Unknown Source)
   at java.security.SecureClassLoader.defineClass(Unknown Source)
   at java.net.URLClassLoader.defineClass(Unknown Source)
   at java.net.URLClassLoader.access$100(Unknown Source)
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClassInternal(Unknown Source)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Unknown Source)
   at javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:106)
   at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:113)
   at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:82)
   at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:75)
   at demos.gears.Gears.main(Gears.java:19)

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.

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

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

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

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

Tekkerue (40 views)
2014-09-09 02:24:56

mitcheeb (62 views)
2014-09-08 06:06:29

BurntPizza (45 views)
2014-09-07 01:13:42

Longarmx (30 views)
2014-09-07 01:12:14

Longarmx (36 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19
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!