Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
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] 2 3
1  Java Game APIs & Engines / JOGL Development / Re: Unexpected Behavior for Uniform Variable in Shader on: 2007-03-09 04:25:19
No, I don't want multiple rendering targets, but thanks for the tip.  The point of the code is to debug/understand the use of a uniform variable in a for loop.  The test fragment program is a simple example in which the loop turns on each color component of r, g, and b.

Also, unless I am way off, gl_FragColor = 1.0 only sets the index at i to 1.0 and is not the same as gl_FragColor = 1.0 which sets all 4 components to 1.0.
2  Java Game APIs & Engines / JOGL Development / Re: Unexpected Behavior for Uniform Variable in Shader on: 2007-03-08 06:24:32
Well, I found another machine to run the sample program on.  On that one the result was a whte fragment when using the uniform in the loop (even when reducing the value of foo to 0 or 1).  In my further research online the best I can tell is that using uniform variables in for loops is not recommended.  I am curious if this is the case with the new NVidia cards (the "Cuda" ones).  Both machines I ran the test on are fairly new OpenGL 2.0 cards with all of the desired extensions (The original is a 17" MacBook Pro and the other is some kind of Dell Workstation.  I'd have to do a little looking for the exact hardware configuration, but the card should be quite good.). 

Anyways, I am still interested in any of your results, comments, or knowledge on this matter.
3  Java Game APIs & Engines / JOGL Development / Unexpected Behavior for Uniform Variable in Shader on: 2007-03-07 17:03:49
Hi Folks,

I am working on a simple shader and am encountering some unexpected behavior that I though one of you might be able to help me with.  I have reduced the problem down to the simplest example I can think of.

My fragment shader simply runs a for loop over a specified uniform int (3 in this case) and sets the color for that index to 1.0.  This should result in a white fragment.  Instead, I get a yellow fragment, as if the passed value were 2 (red + green).  I can hard code the value to 3 in the shader and everything works as expected.

As near as I can figure, my problem is one of these:
1. Uniforms have trouble in for loops.
2. I am not passing things right (even though I can read the 3 back).
3. Something is wrong with how I am setting up the uniform variable.
4. My GL implementation has a bug.

Please have a look if you don't mind and let me know if you see anything wrong.  At a minimum please run the program and post whether you get a white or a yellow rectangle (or something else--that would be bad.).

I tried to self-contain everything.  The shader setup code is all in the setupShaderProgram function.  The variable in question is "foo".

Thanks for any help you can provide.

-Mark

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  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
import java.awt.BorderLayout;

import javax.media.opengl.*;
import javax.swing.JFrame;

import com.sun.opengl.util.Animator;

public class UniformTest extends JFrame implements GLEventListener
{
    private static final long serialVersionUID = -3280170375188457053L;
    private final GLCanvas canvas = new GLCanvas();
   
    public UniformTest()
    {
        super("UniformTest App");
       
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       
        final Animator animator = new Animator(canvas);
       
        canvas.addGLEventListener(this);
        this.add(canvas, BorderLayout.CENTER);
        setSize(800, 600);
       
        animator.start();
       
        setVisible(true);
    }

    /* (non-Javadoc)
     * @see javax.media.opengl.GLEventListener#display(javax.media.opengl.GLAutoDrawable)
     */

    public void display(GLAutoDrawable drawable)
    {
        GL gl = drawable.getGL();
       
        gl.glMatrixMode(GL.GL_MODELVIEW);
        gl.glLoadIdentity();
       
        gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT);
       
        //Just draw a square
        gl.glBegin(GL.GL_QUADS);
        gl.glVertex3f(-0.5f, -0.5f, 0.0f);
        gl.glVertex3f( 0.5f, -0.5f, 0.0f);
        gl.glVertex3f( 0.5f,  0.5f, 0.0f);
        gl.glVertex3f(-0.5f,  0.5f, 0.0f);
        gl.glEnd();
    }

    public void init(GLAutoDrawable drawable)
    {
        GL gl = drawable.getGL();

        gl.setSwapInterval(1);

        setupShaderProgram(gl);
    }
   
    private static void setupShaderProgram(GL gl)
    {
        //Just use the fixed function pipeline
        String vs = "void main() { gl_Position = ftransform(); }";
        int shaderIndex = gl.glCreateShader(GL.GL_VERTEX_SHADER);
        gl.glShaderSource(shaderIndex, 1, new String[] { vs }, new int[] { vs.length() }, 0);
        gl.glCompileShader(shaderIndex);
       
        //This is the code block in question.  If you replace "foo" with the
        //number 3 rather than using the uniform variable, you get the expected
        //behavior - A white fragment.  For some reason I get a yellow one
        //(red + green).
        String fs =
            "uniform int foo;" +
            "void main()" +
            "{" +
            "    int bar = 3;" +
            "    gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);" +
            "    for(int i = 0; i < foo; i++)" +
            "    {" +
            "        gl_FragColor[i] = 1.0;" +
            "    }" +
            "}";
       
        int fragmentIndex = gl.glCreateShader(GL.GL_FRAGMENT_SHADER);
        gl.glShaderSource(fragmentIndex, 1, new String[] { fs }, new int[] { fs.length() }, 0);
        gl.glCompileShader(fragmentIndex);
       
        int programIndex = gl.glCreateProgram();
        gl.glAttachShader(programIndex, shaderIndex);
        gl.glAttachShader(programIndex, fragmentIndex);
        gl.glLinkProgram(programIndex);
        gl.glUseProgram(programIndex);
        gl.glValidateProgram(programIndex);
       
        //This should give a white fragment color using the above shader.
        gl.glUniform1i(gl.glGetUniformLocation(programIndex, "foo"), 3);
       
        //Just for grins, make sure that foo is 3
        int[] foo = new int[1];
        gl.glGetUniformiv(programIndex, gl.glGetUniformLocation(programIndex, "foo"), foo, 0);
        System.out.println("foo is returned as " + foo[0]);
    }
   
    public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height)
    {
        GL gl = drawable.getGL();  
       
        //Set the projection
        gl.glMatrixMode(GL.GL_PROJECTION);
        gl.glLoadIdentity();
        gl.glOrtho(-1.0f, 1.0f, -1.0, 1.0, -1.0, 1.0);
       
        //Go back to MV mode
        gl.glMatrixMode(GL.GL_MODELVIEW);
        gl.glLoadIdentity();
    }
   
    /**
     * @param args
     */

    public static void main(String[] args)
    {
        Runnable runnable = new Runnable()
        {
            public void run()
            {
                new UniformTest();
            }
        };
       
        new Thread(runnable, "UniformTest").start();
    }
   
    //Unused
    public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { }
}
4  Java Game APIs & Engines / Java 3D / Re: Texture3D by Reference: Does it work? (source included) on: 2007-03-06 17:46:15
FYI: This was determined to be a bug in Java3D but is now fixed.
5  Java Game APIs & Engines / Java 3D / Re: Can I query for my J3D version? on: 2006-02-27 18:21:52
Great!  Thanks!
6  Java Game APIs & Engines / Java 3D / Can I query for my J3D version? on: 2006-02-27 17:03:51
Is there a way to determine what version of Java3D I am using at run time?  Some sort of J3D.getVersion() function or something?

