View | Details | Raw Unified | Return to bug 572
Collapse All | Expand All

(-)src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java (-41 / +43 lines)
Lines 18-24 Link Here
18
import javax.media.opengl.GLDrawableFactory;
18
import javax.media.opengl.GLDrawableFactory;
19
import javax.media.opengl.GLException;
19
import javax.media.opengl.GLException;
20
import javax.media.opengl.GLProfile;
20
import javax.media.opengl.GLProfile;
21
import javax.media.opengl.glu.GLU;
22
21
23
import com.ardor3d.annotation.MainThread;
22
import com.ardor3d.annotation.MainThread;
24
import com.ardor3d.framework.CanvasRenderer;
23
import com.ardor3d.framework.CanvasRenderer;
Lines 140-186 Link Here
140
        }
139
        }
141
140
142
        _context.makeCurrent();
141
        _context.makeCurrent();
143
142
        try {
144
        // Look up a shared context, if a shared JoglCanvasRenderer is given.
143
	        // Look up a shared context, if a shared JoglCanvasRenderer is given.
145
        RenderContext sharedContext = null;
144
	        RenderContext sharedContext = null;
146
        if (settings.getShareContext() != null) {
145
	        if (settings.getShareContext() != null) {
147
            sharedContext = ContextManager.getContextForKey(settings.getShareContext().getRenderContext()
146
	            sharedContext = ContextManager.getContextForKey(settings.getShareContext().getRenderContext()
148
                    .getContextKey());
147
	                    .getContextKey());
148
	        }
149
	
150
	        final ContextCapabilities caps = createContextCapabilities();
151
	        _currentContext = new RenderContext(_context, caps, sharedContext);
152
	
153
	        ContextManager.addContext(_context, _currentContext);
154
	        ContextManager.switchContext(_context);
155
	
156
	        _renderer = new JoglRenderer();
157
	
158
	        if (settings.getSamples() != 0 && caps.isMultisampleSupported()) {
159
	            final GL gl = _context.getGL();
160
	            gl.glEnable(GL.GL_MULTISAMPLE);
161
	        }
162
	
163
	        _renderer.setBackgroundColor(ColorRGBA.BLACK);
164
	
165
	        if (_camera == null) {
166
	            /** Set up how our camera sees. */
167
	            _camera = new Camera(settings.getWidth(), settings.getHeight());
168
	            _camera.setFrustumPerspective(45.0f, (float) settings.getWidth() / (float) settings.getHeight(), 1, 1000);
169
	            _camera.setProjectionMode(ProjectionMode.Perspective);
170
	
171
	            final Vector3 loc = new Vector3(0.0f, 0.0f, 10.0f);
172
	            final Vector3 left = new Vector3(-1.0f, 0.0f, 0.0f);
173
	            final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f);
174
	            final Vector3 dir = new Vector3(0.0f, 0f, -1.0f);
175
	            /** Move our camera to a correct place and orientation. */
176
	            _camera.setFrame(loc, left, up, dir);
177
	        } else {
178
	            // use new width and height to set ratio.
179
	            _camera.setFrustumPerspective(_camera.getFovY(),
180
	                    (float) settings.getWidth() / (float) settings.getHeight(), _camera.getFrustumNear(), _camera
181
	                            .getFrustumFar());
182
	        }
183
        } finally {
184
        	_context.release();
149
        }
185
        }
150
151
        final ContextCapabilities caps = createContextCapabilities();
152
        _currentContext = new RenderContext(_context, caps, sharedContext);
153
154
        ContextManager.addContext(_context, _currentContext);
155
        ContextManager.switchContext(_context);
156
157
        _renderer = new JoglRenderer();
158
159
        if (settings.getSamples() != 0 && caps.isMultisampleSupported()) {
160
            final GL gl = GLU.getCurrentGL();
161
            gl.glEnable(GL.GL_MULTISAMPLE);
162
        }
163
164
        _renderer.setBackgroundColor(ColorRGBA.BLACK);
165
166
        if (_camera == null) {
167
            /** Set up how our camera sees. */
168
            _camera = new Camera(settings.getWidth(), settings.getHeight());
169
            _camera.setFrustumPerspective(45.0f, (float) settings.getWidth() / (float) settings.getHeight(), 1, 1000);
170
            _camera.setProjectionMode(ProjectionMode.Perspective);
171
172
            final Vector3 loc = new Vector3(0.0f, 0.0f, 10.0f);
173
            final Vector3 left = new Vector3(-1.0f, 0.0f, 0.0f);
174
            final Vector3 up = new Vector3(0.0f, 1.0f, 0.0f);
175
            final Vector3 dir = new Vector3(0.0f, 0f, -1.0f);
176
            /** Move our camera to a correct place and orientation. */
177
            _camera.setFrame(loc, left, up, dir);
178
        } else {
179
            // use new width and height to set ratio.
180
            _camera.setFrustumPerspective(_camera.getFovY(),
181
                    (float) settings.getWidth() / (float) settings.getHeight(), _camera.getFrustumNear(), _camera
182
                            .getFrustumFar());
183
        }
