public void initialize() {
    if (GLContext.getCapabilities().OpenGL12) {
      gl12 = true;
    }

    // Default values for certain GL state.
    glShadeModel(GL_SMOOTH);
    glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

    // Enable rescaling/normaling of normal vectors.
    // Fixes lighting issues with scaled models.
    if (gl12) {
      glEnable(GL12.GL_RESCALE_NORMAL);
    } else {
      glEnable(GL_NORMALIZE);
    }

    if (GLContext.getCapabilities().GL_ARB_texture_non_power_of_two) {
      caps.add(Caps.NonPowerOfTwoTextures);
    } else {
      logger.log(
          Level.WARNING,
          "Your graphics card does not "
              + "support non-power-of-2 textures. "
              + "Some features might not work.");
    }

    maxLights = glGetInteger(GL_MAX_LIGHTS);
    maxTexSize = glGetInteger(GL_MAX_TEXTURE_SIZE);
  }
Esempio n. 2
0
 public static void func_77474_a() {
   field_77477_c =
       GLContext.getCapabilities().GL_ARB_multitexture && !GLContext.getCapabilities().OpenGL13;
   if (field_77477_c) {
     field_77478_a = '\u84c0';
     field_77476_b = '\u84c1';
   } else {
     field_77478_a = '\u84c0';
     field_77476_b = '\u84c1';
   }
 }
 public static void glGetQueryARB(int target, int pname, IntBuffer params) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glGetQueryivARB;
   BufferChecks.checkFunctionAddress(function_pointer);
   BufferChecks.checkBuffer(params, 1);
   nglGetQueryivARB(target, pname, MemoryUtil.getAddress(params), function_pointer);
 }
  @Override
  protected void initGL() {

    if (glInitialized) {
      return;
    }
    glInitialized = true;

    try {
      LWJGLDisplaySystem display = (LWJGLDisplaySystem) DisplaySystem.getDisplaySystem();
      display.switchContext(this);

      // Complete canvas configuration.
      Dimension size = this.getSize();
      display.initForCanvas(size.width, size.height);

      impl.doSetup();

      if (display.getMinSamples() != 0 && GLContext.getCapabilities().GL_ARB_multisample) {
        GL11.glEnable(ARBMultisample.GL_MULTISAMPLE_ARB);
      }
    } catch (Exception e) {
      logger.log(Level.SEVERE, "Exception in initGL()", e);
    }
  }
 public static boolean glIsQueryARB(int id) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glIsQueryARB;
   BufferChecks.checkFunctionAddress(function_pointer);
   boolean __result = nglIsQueryARB(id, function_pointer);
   return __result;
 }
Esempio n. 6
0
  public void paintGL() {
    synchronized (PAINT_LOCK) {
      try {
        DisplaySystem.getDisplaySystem().setCurrentCanvas(this);

        if (updateInput) InputSystem.update();

        if (!impl.isSetup()) {
          impl.doSetup();

          if (DisplaySystem.getDisplaySystem().getMinSamples() != 0
              && GLContext.getCapabilities().GL_ARB_multisample) {
            GL11.glEnable(ARBMultisample.GL_MULTISAMPLE_ARB);
          }
        }

        GameTaskQueueManager.getManager().getQueue(GameTaskQueue.UPDATE).execute();

        impl.doUpdate();

        GameTaskQueueManager.getManager().getQueue(GameTaskQueue.RENDER).execute();

        impl.doRender();

        swapBuffers();
      } catch (LWJGLException e) {
        logger.log(Level.SEVERE, "Exception in paintGL()", e);
      }
    }
  }
Esempio n. 7
0
 public static void glProgramLocalParameterI4uiNV(
     int target, int index, int x, int y, int z, int w) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.NV_gpu_program4_glProgramLocalParameterI4uiNV_pointer;
   BufferChecks.checkFunctionAddress(function_pointer);
   nglProgramLocalParameterI4uiNV(target, index, x, y, z, w, function_pointer);
 }
 public static void glVertexArrayRangeAPPLE(ByteBuffer pointer) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glVertexArrayRangeAPPLE;
   BufferChecks.checkFunctionAddress(function_pointer);
   BufferChecks.checkDirect(pointer);
   nglVertexArrayRangeAPPLE(pointer.remaining(), pointer, pointer.position(), function_pointer);
 }
 /** Overloads glBindFragDataLocationEXT. */
 public static void glBindFragDataLocationEXT(int program, int colorNumber, CharSequence name) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glBindFragDataLocationEXT;
   BufferChecks.checkFunctionAddress(function_pointer);
   nglBindFragDataLocationEXT(
       program, colorNumber, APIUtil.getBufferNT(name), 0, function_pointer);
 }