Thanks!
7  Java Game APIs & Engines / Java 3D / Re: Texture3D by Reference: Does it work? (source included) on: 2006-02-27 16:56:03
Finally, here's the source for the nonfunctional 3D version.  Note the correct usage (If I understand correctly) of the ImageComponent3D.Updater interface to update the data.

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  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
/**
 *
 */

package help;

import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;

import javax.imageio.ImageIO;
import javax.media.j3d.*;
import javax.vecmath.*;

import com.sun.j3d.utils.behaviors.mouse.MouseRotate;

/**
 * @author Mark Bastian
 *
 */

public class ByRef3D extends TransformGroup implements ImageComponent3D.Updater
{
    public ByRef3D()
    {
        Appearance appearance = createAppearance();
       
        //Experimental behavior that modifies the image data
        addBehavior(appearance);
       
        GeometryArray[] geometry = createGeometry();
       
        for(int i = 0; i < geometry.length; i++)
        {
                //Create and add the shape
                Shape3D shape = new Shape3D(geometry[i], appearance);
                addChild(shape);
        }
       
        //All of this is unimportant.  It is just here to allow some mousing.
        Transform3D transform = new Transform3D();
        transform.setScale(0.5);
        setTransform(transform);
        setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
        setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        MouseRotate mb = new MouseRotate();
        mb.setSchedulingBounds(TextureByrefTester.getBoundingSphere());
        mb.setTransformGroup(this);
        this.addChild(mb);
    }
   
    /**
     * Create the 3D texture
     * @return created 3D texture
     */

    private Texture createTexture()
    {
        BufferedImage[] images = new BufferedImage[4];
        URL url0 = ByRef2D.class.getResource("/help/red.png");
        URL url1 = ByRef2D.class.getResource("/help/red.png");
        URL url2 = ByRef2D.class.getResource("/help/red.png");
        URL url3 = ByRef2D.class.getResource("/help/red.png");
        try
        {
            images[0] = ImageIO.read(url0);
            images[1] = ImageIO.read(url1);
            images[2] = ImageIO.read(url2);
            images[3] = ImageIO.read(url3);
        } catch(IOException e)
        {
            e.printStackTrace();
        }
       
        //Create the image data
        ImageComponent3D component = new ImageComponent3D(ImageComponent.FORMAT_RGBA, images, true, false);
        component.setCapability(ImageComponent.ALLOW_IMAGE_READ);
        component.setCapability(ImageComponent.ALLOW_IMAGE_WRITE);
       
        //Create the texture itself from the image component
        Texture3D texture = new Texture3D(Texture.BASE_LEVEL, Texture.RGBA,
                images[0].getWidth(), images[0].getHeight(), images.length);
        texture.setImage(0, component);
       
        return texture;
    }
   
    private Appearance createAppearance()
    {  
        //This is an essential ingredient to make sure the texture gets blended correctly
        TransparencyAttributes transAttrib = new TransparencyAttributes();
        transAttrib.setTransparencyMode(TransparencyAttributes.BLENDED);
       
        //Texture attributes
        TextureAttributes textureAttrib = new TextureAttributes();
        textureAttrib.setCapability(TextureAttributes.ALLOW_TRANSFORM_READ);
        textureAttrib.setCapability(TextureAttributes.ALLOW_TRANSFORM_WRITE);
        Transform3D textureTransform = new Transform3D();
        textureAttrib.setTextureTransform(textureTransform);
       
        //We want to show the back side of the polygon
        PolygonAttributes polygonAttrib = new PolygonAttributes();
        polygonAttrib.setCullFace(PolygonAttributes.CULL_NONE);
       
        Appearance appearance = new Appearance();
        appearance.setTransparencyAttributes(transAttrib);
        appearance.setPolygonAttributes(polygonAttrib);
        appearance.setTextureAttributes(textureAttrib);
        appearance.setTexture(createTexture());
       
        return appearance;
    }
   