184
    }
186
    }
185
187
186
    public GLContext getContext() {
188
    public GLContext getContext() {
(-)src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java (-1 / +16 lines)
Lines 10-15 Link Here
10
10
11
package com.ardor3d.framework.jogl;
11
package com.ardor3d.framework.jogl;
12
12
13
import java.awt.EventQueue;
14
import java.lang.reflect.InvocationTargetException;
13
import java.util.concurrent.CountDownLatch;
15
import java.util.concurrent.CountDownLatch;
14
import javax.media.opengl.GLAutoDrawable;
16
import javax.media.opengl.GLAutoDrawable;
15
import javax.media.opengl.GLRunnable;
17
import javax.media.opengl.GLRunnable;
Lines 54-60 Link Here
54
        }
56
        }
55
    	
57
    	
56
        // Make the window visible to realize the OpenGL surface.
58
        // Make the window visible to realize the OpenGL surface.
57
        setVisible(true);
59
    	setVisible(true);
60
    	/**
61
    	try {
62
			EventQueue.invokeAndWait(new Runnable() {
63
				public void run() {
64
					setVisible(true);					
65
					display(); // force creation via validateGLDrawable()					
66
				}
67
			});
68
        } catch (InvocationTargetException e) {
69
            throw new RuntimeException(e.getTargetException());
70
        } catch (InterruptedException e) {
71
            throw new RuntimeException(e);
72
        } */
58
        
73
        
59
        // Request the focus here as it cannot work when the window is not visible
74
        // Request the focus here as it cannot work when the window is not visible
60
        requestFocus();
75
        requestFocus();
(-)src/main/java/com/ardor3d/scene/state/jogl/util/JoglTextureUtil.java (-2 / +2 lines)
Lines 15-21 Link Here
15
import javax.media.opengl.GL2GL3;
15
import javax.media.opengl.GL2GL3;
16
16
17
import com.ardor3d.image.ImageDataFormat;
17
import com.ardor3d.image.ImageDataFormat;
18
import com.ardor3d.image.ImageDataType;
18
import com.ardor3d.image.PixelDataType;
19
import com.ardor3d.image.TextureStoreFormat;
19
import com.ardor3d.image.TextureStoreFormat;
20
import com.ardor3d.image.Texture.ApplyMode;
20
import com.ardor3d.image.Texture.ApplyMode;
21
import com.ardor3d.image.Texture.CombinerFunctionAlpha;
21
import com.ardor3d.image.Texture.CombinerFunctionAlpha;
Lines 159-165 Link Here
159
        throw new IllegalArgumentException("Incorrect format set: " + format);
159
        throw new IllegalArgumentException("Incorrect format set: " + format);
160
    }
160
    }
161
161
162
    public static int getGLPixelDataType(final ImageDataType type) {
162
    public static int getGLPixelDataType(final PixelDataType type) {
163
        switch (type) {
163
        switch (type) {
164
            case Byte:
164
            case Byte:
165
                return GL.GL_BYTE;
165
                return GL.GL_BYTE;
(-).classpath (-2 / +2 lines)
Lines 3-9 Link Here
3
	<classpathentry kind="src" path="src/main/java"/>
3
	<classpathentry kind="src" path="src/main/java"/>
4
	<classpathentry combineaccessrules="false" kind="src" path="/ardor3d-core"/>
4
	<classpathentry combineaccessrules="false" kind="src" path="/ardor3d-core"/>
5
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
5
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
6
	<classpathentry kind="lib" path="lib/jogl/gluegen-rt.jar"/>
6
	<classpathentry kind="lib" path="lib/jogl/gluegen-rt.jar" sourcepath="lib/jogl/gluegen-java-src.zip"/>
7
	<classpathentry exported="true" kind="lib" path="lib/jogl/jogl.all.jar"/>
7
	<classpathentry exported="true" kind="lib" path="lib/jogl/jogl.all.jar" sourcepath="lib/jogl/jogl-java-src.zip"/>
8
	<classpathentry kind="output" path="bin"/>
8
	<classpathentry kind="output" path="bin"/>
9
</classpath>
9
</classpath>

Return to bug 572