Esempio n. 10
0
  private void initialise() {
    DisplayMode mode = new DisplayMode(WIDTH, HEIGHT);
    Display.setTitle(TITLE);

    input = new InputHandler();
    display = new CodeDisplay(input);

    try {
      Display.setDisplayMode(mode);
      Display.setResizable(false);
      Display.create();

      if (!GLContext.getCapabilities().OpenGL33)
        System.err.printf("You must have at least OpenGL 3.3 to run this program\n");
    } catch (LWJGLException e) {
      e.printStackTrace();
      System.exit(-1);
    }

    // Set clear color

    glShadeModel(GL_SMOOTH);
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL); // Less than or equal
    glClearDepth(1.0);

    establishProjectionMatrix();

    // glEnable(GL_LIGHTING);
    // glEnable(GL_LIGHT0);
  }
 public static void glVertexAttribI4uEXT(int index, ShortBuffer v) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glVertexAttribI4usvEXT;
   BufferChecks.checkFunctionAddress(function_pointer);
   BufferChecks.checkBuffer(v, 4);
   nglVertexAttribI4usvEXT(index, v, v.position(), function_pointer);
 }
Esempio n. 12
0
 /*     */ public static int glCreateShaderObjectARB(int shaderType) {
   /*  88 */ ContextCapabilities caps = GLContext.getCapabilities();
   /*  89 */ long function_pointer = caps.glCreateShaderObjectARB;
   /*  90 */ BufferChecks.checkFunctionAddress(function_pointer);
   /*  91 */ int __result = nglCreateShaderObjectARB(shaderType, function_pointer);
   /*  92 */ return __result;
   /*     */ }
Esempio n. 13
0
 /*     */ public static void glShaderSourceARB(int shader, CharSequence string) {
   /* 112 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 113 */ long function_pointer = caps.glShaderSourceARB;
   /* 114 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 115 */ nglShaderSourceARB(
       shader, 1, APIUtil.getBuffer(caps, string), string.length(), function_pointer);
   /*     */ }
Esempio n. 14
0
 /*     */ public static int glGetHandleARB(int pname) {
   /*  71 */ ContextCapabilities caps = GLContext.getCapabilities();
   /*  72 */ long function_pointer = caps.glGetHandleARB;
   /*  73 */ BufferChecks.checkFunctionAddress(function_pointer);
   /*  74 */ int __result = nglGetHandleARB(pname, function_pointer);
   /*  75 */ return __result;
   /*     */ }
Esempio n. 15
0
 /*     */ public static void glUniform4fARB(
     int location, float v0, float v1, float v2, float v3) {
   /* 202 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 203 */ long function_pointer = caps.glUniform4fARB;
   /* 204 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 205 */ nglUniform4fARB(location, v0, v1, v2, v3, function_pointer);
   /*     */ }
Esempio n. 16
0
 /*     */ public static int glCreateProgramObjectARB() {
   /* 137 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 138 */ long function_pointer = caps.glCreateProgramObjectARB;
   /* 139 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 140 */ int __result = nglCreateProgramObjectARB(function_pointer);
   /* 141 */ return __result;
   /*     */ }
Esempio n. 17
0
  Tessellator(int par1) {
    vertexCount = 0;
    hasColor = false;
    hasTexture = false;
    hasBrightness = false;
    hasNormals = false;
    rawBufferIndex = 0;
    addedVertices = 0;
    isColorDisabled = false;
    isDrawing = false;
    useVBO = false;
    vboIndex = 0;
    vboCount = 10;
    bufferSize = par1;
    byteBuffer = GLAllocation.createDirectByteBuffer(par1 * 4);
    intBuffer = byteBuffer.asIntBuffer();
    floatBuffer = byteBuffer.asFloatBuffer();
    shortBuffer = byteBuffer.asShortBuffer();
    rawBuffer = new int[par1];
    useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;

    if (useVBO) {
      vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount);
      ARBVertexBufferObject.glGenBuffersARB(vertexBuffers);
    }
  }
 public static void glUniform4uEXT(int location, IntBuffer value) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glUniform4uivEXT;
   BufferChecks.checkFunctionAddress(function_pointer);
   BufferChecks.checkDirect(value);
   nglUniform4uivEXT(location, value.remaining() >> 2, value, value.position(), function_pointer);
 }