    private GeometryArray[] createGeometry()
    {
        int dim = 128;
        GeometryArray[] geometry = new GeometryArray[dim];
       
        float w = 1.0f;
        float start = -w;
        float delta = 2.0f * w / (dim - 1);
       
        for(int i = 0; i < dim; i++)
        {
            float value = start + i * delta;
            geometry[i] = createQuad(value);
        }
       
        return geometry;
    }
   
    private GeometryArray createQuad(float z)
    {
        Point3f[] points = new Point3f[4];
        float dim = 1.0f;
        points[0] = new Point3f(-dim, -dim, z);
        points[1] = new Point3f( dim, -dim, z);
        points[2] = new Point3f( dim,  dim, z);
        points[3] = new Point3f(-dim,  dim, z);
       
        z = (z + 1.0f) * 0.5f;
        TexCoord3f[] texCoords = new TexCoord3f[4];
        texCoords[0] = new TexCoord3f(0.0f, 0.0f, z);
        texCoords[1] = new TexCoord3f(1.0f, 0.0f, z);
        texCoords[2] = new TexCoord3f(1.0f, 1.0f, z);
        texCoords[3] = new TexCoord3f(0.0f, 1.0f, z);
       
        QuadArray array = new QuadArray(4, GeometryArray.COORDINATES | GeometryArray.TEXTURE_COORDINATE_3);
        array.setCoordinates(0, points);
        array.setTextureCoordinates(0, 0, texCoords);
       
        return array;
    }
   
    private void addBehavior(final Appearance appearance)
    {
        final WakeupCondition condition = new WakeupOnElapsedTime(100);
       
        Behavior behavior = new Behavior()
        {
            @Override
            public void initialize()
            {
                wakeupOn(condition);
            }

            @Override
            public void processStimulus(Enumeration enumeration)
            {
                ImageComponent3D component = (ImageComponent3D)appearance.getTexture().getImage(0);
                for(int i = 0; i < 4; i++)
                {
                    component.updateData(ByRef3D.this, i, 0, 0, component.getWidth(), component.getHeight());
                }
            }
           
        };
       
        behavior.setSchedulingBounds(TextureByrefTester.getBoundingSphere());
        addChild(behavior);
    }

    public void updateData(ImageComponent3D component, int index, int x, int y, int width, int height)
    {
        BufferedImage image = component.getImage(index);
       
        for(int i = 0; i < width; i++)
        {
            for(int j = 0; j < height; j++)
            {
                Color c = new Color((int)(Math.random() * 256), (int)(Math.random() * 256), (int)(Math.random() * 256));
                image.setRGB(i, j, c.getRGB());
            }
        }
    }
}
8  Java Game APIs & Engines / Java 3D / Re: Texture3D by Reference: Does it work? (source included) on: 2006-02-27 16:54:40
And here's the source for the 2D version.  It works just fine.  Note the correct usage (If I understand correctly) of the ImageComponent2D.Updater interface to update the data.

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  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
/**
 *
 */

package help;

import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;

import javax.imageio.ImageIO;
import javax.media.j3d.*;
import javax.vecmath.*;

import com.sun.j3d.utils.image.TextureLoader;

/**
 * @author Mark Bastian
 *
 */

public class ByRef2D extends TransformGroup implements ImageComponent2D.Updater
{
    public ByRef2D()
    {
        //Create a square with the right texture coordinates
        GeometryArray array = createGeometry();
     
        //Load the texture
        Texture texture = createTexture();
       
        //Create the appearance of the shape
        Appearance appearance = createAppearance(texture);
        appearance.getTexture().getImage(0).setCapability(ImageComponent.ALLOW_IMAGE_READ);
        appearance.getTexture().getImage(0).setCapability(ImageComponent.ALLOW_IMAGE_WRITE);
       
        //Create and add the shape
        Shape3D shape = new Shape3D(array, appearance);
        addChild(shape);
       
        addBehavior(appearance);
    }
   
    private GeometryArray createGeometry()
    {
        Point3f[] points = new Point3f[4];
        float dim = 0.5f;
        points[0] = new Point3f(-dim, -dim, 0.0f);
        points[1] = new Point3f( dim, -dim, 0.0f);
        points[2] = new Point3f( dim,  dim, 0.0f);
        points[3] = new Point3f(-dim,  dim, 0.0f);
       
        TexCoord2f[] texCoords = new TexCoord2f[4];
        texCoords[0] = new TexCoord2f(0.0f, 0.0f);
        texCoords[1] = new TexCoord2f(1.0f, 0.0f);
        texCoords[2] = new TexCoord2f(1.0f, 1.0f);
        texCoords[3] = new TexCoord2f(0.0f, 1.0f);
       
        QuadArray array = new QuadArray(4, GeometryArray.COORDINATES | GeometryArray.TEXTURE_COORDINATE_2);
        array.setCoordinates(0, points);
        array.setTextureCoordinates(0, 0, texCoords);
       
        return array;
    }
   
    private Texture createTexture()
    {
        URL url = ByRef2D.class.getResource("/help/red.png");
        BufferedImage image = null;
        try
        {
            image = ImageIO.read(url);
        } catch(IOException e)
        {
            e.printStackTrace();
        }
       
        TextureLoader loader = new TextureLoader(image, TextureLoader.BY_REFERENCE);
        return loader.getTexture();
    }
   
    private Appearance createAppearance(Texture texture)
    {
        //This is an essential ingredient to make sure the texture gets blended correctly
        TransparencyAttributes transAttrib = new TransparencyAttributes();
        transAttrib.setTransparencyMode(TransparencyAttributes.BLENDED);
       
        //We want to show the back side of the polygon
        PolygonAttributes polygonAttrib = new PolygonAttributes();
        polygonAttrib.setCullFace(PolygonAttributes.CULL_NONE);
       
        Appearance appearance = new Appearance();
        appearance.setTransparencyAttributes(transAttrib);
        appearance.setPolygonAttributes(polygonAttrib);
        appearance.setTexture(texture);
       
        return appearance;
    }

