All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jogamp.opengl.x11.glx.GLXProcAddressTable Maven / Gradle / Ivy

/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/opengl/GLEmitter.java on Wed Mar 11 20:57:47 CET 2015 ----! */

package jogamp.opengl.x11.glx;

import java.util.*;
import com.jogamp.opengl.*;
import com.jogamp.opengl.fixedfunc.*;
import jogamp.opengl.*;
import jogamp.nativewindow.x11.*;
import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver;
import com.jogamp.gluegen.runtime.ProcAddressTable;
import com.jogamp.common.util.SecurityUtil;

/**
 * This table is a cache of pointers to the dynamically-linkable C library.
 * @see ProcAddressTable
 */
public final class GLXProcAddressTable extends ProcAddressTable {

  /* pp */ long _addressof_glXGetVisualFromFBConfig;
  /* pp */ long _addressof_glXChooseFBConfig;
  /* pp */ long _addressof_glXGetFBConfigs;
  /* pp */ long _addressof_glXChooseVisual;

  public GLXProcAddressTable(){ super(); }

  public GLXProcAddressTable(com.jogamp.gluegen.runtime.FunctionAddressResolver resolver){ super(resolver); }

  /* pp */ long _addressof_glXCopyContext;
  /* pp */ long _addressof_glXCreateContext;
  /* pp */ long _addressof_glXCreateGLXPixmap;
  /* pp */ long _addressof_glXCreateNewContext;
  /* pp */ long _addressof_glXCreatePbuffer;
  /* pp */ long _addressof_glXCreatePixmap;
  /* pp */ long _addressof_glXCreateWindow;
  /* pp */ long _addressof_glXDestroyContext;
  /* pp */ long _addressof_glXDestroyGLXPixmap;
  /* pp */ long _addressof_glXDestroyPbuffer;
  /* pp */ long _addressof_glXDestroyPixmap;
  /* pp */ long _addressof_glXDestroyWindow;
  /* pp */ long _addressof_glXGetClientString;
  /* pp */ long _addressof_glXGetConfig;
  /* pp */ long _addressof_glXGetCurrentContext;
  /* pp */ long _addressof_glXGetCurrentDisplay;
  /* pp */ long _addressof_glXGetCurrentDrawable;
  /* pp */ long _addressof_glXGetCurrentReadDrawable;
  /* pp */ long _addressof_glXGetFBConfigAttrib;
  /* pp */ long _addressof_glXGetProcAddress;
  /* pp */ long _addressof_glXGetProcAddressARB;
  /* pp */ long _addressof_glXGetSelectedEvent;
  /* pp */ long _addressof_glXIsDirect;
  /* pp */ long _addressof_glXMakeContextCurrent;
  /* pp */ long _addressof_glXMakeCurrent;
  /* pp */ long _addressof_glXQueryContext;
  /* pp */ long _addressof_glXQueryDrawable;
  /* pp */ long _addressof_glXQueryExtension;
  /* pp */ long _addressof_glXQueryExtensionsString;
  /* pp */ long _addressof_glXQueryServerString;
  /* pp */ long _addressof_glXQueryVersion;
  /* pp */ long _addressof_glXSelectEvent;
  /* pp */ long _addressof_glXSwapBuffers;
  /* pp */ long _addressof_glXSwapIntervalEXT;
  /* pp */ long _addressof_glXUseXFont;
  /* pp */ long _addressof_glXWaitGL;
  /* pp */ long _addressof_glXWaitX;
  @Override
  protected boolean isFunctionAvailableImpl(String functionNameUsr) throws IllegalArgumentException  {
    final String functionNameBase = com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);
    final String addressFieldNameBase = "_addressof_" + functionNameBase;
    final int funcNamePermNum = com.jogamp.gluegen.runtime.opengl.GLNameResolver.getFuncNamePermutationNumber(functionNameBase);
    final java.lang.reflect.Field addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {
        public final java.lang.reflect.Field run() {
            java.lang.reflect.Field addressField = null;
            for(int i = 0; i < funcNamePermNum; i++) {
                final String addressFieldName = com.jogamp.gluegen.runtime.opengl.GLNameResolver.getFuncNamePermutation(addressFieldNameBase, i);
                try {
                    addressField = GLXProcAddressTable.class.getDeclaredField( addressFieldName );
                    addressField.setAccessible(true); // we need to read the protected value!
                    return addressField;
                } catch (NoSuchFieldException ex) { }
            }
            return null;
        } } );

    if(null==addressField) {
      // The user is calling a bogus function or one which is not
      // runtime linked
      throw new RuntimeException(
          "WARNING: Address field query failed for \"" + functionNameBase + "\"/\"" + functionNameUsr +
          "\"; it's either statically linked or address field is not a known " +
          "function");
    } 
    try {
      return 0 != addressField.getLong(this);
    } catch (Exception e) {
      throw new RuntimeException(
          "WARNING: Address query failed for \"" + functionNameBase + "\"/\"" + functionNameUsr +
          "\"; it's either statically linked or is not a known " +
          "function", e);
    }
  }
  @Override
  public long getAddressFor(String functionNameUsr) throws SecurityException, IllegalArgumentException {
    SecurityUtil.checkAllLinkPermission();
    final String functionNameBase = com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);
    final String addressFieldNameBase = "_addressof_" + functionNameBase;
    final int  funcNamePermNum = com.jogamp.gluegen.runtime.opengl.GLNameResolver.getFuncNamePermutationNumber(functionNameBase);
    final java.lang.reflect.Field addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() {
        public final java.lang.reflect.Field run() {
            java.lang.reflect.Field addressField = null;
            for(int i = 0; i < funcNamePermNum; i++) {
                final String addressFieldName = com.jogamp.gluegen.runtime.opengl.GLNameResolver.getFuncNamePermutation(addressFieldNameBase, i);
                try {
                    addressField = GLXProcAddressTable.class.getDeclaredField( addressFieldName );
                    addressField.setAccessible(true); // we need to read the protected value!
                    return addressField;
                } catch (NoSuchFieldException ex) { }
            }
            return null;
        } } );

    if(null==addressField) {
      // The user is calling a bogus function or one which is not
      // runtime linked
      throw new RuntimeException(
          "WARNING: Address field query failed for \"" + functionNameBase + "\"/\"" + functionNameUsr +
          "\"; it's either statically linked or address field is not a known " +
          "function");
    } 
    try {
      return addressField.getLong(this);
    } catch (Exception e) {
      throw new RuntimeException(
          "WARNING: Address query failed for \"" + functionNameBase + "\"/\"" + functionNameUsr +
          "\"; it's either statically linked or is not a known " +
          "function", e);
    }
  }
} // end of class GLXProcAddressTable




© 2015 - 2024 Weber Informatics LLC | Privacy Policy