Esempio n. 19
0
 public Tessellator(int p_i52_1_) {
   renderingChunk = false;
   defaultTexture = true;
   autoGrow = true;
   subTessellators = new Tessellator[0];
   subTextures = new int[0];
   terrainTexture = 0;
   textureUpdateTime = 0L;
   field_1505_h = 0;
   field_1501_l = false;
   field_1500_m = false;
   field_35838_p = false;
   field_1499_n = false;
   field_1498_o = 0;
   field_1497_p = 0;
   field_1495_q = false;
   field_1488_w = false;
   field_1487_x = false;
   field_1485_z = 0;
   field_1496_A = 10;
   field_1494_B = p_i52_1_;
   field_1509_d = GLAllocation.func_1127_b(p_i52_1_ * 4);
   field_1508_e = field_1509_d.asIntBuffer();
   field_1507_f = field_1509_d.asFloatBuffer();
   field_35836_g = field_1509_d.asShortBuffer();
   field_1506_g = new int[p_i52_1_];
   field_1487_x = field_1510_c && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;
   if (field_1487_x) {
     field_1486_y = GLAllocation.func_1125_c(field_1496_A);
     ARBVertexBufferObject.glGenBuffersARB(field_1486_y);
   }
 }
Esempio n. 20
0
 public static void glCopyBufferSubData(
     int readTarget, int writeTarget, long readOffset, long writeOffset, long size) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.ARB_copy_buffer_glCopyBufferSubData_pointer;
   BufferChecks.checkFunctionAddress(function_pointer);
   nglCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size, function_pointer);
 }
 public static void glGetVertexAttribIuEXT(int index, int pname, IntBuffer params) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glGetVertexAttribIuivEXT;
   BufferChecks.checkFunctionAddress(function_pointer);
   BufferChecks.checkBuffer(params, 4);
   nglGetVertexAttribIuivEXT(index, pname, params, params.position(), function_pointer);
 }
Esempio n. 22
0
 /*    */ public static void glBlendColorEXT(float red, float green, float blue, float alpha)
       /*    */ {
   /* 27 */ ContextCapabilities caps = GLContext.getCapabilities();
   /* 28 */ long function_pointer = caps.glBlendColorEXT;
   /* 29 */ BufferChecks.checkFunctionAddress(function_pointer);
   /* 30 */ nglBlendColorEXT(red, green, blue, alpha, function_pointer);
   /*    */ }
 public static void glGetUniformuEXT(int program, int location, IntBuffer params) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glGetUniformuivEXT;
   BufferChecks.checkFunctionAddress(function_pointer);
   BufferChecks.checkDirect(params);
   nglGetUniformuivEXT(program, location, params, params.position(), function_pointer);
 }
Esempio n. 24
0
 public static void glTexStorage3D(
     int target, int levels, int internalformat, int width, int height, int depth) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glTexStorage3D;
   BufferChecks.checkFunctionAddress(function_pointer);
   nglTexStorage3D(target, levels, internalformat, width, height, depth, function_pointer);
 }
Esempio n. 25
0
 public static void glWeightARB(DoubleBuffer pWeights) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glWeightdvARB;
   BufferChecks.checkFunctionAddress(function_pointer);
   BufferChecks.checkDirect(pWeights);
   nglWeightdvARB(pWeights.remaining(), MemoryUtil.getAddress(pWeights), function_pointer);
 }
Esempio n. 26
0
 public static void glDrawTransformFeedbackStreamInstanced(
     int mode, int id, int stream, int primcount) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glDrawTransformFeedbackStreamInstanced;
   BufferChecks.checkFunctionAddress(function_pointer);
   nglDrawTransformFeedbackStreamInstanced(mode, id, stream, primcount, function_pointer);
 }
Esempio n. 27
0
 public static void glBindImageTexture(
     int unit, int texture, int level, boolean layered, int layer, int access, int format) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glBindImageTexture;
   BufferChecks.checkFunctionAddress(function_pointer);
   nglBindImageTexture(unit, texture, level, layered, layer, access, format, function_pointer);
 }
 public static void glDeleteQueriesARB(IntBuffer ids) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glDeleteQueriesARB;
   BufferChecks.checkFunctionAddress(function_pointer);
   BufferChecks.checkDirect(ids);
   nglDeleteQueriesARB(ids.remaining(), MemoryUtil.getAddress(ids), function_pointer);
 }
Esempio n. 29
0
 public static void glProgramLocalParameterI4uNV(int target, int index, IntBuffer params) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.NV_gpu_program4_glProgramLocalParameterI4uivNV_pointer;
   BufferChecks.checkFunctionAddress(function_pointer);
   params = NondirectBufferWrapper.wrapBuffer(params, 4);
   nglProgramLocalParameterI4uivNV(target, index, params, params.position(), function_pointer);
 }
Esempio n. 30
0
 public static void glPointParameterEXT(int pname, FloatBuffer pfParams) {
   ContextCapabilities caps = GLContext.getCapabilities();
   long function_pointer = caps.glPointParameterfvEXT;
   BufferChecks.checkFunctionAddress(function_pointer);
   BufferChecks.checkBuffer(pfParams, 4);
   nglPointParameterfvEXT(pname, MemoryUtil.getAddress(pfParams), function_pointer);
 }