    private void addBehavior(final Appearance appearance)
    {
        final WakeupCondition condition = new WakeupOnElapsedTime(100);
       
        Behavior behavior = new Behavior()
        {
            @Override
            public void initialize()
            {
                wakeupOn(condition);
            }

            @Override
            public void processStimulus(Enumeration arg0)
            {
                ImageComponent2D component = (ImageComponent2D)appearance.getTexture().getImage(0);
                component.updateData(ByRef2D.this, 0, 0, component.getWidth(), component.getHeight());
            }
           
        };
       
        behavior.setSchedulingBounds(TextureByrefTester.getBoundingSphere());
        addChild(behavior);
    }
   
    public void updateData(ImageComponent2D component, int x, int y, int width, int height)
    {
        BufferedImage image = component.getImage();
       
        for(int i = 0; i < width; i++)
        {
            for(int j = 0; j < height; j++)
            {
                Color c = new Color((int)(Math.random() * 256), (int)(Math.random() * 256), (int)(Math.random() * 256));
                image.setRGB(i, j, c.getRGB());
            }
        }
    }
}
9  Java Game APIs & Engines / Java 3D / Re: Texture3D by Reference: Does it work? (source included) on: 2006-02-27 16:53:16
Here's the source for the main function.  It is just boilerplate:
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  
/**
 *
 */

package help;

import java.awt.*;
import java.awt.event.*;

import javax.media.j3d.*;
import javax.swing.*;
import javax.vecmath.*;

import com.sun.j3d.utils.universe.SimpleUniverse;

/**
 * @author Mark Bastian
 *
 */

public class TextureByrefTester extends JFrame
{
    private static final long serialVersionUID = 3481159812056854703L;
   
    public TextureByrefTester()
    {
        super("TextureTest");
       
        setSize(800, 600);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       
        //Create canvas
        GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
        Canvas3D canvas = new Canvas3D(config);
       
        //Create universe
        final SimpleUniverse universe = new SimpleUniverse(canvas);
        universe.getViewingPlatform().setNominalViewingTransform();
       
        setLayout(new BorderLayout());
        add(canvas, BorderLayout.CENTER);
       
        //Add the GUI stuff needed to generate the nodes
        JPanel panel = new JPanel();
        add(panel, BorderLayout.SOUTH);
       
        JButton btn2D = new JButton("2D byRef");
        btn2D.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent event)
            {
                BranchGroup bg = new BranchGroup();
                bg.addChild(new ByRef2D());
                universe.addBranchGraph(bg);
            }
        });
        panel.add(btn2D);
       
        JButton btn3D = new JButton("3D byRef");
        btn3D.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent event)
            {
                BranchGroup bg = new BranchGroup();
                bg.addChild(new ByRef3D());
                universe.addBranchGraph(bg);
            }
        });
        panel.add(btn3D);
    }
   
    public static Bounds getBoundingSphere()
    {
        return new BoundingSphere(new Point3d(), 100.0);
    }
   
    /**
     * @param args
     */

    public static void main(String[] args)
    {
        new TextureByrefTester().setVisible(true);
    }
}
10  Java Game APIs & Engines / Java 3D / Texture3D by Reference: Does it work? (source included) on: 2006-02-27 16:52:05
Howdy Folks,

I am working on texture by reference.  My 2D version works, but the 3D does nothing (no exceptions, no errors, nothing).  The 3D image remains the same.  I am properly following the requirements for this as outlined in the docs and on postings.  I am calling updateData from an ImageComponent and doing the updating in the updateData function of a class implementing ImageComponent3D.Updater.  Unforunately, there aren't any examples I have seen in which this has been done on the web.

Would any of you be willing to take a look at my test case to see if you can figure out what the heck is going on?  Thanks.   At a minimum, this will let those of you who want to do 2D byref have an example to go by.

I will attach the code as 3 .txt files.  Rename each to .java and put in a package named help if you want to run this code.  There is also an attached png that needs to go in the help package.  I will be posting the code here subsequently for those who just want to look.

Thanks again!
11  Java Game APIs & Engines / JOGL Development / Re: Problem: Scrambled pixels when resizing on: 2005-01-07 17:10:53
Can any of you verify that this happens to you?  Any ideas as to why this is happening?
12  Java Game APIs & Engines / JOGL Development / Re: GLSL: Please help me debug - source included! on: 2004-12-17 14:53:10
Yeah, I realize that I can write assembly style stuff with the ARB_*_program extensions.  What I want is to use the ARB_*_shader extensions to do high level stuff.  

I have in fact run and written stuff based on the newly revamped ARB based demos.  I think these updates are great!

Even if I can't do GLSL now, I am still very curious about why you would support the three shader object extensions and not support GL_ARB_shading_language_100.  It just seems pointless, but surely there must be a reason.  Any ideas?
13  Java Game APIs & Engines / JOGL Development / Re: GLSL: Please help me debug - source included! on: 2004-12-17 12:01:47
Ok, so I got a response from Apple (Talk about fast turnaround).  Here's the scoop.

I was incorrect that you need only the ARB_fragment_shader, ARB_vertex_shader, and ARB_shader_objects extensions to run GLSL programs.  You also need GL_ARB_shading_language_100.

I verified that my home machine (Windows XP w/ ATI Radeon 9600XT) does indeed have all of the above, which explains why the sample works on that machine.

