Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (579)
games submitted by our members
Games in WIP (500)
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  
  Multitexuring Using ARB  (Read 593 times)
0 Members and 1 Guest are viewing this topic.
Offline ilflyer12

Innocent Bystander





« Posted 2007-09-18 06:12:23 »

Hey everyone, i am trying to use multitexture in JOGL and keep getting a compilation error. For some reason the program doesnt not understand what GL.GL_MAX_TEXTURE_UNITS_ARB and what GL.GL_TEXTURE0_ARB are. I have had no other issues with my program except these. I have the following imports and my code is also below. I really appreciate the help and what to thank everyone in advance.

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  
import javax.media.opengl.GL;
import javax.vecmath.Point3f;

   public void draw (GL gl)
   {
      gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
     
      for(int i = 0; i < getNumFaces(); i++)
       {
          LevelFace face = getLevelFace(i);
         
          if(face.getType() != 1)
             continue;

          gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB);
           gl.glEnable(gl.GL_TEXTURE_2D);
         gl.glBindTexture(gl.GL_TEXTURE_2D, m_textures[pFace->texID].ID);
         
          gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE);
         
           gl.glBegin(gl.GL_TRIANGLE_FAN);

           for(int j = face.getStartVertexIndex(); j < face.getStartVertexIndex() + face.getTotalVertices(); j++)
           {
              Point3f vertex = getVertex(j);
                 
              gl.glVertex3f(vertex.x, vertex.y, vertex.z);
           }// for

           gl.glEnd();
           
           gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL);
       
       }// for
     
   }// draw


The other file
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  
import java.awt.*;
import java.awt.event.*;

import javax.media.opengl.*;
import javax.media.opengl.glu.GLU;

import Level.*;
import LevelLoader.LevelLoader;

import com.sun.opengl.util.*;

   public static void main(String[] args) {
   
      Frame frame = new Frame("Counter Strike");
       GLCanvas canvas = new GLCanvas();
       
       canvas.addGLEventListener(new WarthogStrike());
       frame.add(canvas);
       frame.setSize(800, 600);
     
       // Creates a thread that calls the display function for that drawable object
      final Animator animator = new Animator(canvas);

...
}

     public void init(GLAutoDrawable drawable) {
       // Use debug pipeline
      // drawable.setGL(new DebugGL(drawable.getGL()));
       
      fpsDisplay = new DisplayFPS (drawable);
     
       GL gl = drawable.getGL();      
       
       String extensions = gl.glGetString(GL.GL_EXTENSIONS);
       boolean bMultiTexturing = (extensions.indexOf("GL_ARB_multitexture") !=-1);
       
       if (!bMultiTexturing)
          System.err.println("MultiTexturing Disabled");
       
       int[] maxTextureUnits = new int[1];
   
       gl.glGetIntegerv(gl.GL_MAX_TEXTURE_UNITS_ARB, maxTextureUnits);
       
       int nbTextureUnits = maxTextureUnits[0];
       
       System.out.println("Texture Units available = " + nbTextureUnits);

       
       System.err.println("INIT GL IS: " + gl.getClass().getName());
   
       System.err.println("Chosen GLCapabilities: " + drawable.getChosenGLCapabilities());
   
       gl.setSwapInterval(1);

       gl.glEnable(GL.GL_DEPTH_TEST);              
                   
       drawable.addMouseListener(mouseEvents);
       drawable.addMouseMotionListener(mouseEvents);
       drawable.addKeyListener(keyEvents);
       
       LevelLoader loader = new LevelLoader();
       
       loader.loadLevel("src/LevelFiles/level2.bsp");
       currentLevel = loader.getLevel();
       
       camera = new Camera();
       
       camera.setCamera(0, 800, -150, 0, 150, -149, 0, 1, 0);
     }
Offline Ken Russell

JGO Coder




Java games rock!


« Reply #1 - Posted 2007-09-18 08:45:48 »

These constants were promoted into core OpenGL in version 1.3. As described in the JOGL Javadoc, all extensions folded into OpenGL 1.3 and earlier are only exposed via their core OpenGL names. You're looking for GL.GL_MAX_TEXTURE_UNITS and GL.GL_TEXTURE0.
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.

xsi3rr4x (37 views)
2014-04-15 18:08:23

BurntPizza (33 views)
2014-04-15 03:46:01

UprightPath (49 views)
2014-04-14 17:39:50

UprightPath (31 views)
2014-04-14 17:35:47

Porlus (48 views)
2014-04-14 15:48:38

tom_mai78101 (69 views)
2014-04-10 04:04:31

BurntPizza (129 views)
2014-04-08 23:06:04

tom_mai78101 (229 views)
2014-04-05 13:34:39

trollwarrior1 (193 views)
2014-04-04 12:06:45

CJLetsGame (200 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!