CLGLContext c = CLGLContext.create(GLContext.getCurrent(), devices.toArray(new CLDevice[devices.size()])); clContext = new com.jme3.opencl.jocl.JoclContext(c, (List<JoclDevice>) choosenDevices); } catch (Exception ex) {
protected void initContextFirstTime(){ if (GLContext.getCurrent().getGLVersionNumber().getMajor() < 2) { throw new RendererException("OpenGL 2.0 or higher is " + "required for jMonkeyEngine"); GLContext.getCurrent().enableGLDebugMessage(true); GLContext.getCurrent().addGLDebugListener(new JoglGLDebugOutputHandler());
/** * @return true if this GLContext is current on this thread */ public final boolean isCurrent() { return getCurrent() == this ; }
/** * @return true if this GLContext is current on this thread */ public final boolean isCurrent() { return getCurrent() == this ; }
private void setupContext() { if(context == null) { context = GLContext.getCurrent(); } if(context!=null) { GLContext.getCurrent().makeCurrent(); } }
public static TextureLoader getInstance() { if(instance == null) { context = GLContext.getCurrent(); instance = new TextureLoader(); } return instance; }
/** * @throws GLException if this GLContext is not current on this thread */ public final void validateCurrent() throws GLException { if(getCurrent() != this) { throw new GLException(getThreadName()+": This context is not current. Current context: "+getCurrent()+", this context "+this); } }
/** * @throws GLException if this GLContext is not current on this thread */ public final void validateCurrent() throws GLException { if(getCurrent() != this) { throw new GLException(getThreadName()+": This context is not current. Current context: "+getCurrent()+", this context "+this); } }
private void checkContext() { GLContext currentContext = GLContext.getCurrent(); if (currentContext == null) { throw new GLException("No OpenGL context is current on this thread"); } if ((_context != null) && (_context != currentContext)) { throw new GLException("This GL object is being incorrectly used with a different GLContext than that which created it"); } } private GLContext _context;
private void checkContext() { GLContext currentContext = GLContext.getCurrent(); if (currentContext == null) { throw new GLException("No OpenGL context is current on this thread"); } if ((_context != null) && (_context != currentContext)) { throw new GLException("This GL object is being incorrectly used with a different GLContext than that which created it"); } } private GLContext _context;
/** * Constructs display lists in the current OpenGL context. * Calls glGenLists to create the specified number of display list objects. * @param range the number of display lists. * @exception IllegalStateException if the current OpenGL context is null. */ public GlDisplayList(int range) { _context = GLContext.getCurrent(); Check.state(_context!=null,"OpenGL context is not null"); _list = glGenLists(range); _range = range; }
public static final GL getCurrentGL() throws GLException { GLContext curContext = GLContext.getCurrent(); if (curContext == null) { throw new GLException("No OpenGL context current on this thread"); } return curContext.getGL(); }
private void checkContext() { GLContext currentContext = GLContext.getCurrent(); if (currentContext == null) { throw new GLException("No OpenGL context is current on this thread"); } if ((_context != null) && (_context != currentContext)) { throw new GLException("This GL object is being incorrectly used with a different GLContext than that which created it"); } } private GLContext _context;
/** * Constructs a texture name in the current OpenGL context. * Calls glGenTextures to create one texture object. * @exception IllegalStateException if the current OpenGL context is null. */ public GlTextureName() { _context = GLContext.getCurrent(); Check.state(_context!=null,"OpenGL context is not null"); int[] names = new int[1]; glGenTextures(1,names,0); _name = names[0]; //System.out.println("GlTextureName: generated name="+_name); }
public static final GL2 getCurrentGL2() throws GLException { GLContext curContext = GLContext.getCurrent(); if (curContext == null) { throw new GLException("No OpenGL context current on this thread"); } return curContext.getGL().getGL2(); }
public static final GL2ES1 getCurrentGL2ES1() throws GLException { GLContext curContext = GLContext.getCurrent(); if (curContext == null) { throw new GLException("No OpenGL context current on this thread"); } return curContext.getGL().getGL2ES1(); }
/** * Returns the GL object bound to this thread current context. * If no context is current, throw an GLException * * @return the current context's GL object on this thread * @throws GLException if no context is current */ public static GL getCurrentGL() throws GLException { final GLContext glc = getCurrent(); if(null==glc) { throw new GLException(getThreadName()+": No OpenGL context current on this thread"); } return glc.getGL(); }
/** * Returns the GL object bound to this thread current context. * If no context is current, throw an GLException * * @return the current context's GL object on this thread * @throws GLException if no context is current */ public static GL getCurrentGL() throws GLException { final GLContext glc = getCurrent(); if(null==glc) { throw new GLException(getThreadName()+": No OpenGL context current on this thread"); } return glc.getGL(); }
@Override void destroyContext(Drawable drawable, Context ctx) { if (VERBOSE) System.err.println("JoglPipeline.destroyContext()"); JoglDrawable joglDrawable = (JoglDrawable)drawable; GLContext context = context(ctx); if (GLContext.getCurrent() == context) { context.release(); } context.destroy(); // assuming this is the right point at which to make this call joglDrawable.getGLDrawable().setRealized(false); joglDrawable.destroyNativeWindow(); }
private static final GLUgl2ProcAddressTable getGLUProcAddressTable() { if (gluProcAddressTable == null) { GLContext curContext = GLContext.getCurrent(); if (curContext == null) { throw new GLException("No OpenGL context current on this thread"); } GLDynamicLookupHelper glLookupHelper = ((GLContextImpl) curContext).getGLDynamicLookupHelper(); glLookupHelper.loadGLULibrary(); GLUgl2ProcAddressTable tmp = new GLUgl2ProcAddressTable(new GLProcAddressResolver()); tmp.reset(glLookupHelper); gluProcAddressTable = tmp; } return gluProcAddressTable; } // ---- End CustomJavaCode .cfg declarations