This leaves me with 2 questions:
1.  Do any of you have Windows machines with either a GeForce FX 5200 Ultra or an ATI Mobility Radeon 9700?  If so, would you mind running the above sample and tell me if it works?  Or, could you just dump the extension string and tell me if GL_ARB_shading_language_100 is supported?  I think it should be as long as the drivers are updated, but I would like to be sure.

2.  What is the purpose of having the ARB_fragment_shader, ARB_vertex_shader, and ARB_shader_objects extensions without GL_ARB_shading_language_100?  It seems like that is saying that the hardware supports high level shaders but doesn't implement them.  Is this interpretation correct?

Thanks!
14  Java Game APIs & Engines / JOGL Development / Re: GLSL: Please help me debug - source included! on: 2004-12-15 17:08:19
Wow, some people have the greatest jobs!

Here's the sample.  Please read the comments inserted.  I think there is some interesting stuff.  I tried to be thorough.  I also submitted a bug report earlier today (#3921753) to ADC but that version of the C source is now out of date.  This one is much better.  I will update that, too.

Thanks!

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  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
#include <stdlib.h>

#include <GLUT/glut.h>
//Note the name change here.  I am using the sgi glext.h file since it is more
//recent than the one in the OpenGL framework for Mac OS X.  It seems to work.
#include <OpenGL/glextsgi.h>

//Can a program get any simpler?
static char* vs =
      "//\n"
      "//The simplest vertex shader ever\n"
    "void main()\n"
    "{\n"
    "  gl_Position = ftransform();\n"
      "  //Sanity check: Smash everything to a point-doesn't work when enabled\n"
    "  //gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n"
      "}\n";

static char* fs =
      "//\n"
      "//The simplest fragment shader ever\n"
      "//Just color the fragment red\n"
      "void main()\n"
      "{\n"
      "gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
      "}\n";
     
void display(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glLoadIdentity();
      glTranslatef(0.0f, 0.0f, -5.0f);
     
    glBegin(GL_QUADS);
      glVertex3f(-1.0f, -1.0f, 0.0f);
      glVertex3f(+1.0f, -1.0f, 0.0f);
      glVertex3f(+1.0f, +1.0f, 0.0f);
      glVertex3f(-1.0f, +1.0f, 0.0f);
      glEnd();

    glutSwapBuffers();
}

void reshape(int width, int height)
{
    glViewport(0, 0, width, height);
     
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      gluPerspective(60.0, (double)width / (double)height, 0.01, 10.0);
      glMatrixMode(GL_MODELVIEW);
}

void idle(void)
{
    glutPostRedisplay();
}
     
//Note that this loading routine is a very heavily modified (simplified and printf commented)
//version of the routine found in the ogl2brick orange book example by Randi Rost.
//See chapter 7 of the orange book, esp. listing 7.2 for details.
void installShaders(const GLcharARB *simpleVertex, const GLcharARB *simpleFragment)
{
    GLhandleARB simpleVS, simpleFS, simpleProg;
    GLint vertCompiled, fragCompiled;
    GLint linked;

    printf("Attempting to create two shaders\n");

    // Create a vertex shader object and a fragment shader object
    simpleVS = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
    simpleFS = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);

    printf("Shaders created...\nLoading shader source...\n");
     
    // Load source code strings into shaders
    glShaderSourceARB(simpleVS, 1, &simpleVertex, NULL);
    glShaderSourceARB(simpleFS, 1, &simpleFragment, NULL);

    printf("Source loaded...\nCompiling the vertex shader...\n");
    //Compile the shader
      glCompileShaderARB(simpleVS);

    printf("Shader compiling.  Awaiting result...\n");

    //Block until we know the compilation status
    glGetObjectParameterivARB(simpleVS, GL_OBJECT_COMPILE_STATUS_ARB, &vertCompiled);

    if(GL_TRUE == vertCompiled)
          printf("Vertex shader compiled successfully!\n");
    else
          printf("Vertex shader compilation failed!\n");

    printf("Compiling the fragment shader...\n");
    //Compile the shader
    glCompileShaderARB(simpleFS);
     
      printf("Shader compiling.  Awaiting result...\n");
     
    //Block until we know the compilation status
    glGetObjectParameterivARB(simpleFS, GL_OBJECT_COMPILE_STATUS_ARB, &fragCompiled);

    if(GL_TRUE == fragCompiled)
          printf("Fragment shader compiled successfully!\n");
    else
          printf("Fragment shader compilation failed!\n");

    //Return due to failure
    if((GL_TRUE != vertCompiled) || (GL_TRUE != fragCompiled)) return 0;

    printf("Create a GPU program object...");
     
    // Create a program object and attach the two compiled shaders
    simpleProg = glCreateProgramObjectARB();
     
      printf("Attaching shaders to the program...\n");
     
    glAttachObjectARB(simpleProg, simpleVS);
    //An interesting thing is that if you comment this line you have no fragment
      //shading element.  This should successfully link and just use the fixed
      //function vertex processor.  That is what the orange book says.  Instead,
      //if you comment this line, the code won't link.
      glAttachObjectARB(simpleProg, simpleFS);

    printf("Shaders attached.\nLinking...");
     
    // Link the program object and print out the info log
    glLinkProgramARB(simpleProg);
     
      printf("Program linking.  Awaiting result...\n");
     
      //Block until we know the link status
    glGetObjectParameterivARB(simpleProg, GL_OBJECT_LINK_STATUS_ARB, &linked);

    if(GL_TRUE == linked)
          printf("Linked successfully!\n");
    else
          printf("Linking failed!\n");

    if(GL_TRUE != linked) return;

    // Install program object as part of current state
    printf("Using the program...\n");
    glUseProgramObjectARB(simpleProg);
     
      if(0 != glGetError()) printf("A GL Error Occurred!");
      printf("Successfully loaded the shader program!\n");
}

int main(int argc, char** argv)
{
    int success = 0;
     
    glutInit(&argc, argv);

    glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
    glutInitWindowSize(640, 480);
    glutCreateWindow("Simple GLSL Test Program");
   
      #ifdef GL_ARB_shader_objects
    printf("GL_ARB_shader_objects present\n");
    #endif
     
      #ifdef GL_ARB_vertex_shader
    printf("GL_ARB_vertex_shader present\n");
    #endif
     
      #ifdef GL_ARB_fragment_shader
    printf("GL_ARB_fragment_shader present\n");
    #endif
     
    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
    glutIdleFunc(idle);
     
      installShaders(vs, fs);
     
    glutMainLoop();
    return EXIT_SUCCESS;
}
15  Java Game APIs & Engines / JOGL Development / Re: GLSL: Please help me debug - source included! on: 2004-12-15 15:56:18
Sure thing!  I'll put it up in a bit.  In the mean time, gziemski, have you tried running my JOGL version?  What was your result?

Edit:  I am assuming you are running on a Mac, of course!
16  Java Game APIs & Engines / JOGL Development / Re: GLSL: Please help me debug - source included! on: 2004-12-15 13:55:21
I decided to go the tedious route and write a C implemetation using GLUT and sure enough, I get only a white square.  It looks like the Mac doesn't properly implement the latest shader extensions (Even though both or my OS X cards claim 1.5+ compliance and list all of the required extension strings!).

Can any of you other Mac users out there run the above code and post your results, just so I can get a few more data points to further justify my results?
17  Java Game APIs & Engines / JOGL Development / Re: GLSL: Please help me debug - source included! on: 2004-12-15 01:36:42
Interesting.  I just ran the code on my home machine (XP Home with ATI Radeon 9600 XT) and I now get the red square.  This makes me Smiley that my code seems right but Sad that it doesn't work on my Macs.  

So, let me solicit your advice on this issue with my Macs:
Both are OS X.  One is a dual G5 PowerMac wth a GeForce FX 5200 Ultra and the other is a PowerBook G4 with an ATI Radeon Mobility 9700.  Both have the requisite ARB_fragment_shader, ARB_vertex_shader, and ARB_shader_object extensions.  Both state that the shaders compile and the program links.  The program object has a nonzero index.  After all this, the square is white!

I believe the problem is either 1)the Mac implementation of OpenGL or 2)the JOGL Mac bindings.  I lean towards 1 because the problem occurs on the Mac but I lean towards 2 because the prerequisites are met and nothing is reported as an error.

Two tests to narrow things down:
1) Do any of you know of any non-JOGL GLSL demos out there for the Mac?
2) Are any of you other Mac users able to get the red square?

Any other ideas?

Thanks!
18  Java Game APIs & Engines / JOGL Development / GLSL: Please help me debug - source included! on: 2004-12-14 20:59:10
Hi Folks,

I am trying to make a very simple GLSL program.  Attached is the current version.  Note that the shader string fragments are at the very bottom.  After tediously following the instructions in the Orange Book, I would expect to see a spinning red square.  Instead, I get a spinning white square.  The only function of importance should be GLEventListener.init(), starting on line 157.

Can you all run the program and do something for me:
1. Tell me what color your square is.
2. Give me any advice you have on what could be going wrong if you also get a white square.

As far as program logic goes, the fragment shader should just make the fragment red.  As a sanity check, I tried putting all vertices at (0,0,0) but it looks like the fixed function pipeline still rules.

Thanks!

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  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
/*
 * Created on Dec 7, 2004
 */

import javax.swing.JFrame;
import net.java.games.jogl.*;
import net.java.games.jogl.GLDrawable;

/**
 * @author Mark Bastian (shaddam_IV on JOGL message boards)
 *
 */

public class TheSimplestVertexShader extends JFrame
{
    public TheSimplestVertexShader()
    {
        super("The Simplest Bare-Bones Shader Ever!");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(800, 600);
        initialize();
    }
   
    private static int loadShader(GL gl, String[] shaders, int shaderType)
    {
        //Following the steps in the orange book...
       
        //1. Create an empty shader object
        int shader = gl.glCreateShaderObjectARB(shaderType);
       
        //Sanity checks
        assert shader != 0; assert 0 == gl.glGetError();
       
        //Create an array consisting of shader lengths
        int[] lengths = new int[shaders.length];
        for(int i = 0; i < shaders.length; i++) lengths[i] = shaders[i].length();
       
        //2. Provide shader source code
        //Everything is simply copied over.  There is not compiling and such done at
        //this time.  Resources may be freed or modified after the call is made since
        //a copy is performed.
        gl.glShaderSourceARB(shader, shaders.length, shaders, lengths);

        assert 0 == gl.glGetError();
       
        //3. Compile the shader
        gl.glCompileShaderARB(shader);
       
        assert 0 == gl.glGetError();
       
        validateShader(gl, shader);
       
        return shader;
    }
   
    private static void validateShader(GL gl, int shader)
    {
        //3a. Check the status of compilation
        int[] compileStatus = new int[1];
        gl.glGetObjectParameterivARB(shader, GL.GL_OBJECT_COMPILE_STATUS_ARB, compileStatus);
        if(compileStatus[0] == GL.GL_TRUE)
        {
            System.out.println("Shader compiled!");
        }
        else
        {
            System.out.println("Shader compilation failed!  Log dump:");
            int[] infologlength = new int[1];
            byte[] infolog = new byte[1024];
            gl.glGetInfoLogARB(shader, 1024, infologlength, infolog);
            String logstr = new String(infolog);
            System.out.println(logstr);
        }
    }
   
    private static void loadProgram(GL gl, String[] vertexShaders, String[] fragmentShaders)
    {
        int vertexShader = loadShader(gl, vertexShaders, GL.GL_VERTEX_SHADER_ARB);
        int fragmentShader = loadShader(gl, fragmentShaders, GL.GL_FRAGMENT_SHADER_ARB);
       
        //4. Create the program object
        //The object is initially empty, so you will need to link a shader to it.
        int programObject = gl.glCreateProgramObjectARB();
       
        assert 0 != programObject; assert 0 == gl.glGetError();
       
        //5. Attach the shader object to the program.  You can link as many shaders
        //as you want to a program object.  Once the linking is done, you no longer
        //need the shader object.
        gl.glAttachObjectARB(programObject, vertexShader);
        gl.glAttachObjectARB(programObject, fragmentShader);
       
        assert 0 == gl.glGetError();
       
        //6. Link the program object.
        gl.glLinkProgramARB(programObject);
       
        //6a. Check the status of compilation
        int[] linkStatus = new int[1];
        gl.glGetObjectParameterivARB(programObject, GL.GL_OBJECT_LINK_STATUS_ARB, linkStatus);
       
        assert 0 == gl.glGetError();
       
        if(linkStatus[0] == GL.GL_TRUE)
        {
            System.out.println("Program linked!");
        }
        else
        {
            System.out.println("Linking failed!  Log dump:");
            int[] infologlength = new int[1];
            byte[] infolog = new byte[1024];
            gl.glGetInfoLogARB(programObject, 1024, infologlength, infolog);
            String logstr = new String(infolog);
            System.out.println(logstr);
            System.exit(-1);
        }
       
        assert 0 == gl.glGetError();
       
        //7. Install the program into the current state machine
        gl.glUseProgramObjectARB(programObject);
       
        assert 0 == gl.glGetError();
    }
   
    private void initialize()
    {
        GLCapabilities glcaps = new GLCapabilities();
        GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(glcaps);
        final Animator animator = new Animator(canvas);
       
        canvas.addGLEventListener(new GLEventListener()
        {
            private float theta = 0.0f;
            public void display(GLDrawable drawable)
            {
                GL gl = drawable.getGL();
               
                assert 0 == gl.glGetError();
               
                gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
                gl.glLoadIdentity();
                gl.glTranslatef(0.0f, 0.0f, -5.0f);
                gl.glRotatef(theta += 1.0f, 1.0f, 1.0f, 0.0f);
               
                gl.glBegin(GL.GL_QUADS);
                gl.glVertex3f(-1.0f, -1.0f, 0.0f);
                gl.glVertex3f(+1.0f, -1.0f, 0.0f);
                gl.glVertex3f(+1.0f, +1.0f, 0.0f);
                gl.glVertex3f(-1.0f, +1.0f, 0.0f);
                gl.glEnd();
               
                assert 0 != gl.glGetHandleARB(GL.GL_PROGRAM_OBJECT_ARB);
            }

            public void displayChanged(GLDrawable arg0, boolean arg1, boolean arg2) {}

            public void init(GLDrawable drawable)
            {
                String[] vertexShaders = {vs};
                String[] fragmentShaders = {fs};
                GL gl = drawable.getGL();
                loadProgram(gl, vertexShaders, fragmentShaders);
            }

            public void reshape(GLDrawable drawable, int x, int y, int w, int h)
            {
                GL gl = drawable.getGL();
                GLU glu = drawable.getGLU();
                double aspect = (h != 0.0) ? (double)w / (double)h : 1.0;
                gl.glMatrixMode(GL.GL_PROJECTION);
                gl.glLoadIdentity();
                glu.gluPerspective(60.0, aspect, 0.01, 10.0);
                gl.glMatrixMode(GL.GL_MODELVIEW);
            }
        });
        getContentPane().add(canvas);
        show();
        animator.start();
    }
   
    public static void main(String[] args)
    {
        new TheSimplestVertexShader();
    }
   
    private static String vs =
        "//\n"+
        "//The simplest vertex shader ever\n"+
        "void main()\n"+
        "{\n"+
        "    gl_Position = ftransform();\n" +
        "    //Sanity check: Smash everything to a point-doesn't work when enabled\n"+
        "    //gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n"+
        "}\n";
   
    private static String fs =
        "//\n"+
        "//The simplest fragment shader ever\n" +
        "//Just color the fragment red\n"+
        "void main()\n"+
        "{\n"+
        "    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"+
        "}\n";
}
19  Java Game APIs & Engines / JOGL Development / Re: [Announcement] JSR-231 and JOGL on: 2004-12-14 15:14:53
I too am very excited about this development.  I have two suggestions:

1. Modify the JSR to specify generation of current bindings to follow the latest version of OpenGL.

2. Provide precompiled binaries and libs instead of requiring a source checkout and compile for those of us who want to use the code but not work on it.

Yay for the JSR!
20  Java Game APIs & Engines / JOGL Development / Re: glslang: Does it work for you? on: 2004-12-14 13:40:30
Thanks for the info.  I dug around on NeHe but only saw an article referencing GLSL.  There wasn't any sample code in C/C++ or JOGL.  Is that what you were referring to?

I was looking at the Aviatrix code but that one requires you to get their whole schebang.  I would prefer to see a very minimal implementation.

My main question was if it worked for anyone (particularly OS X users) since I just want to make sure the libraries are up to speed (I figured they were).  I think I will bang my head on this some more and then maybe post code if I get it looking somewhat respectable.  If any of you have a very simple glslang demo you would like to share, I would be glad to see it. Smiley
21  Java Game APIs & Engines / JOGL Development / glslang: Does it work for you? on: 2004-12-13 20:34:48
Has anyone gotten any glslang code working in JOGL?  I am trying to port the ogl2brick example and all I get is a white unshaded brick instead of a brick that looks like a brick.  My machine (Mac OS X with GeForce FX 5200, IIRC) has all of the required extensions.

My other machine is a PowerBook G4 with a Radeon 9700, so it should work, too.  I also get a white brick with it.
22  Java Game APIs & Engines / JOGL Development / Re: How to pronounce JOGL on: 2004-12-12 13:29:59
I say Joe-Gull.
23  Java Game APIs & Engines / JOGL Development / Re: JSR 231: Java OpenGL Bindings Status on: 2004-12-12 04:25:13
I too am always curious about the JSR and am a bit disappointed with the lack of progress.  Sun acts very much like they are behind the JSR but I don't see much action.  My guess is that there are politics involoved.  The ARB consists of several members who all want to turn out a quality product.  OpenGL sometimes cooks slowly, but it always tastes great when done (As opposed to DX, where you just throw stuff in with no planning and force everyone to comply.  If the feature sucks, you just deprectate it in the next version of the API which will generally be out in less than a year.).  

However, I do think it is incorrect to say that this site isn't updated very much.  Although the site isn't as pretty I would like, you should note that the bindings are updated fairly reguarly (OpenGL 1.5 Compliant, pbuffers work on the Mac now, and so forth) and that the demos have also been recently updated (They used to mostly only work on Windoze nVidia cards, now they work on pretty much anything with correct ARB extensions).
24  Java Game APIs & Engines / JOGL Development / Problem: Scrambled pixels when resizing on: 2004-12-01 11:52:14
When I run any JOGL program (including my own and the ones hosted here) if I resize the main frame of the program slowly I can always get a behavior in which a few columns and/or rows of pixels on one or two edges are not refreshed.  This is an easily repeated problem on all of the platforms and machines I have run JOGL programs on.  Have any of you found a way to resolve this issue?

BTW, is there an easy way to embed an image in this post without a redirect?  I have an image of this I can show if anyone is interested.
25  Java Game APIs & Engines / JOGL Development / Re: PBuffers on: 2004-08-19 17:36:46
Quote
The Mac only had Pbuffers announced a few days ago.


Any ideas as to how soon pbuffer support will be available on OS X then?  Do we have to wait for an Apple update, a JOGL update, or both?
26  Java Game APIs & Engines / JOGL Development / Re: render and capture offscreen on: 2004-07-01 04:02:04
Quote
I am not very familiar with X so I don't know.  Creating Pbuffers seems to be a very touchy operation.  As you can see from a couple posts up sometimes it fails with no error code.  That isn't supposed to happen.  It is really quite frustrating.  Are you using a ATI card?  They seem to be a little more fickle than nvidia.


Yes, it is an ATI  Sad
27  Java Game APIs & Engines / JOGL Development / Re: render and capture offscreen on: 2004-07-01 02:33:11
Hey GKW,

Thanks for the sample code.  Unfortunately, when I try to run it on my Linux box (Fedora Core 1), I get the following:

Exception in thread "main" net.java.games.jogl.GLException: pbuffer creation error: glXChooseFBConfig() failed
     at net.java.games.jogl.impl.x11.X11PbufferGLContext.createPbuffer(X11PbufferGLContext.java:179)
     at net.java.games.jogl.impl.x11.X11OnscreenGLContext.makeCurrent(X11OnscreenGLContext.java:117)
     at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:203)
     at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:186)
     at net.java.games.jogl.GLCanvas.display(GLCanvas.java:74)
     at PBDemo.<init>(PBDemo.java:48)
     at PBDemo.main(PBDemo.java:123)

Any idea as to what the problem is?
28  Java Game APIs & Engines / JOGL Development / Re: What makes a context current? on: 2004-07-01 01:59:55
Thanks a million.  As a follow on question, where exactly should the pbuffer be created?  Does it have to be created at construction (before the Animator starts)?  Can you resize a pbuffer via resize() or will this make it poop out?
29  Java Game APIs & Engines / JOGL Development / What makes a context current? on: 2004-07-01 01:36:23
Hi all,

If I have multiple GLDrawables (e.g. A main GLCanvas and a GLPbuffer) what sets the current context?  GLDrawable.display()?  getGL()?

Thanks
30  Java Game APIs & Engines / JOGL Development / Re: Animator question. on: 2004-06-29 20:02:25
Quote
If you just setup a thread that calls display it will work, but it takes a little extra care to exit gracefully.


Are there any downsides other than the graceful exit?  What all is done to achieve the graceful exit?
Pages: [1] 2 3
 

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

The first screenshot will be displayed as a thumbnail.

rwatson462 (37 views)
2014-12-15 09:26:44

Mr.CodeIt (31 views)
2014-12-14 19:50:38

BurntPizza (62 views)
2014-12-09 22:41:13

BurntPizza (99 views)
2014-12-08 04:46:31

JscottyBieshaar (60 views)
2014-12-05 12:39:02

SHC (74 views)
2014-12-03 16:27:13

CopyableCougar4 (77 views)
2014-11-29 21:32:03

toopeicgaming1999 (138 views)
2014-11-26 15:22:04

toopeicgaming1999 (127 views)
2014-11-26 15:20:36

toopeicgaming1999 (38 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!