Java 类org.lwjgl.opengl.ARBVertexBufferObject 实例源码

项目:DecompiledMinecraft    文件:OpenGlHelper.java   
public static void glBindBuffer(int target, int buffer)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glBindBufferARB(target, buffer);
    }
    else
    {
        GL15.glBindBuffer(target, buffer);
    }
}
项目:DecompiledMinecraft    文件:OpenGlHelper.java   
public static void glBufferData(int target, ByteBuffer data, int usage)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glBufferDataARB(target, data, usage);
    }
    else
    {
        GL15.glBufferData(target, data, usage);
    }
}
项目:DecompiledMinecraft    文件:OpenGlHelper.java   
public static void glDeleteBuffers(int buffer)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glDeleteBuffersARB(buffer);
    }
    else
    {
        GL15.glDeleteBuffers(buffer);
    }
}
项目:BaseClient    文件:OpenGlHelper.java   
public static void glBindBuffer(int target, int buffer)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glBindBufferARB(target, buffer);
    }
    else
    {
        GL15.glBindBuffer(target, buffer);
    }
}
项目:BaseClient    文件:OpenGlHelper.java   
public static void glBufferData(int target, ByteBuffer data, int usage)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glBufferDataARB(target, data, usage);
    }
    else
    {
        GL15.glBufferData(target, data, usage);
    }
}
项目:BaseClient    文件:OpenGlHelper.java   
public static void glDeleteBuffers(int buffer)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glDeleteBuffersARB(buffer);
    }
    else
    {
        GL15.glDeleteBuffers(buffer);
    }
}
项目:BaseClient    文件:OpenGlHelper.java   
public static void glBindBuffer(int target, int buffer)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glBindBufferARB(target, buffer);
    }
    else
    {
        GL15.glBindBuffer(target, buffer);
    }
}
项目:BaseClient    文件:OpenGlHelper.java   
public static void glBufferData(int target, ByteBuffer data, int usage)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glBufferDataARB(target, data, usage);
    }
    else
    {
        GL15.glBufferData(target, data, usage);
    }
}
项目:BaseClient    文件:OpenGlHelper.java   
public static void glDeleteBuffers(int buffer)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glDeleteBuffersARB(buffer);
    }
    else
    {
        GL15.glDeleteBuffers(buffer);
    }
}
项目:Backmemed    文件:OpenGlHelper.java   
public static void glBindBuffer(int target, int buffer)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glBindBufferARB(target, buffer);
    }
    else
    {
        GL15.glBindBuffer(target, buffer);
    }
}
项目:Backmemed    文件:OpenGlHelper.java   
public static void glBufferData(int target, ByteBuffer data, int usage)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glBufferDataARB(target, data, usage);
    }
    else
    {
        GL15.glBufferData(target, data, usage);
    }
}
项目:Backmemed    文件:OpenGlHelper.java   
public static void glDeleteBuffers(int buffer)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glDeleteBuffersARB(buffer);
    }
    else
    {
        GL15.glDeleteBuffers(buffer);
    }
}
项目:CustomWorldGen    文件:OpenGlHelper.java   
public static void glBindBuffer(int target, int buffer)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glBindBufferARB(target, buffer);
    }
    else
    {
        GL15.glBindBuffer(target, buffer);
    }
}
项目:CustomWorldGen    文件:OpenGlHelper.java   
public static void glBufferData(int target, ByteBuffer data, int usage)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glBufferDataARB(target, data, usage);
    }
    else
    {
        GL15.glBufferData(target, data, usage);
    }
}
项目:CustomWorldGen    文件:OpenGlHelper.java   
public static void glDeleteBuffers(int buffer)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glDeleteBuffersARB(buffer);
    }
    else
    {
        GL15.glDeleteBuffers(buffer);
    }
}
项目:CubeShaft    文件:Tesselator.java   
public Tesselator(int size) {
    this.size = size;

    this.byteBuffer = BufferUtils.createByteBuffer(size * 4);
    this.intBuffer = byteBuffer.asIntBuffer();
    this.floatBuffer = byteBuffer.asFloatBuffer();
    this.shortBuffer = byteBuffer.asShortBuffer();
    this.array = new int[size];

    this.vboMode = ((USE_VBO) && (GLContext.getCapabilities().GL_ARB_vertex_buffer_object));
    if (this.vboMode) {
        this.vboIds = BufferUtils.createIntBuffer(this.vboCounts);
        ARBVertexBufferObject.glGenBuffersARB(this.vboIds);
    }
}
项目:ExpandedRailsMod    文件:OpenGlHelper.java   
public static void glBindBuffer(int target, int buffer)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glBindBufferARB(target, buffer);
    }
    else
    {
        GL15.glBindBuffer(target, buffer);
    }
}
项目:ExpandedRailsMod    文件:OpenGlHelper.java   
public static void glBufferData(int target, ByteBuffer data, int usage)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glBufferDataARB(target, data, usage);
    }
    else
    {
        GL15.glBufferData(target, data, usage);
    }
}
项目:ExpandedRailsMod    文件:OpenGlHelper.java   
public static void glDeleteBuffers(int buffer)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glDeleteBuffersARB(buffer);
    }
    else
    {
        GL15.glDeleteBuffers(buffer);
    }
}
项目:RuneCraftery    文件:Tessellator.java   
private Tessellator(int p_i1250_1_) {
   this.field_78388_E = p_i1250_1_;
   this.field_78394_d = GLAllocation.func_74524_c(p_i1250_1_ * 4);
   this.field_78395_e = this.field_78394_d.asIntBuffer();
   this.field_78392_f = this.field_78394_d.asFloatBuffer();
   this.field_78393_g = this.field_78394_d.asShortBuffer();
   this.field_78405_h = new int[p_i1250_1_];
   this.field_78389_A = field_78397_c && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;
   if(this.field_78389_A) {
      this.field_78390_B = GLAllocation.func_74527_f(this.field_78387_D);
      ARBVertexBufferObject.glGenBuffersARB(this.field_78390_B);
   }

}
项目:Sivx-3DDesktop    文件:engine - Copy.java   
public void vTriFillVbo(){
    if(vTriangles.size() != 0){
        vboVertices = ByteBuffer.allocateDirect(3 * 2 * (vTriangles.size()*3) * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
        vboIndices = ByteBuffer.allocateDirect((vTriangles.size()*3) * 4).order(ByteOrder.nativeOrder()).asIntBuffer();
        for(int x = 0; x < vTriangles.size(); x++){
            ((vTriangle) vTriangles.get(x)).vPut();
            vboIndices.put(x*3+0).put(x*3+1).put(x*3+2);
        }
        vboVertices.rewind();
        vboIndices.rewind();
        ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 3 * 2 * (vTriangles.size()*3) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);
        ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 3 * 2 * (vTriangles.size()*3) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);
        if(!vVBOSETONCE)vVBOSETONCE=true;
    }
}
项目:Sivx-3DDesktop    文件:engine - Copy.java   
public void vLineFillVbo(){
    if(vLines.size() != 0){
        vboLineVertices = ByteBuffer.allocateDirect(3 * (vLines.size()*2) * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
        vboLineIndices = ByteBuffer.allocateDirect((vLines.size()*2) * 4).order(ByteOrder.nativeOrder()).asIntBuffer();
        for(int x = 0; x < vLines.size(); x++){
            ((vLine) vLines.get(x)).vPut();
            vboLineIndices.put(x*2+0).put(x*2+1);
        }
        vboLineVertices.rewind();
        vboLineIndices.rewind();
        ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 3 * (vLines.size()*2) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);
        ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 3 * (vLines.size()*2) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);
        if(!vVBOSETONCE)vVBOSETONCE=true;
    }
}
项目:DecompiledMinecraft    文件:OpenGlHelper.java   
public static int glGenBuffers()
{
    return arbVbo ? ARBVertexBufferObject.glGenBuffersARB() : GL15.glGenBuffers();
}
项目:BaseClient    文件:OpenGlHelper.java   
public static int glGenBuffers()
{
    return arbVbo ? ARBVertexBufferObject.glGenBuffersARB() : GL15.glGenBuffers();
}
项目:BaseClient    文件:OpenGlHelper.java   
public static int glGenBuffers()
{
    return arbVbo ? ARBVertexBufferObject.glGenBuffersARB() : GL15.glGenBuffers();
}
项目:Backmemed    文件:OpenGlHelper.java   
public static int glGenBuffers()
{
    return arbVbo ? ARBVertexBufferObject.glGenBuffersARB() : GL15.glGenBuffers();
}
项目:CustomWorldGen    文件:OpenGlHelper.java   
public static int glGenBuffers()
{
    return arbVbo ? ARBVertexBufferObject.glGenBuffersARB() : GL15.glGenBuffers();
}
项目:tribaltrouble    文件:FloatVBO.java   
public FloatVBO(int usage, int size) {
    super(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, usage, size<<2);
    ByteBuffer buffer = getSavedBuffer();
    if (buffer != null)
        saved_buffer = buffer.asFloatBuffer();
}
项目:tribaltrouble    文件:VBO.java   
public final static void releaseAll() {
    if (Settings.getSettings().useVBO()) {
        makeCurrent(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0);
    }
    releaseIndexVBO();
}
项目:tribaltrouble    文件:VBO.java   
public final static void releaseIndexVBO() {
    if (Settings.getSettings().useVBO()) {
        makeCurrent(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
    }
}
项目:ExpandedRailsMod    文件:OpenGlHelper.java   
public static int glGenBuffers()
{
    return arbVbo ? ARBVertexBufferObject.glGenBuffersARB() : GL15.glGenBuffers();
}
项目:Sivx-3DDesktop    文件:engine.java   
public void run(){          debug("In the run block");          try{                debug("Setting Full Screen");               Display.setFullscreen(vFullscreen);             debug("Getting Available Display Modes");               DisplayMode d[] = Display.getAvailableDisplayModes();               for (int i = 0; i < d.length; i++) {                    debug("Possible mode: w[" + d[i].getWidth() + "] h[" + d[i].getHeight() + "] pixel depth["+d[i].getBitsPerPixel()+"]");                 if (d[i].getWidth() == vScreenW                     && d[i].getHeight() == vScreenH                     && d[i].getBitsPerPixel() == vDpi) {                        vDisplayMode = d[i];                        break;                  }               }               Display.setDisplayMode(vDisplayMode);               Display.setLocation(0,0);               Display.setTitle(vTitle);               Display.create();           }catch(Exception e){debug("Video Exception: " + e);}                        GL11.glMatrixMode(GL11.GL_PROJECTION);          GL11.glLoadIdentity();          GLU.gluPerspective(45.0f,(float) vDisplayMode.getWidth() / (float) vDisplayMode.getHeight(),0.1f,500.0f);           GL11.glMatrixMode(GL11.GL_MODELVIEW);           GL11.glDisable(GL11.GL_BLEND);          GL11.glEnable(GL11.GL_DEPTH_TEST);          GL11.glClearColor(0.18f, .18f, 1f, 0.0f);                                   if (!GLContext.getCapabilities().GL_ARB_vertex_buffer_object){              System.out.println("ARB VBO not supported!");               System.exit(1);         }           IntBuffer vboInt_buffer = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()).asIntBuffer();            ARBBufferObject.glGenBuffersARB(vboInt_buffer);         vboBuffer_id = vboInt_buffer.get(0);            vboIndices_buffer_id = vboInt_buffer.get(1);            ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, vboBuffer_id);           ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, vboIndices_buffer_id);           GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);         GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);                      GL11.glVertexPointer(3, GL11.GL_FLOAT, (3+2)*4, 0);         GL11.glTexCoordPointer(2, GL11.GL_FLOAT, (3+2)*4, (3)*4);                       textureUtil.map.add("images/minus.bmp");            textureUtil.map.add("images/minus.bmp");                        textureUtil.map.add("images/fontTest.bmp");                                             GL11.glEnable(GL11.GL_TEXTURE_2D);          textureUtil.addT("PNG", "textureMap.png");          textureUtil.bind(0);                                                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);                   while(true){                vFrameCount++;                              if (!Display.isVisible())uSleep(100);               else if(Display.isCloseRequested())System.exit(0);              GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);                GL11.glLoadIdentity();                GL11.glRotatef(vCameraLook,1.0f,0,0);               GL11.glRotatef(360.0f - vCameraAngle,0,1.0f,0);             GL11.glTranslatef(-vCameraX, -vCameraY, -vCameraZ);                             if(vVBOSETONCE){                    vLineGrid();                    vTriFillVbo();                                                          GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);                                      GL11.glVertexPointer(3, GL11.GL_FLOAT, (3+2)*4, 0);                 GL11.glTexCoordPointer(2, GL11.GL_FLOAT, (3+2)*4, (3)*4);                   ByteBuffer new_mapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB,ARBBufferObject.GL_WRITE_ONLY_ARB,vboMapped_buffer);                    if (new_mapped_buffer != vboMapped_buffer)vboMapped_float_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asFloatBuffer();                    vboMapped_buffer = new_mapped_buffer;                   new_mapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB,ARBBufferObject.GL_WRITE_ONLY_ARB,vboMapped_indices_buffer);                   if (new_mapped_buffer != vboMapped_indices_buffer)vboMapped_indices_int_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asIntBuffer();                    vboMapped_float_buffer.rewind();                    vboVertices.rewind();                   vboMapped_float_buffer.put(vboVertices);                    vboMapped_indices_int_buffer.rewind();                  vboIndices.rewind();                    vboMapped_indices_int_buffer.put(vboIndices);                   if (ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB) && ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB)){                        GL11.glDrawElements(GL11.GL_TRIANGLES, vTriangles.size()*3, GL11.GL_UNSIGNED_INT, 0);                   }                                                           GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);                                     GL11.glVertexPointer(3, GL11.GL_FLOAT,0, 0);                    vLineFillVbo();                                     ByteBuffer new_Linemapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB,ARBBufferObject.GL_WRITE_ONLY_ARB,vboLineMapped_buffer);                    if (new_Linemapped_buffer != vboLineMapped_buffer)vboLineMapped_float_buffer = new_Linemapped_buffer.order(ByteOrder.nativeOrder()).asFloatBuffer();                    vboLineMapped_buffer = new_Linemapped_buffer;                   new_Linemapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB,ARBBufferObject.GL_WRITE_ONLY_ARB,vboLineMapped_indices_buffer);                   if (new_Linemapped_buffer != vboLineMapped_indices_buffer)vboLineMapped_indices_int_buffer = new_Linemapped_buffer.order(ByteOrder.nativeOrder()).asIntBuffer();                    vboLineMapped_float_buffer.rewind();                    vboLineVertices.rewind();                   vboLineMapped_float_buffer.put(vboLineVertices);                    vboLineMapped_indices_int_buffer.rewind();                  vboLineIndices.rewind();                    vboLineMapped_indices_int_buffer.put(vboLineIndices);                   if (ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB) && ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB)){                        GL11.glDrawElements(GL11.GL_LINES, vLines.size()*2, GL11.GL_UNSIGNED_INT, 0);                   }               }               Display.update();               uSleep(1);              if(vThreadPausedHint){                  vThreadPausedHint = false;                  vThreadPaused = true;                   while(vThreadPaused){                       uSleep(1);                  }               }               else{                   if(vRefreshVbo){                        vTriFillVbo();                                              vRefreshVbo = false;                    }               }           }       }
项目:Sivx-3DDesktop    文件:engine.java   
public void vTriFillVbo(){          if(vTriangles.size() != 0){             vboVertices = ByteBuffer.allocateDirect(3 * 2 * (vTriangles.size()*3) * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();              vboIndices = ByteBuffer.allocateDirect((vTriangles.size()*3) * 4).order(ByteOrder.nativeOrder()).asIntBuffer();             for(int x = 0; x < vTriangles.size(); x++){                 ((vTriangle) vTriangles.get(x)).vPut();                 vboIndices.put(x*3+0).put(x*3+1).put(x*3+2);                }               vboVertices.rewind();               vboIndices.rewind();                ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 3 * 2 * (vTriangles.size()*3) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);             ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 3 * 2 * (vTriangles.size()*3) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);             if(!vVBOSETONCE)vVBOSETONCE=true;           }       }
项目:Sivx-3DDesktop    文件:engine.java   
public void vLineFillVbo(){         if(vLines.size() != 0){             vboLineVertices = ByteBuffer.allocateDirect(3 * (vLines.size()*2) * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();              vboLineIndices = ByteBuffer.allocateDirect((vLines.size()*2) * 4).order(ByteOrder.nativeOrder()).asIntBuffer();             for(int x = 0; x < vLines.size(); x++){                 ((vLine) vLines.get(x)).vPut();                 vboLineIndices.put(x*2+0).put(x*2+1);               }               vboLineVertices.rewind();               vboLineIndices.rewind();                ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 3 * (vLines.size()*2) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);             ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 3 * (vLines.size()*2) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);             if(!vVBOSETONCE)vVBOSETONCE=true;           }       }
项目:Sivx-3DDesktop    文件:engine.java   
public void run(){          debug("In the run block");          try{                debug("Setting Full Screen");               Display.setFullscreen(vFullscreen);             debug("Getting Available Display Modes");               DisplayMode d[] = Display.getAvailableDisplayModes();               for (int i = 0; i < d.length; i++) {                    debug("Possible mode: w[" + d[i].getWidth() + "] h[" + d[i].getHeight() + "] pixel depth["+d[i].getBitsPerPixel()+"]");                 if (d[i].getWidth() == vScreenW                     && d[i].getHeight() == vScreenH                     && d[i].getBitsPerPixel() == vDpi) {                        vDisplayMode = d[i];                        break;                  }               }               Display.setDisplayMode(vDisplayMode);               Display.setLocation(0,0);               Display.setTitle(vTitle);               Display.create();           }catch(Exception e){debug("Video Exception: " + e);}                        GL11.glMatrixMode(GL11.GL_PROJECTION);          GL11.glLoadIdentity();          GLU.gluPerspective(45.0f,(float) vDisplayMode.getWidth() / (float) vDisplayMode.getHeight(),0.1f,500.0f);           GL11.glMatrixMode(GL11.GL_MODELVIEW);           GL11.glDisable(GL11.GL_BLEND);          GL11.glEnable(GL11.GL_DEPTH_TEST);          GL11.glClearColor(0.18f, .18f, 1f, 0.0f);                                   if (!GLContext.getCapabilities().GL_ARB_vertex_buffer_object){              System.out.println("ARB VBO not supported!");               System.exit(1);         }           IntBuffer vboInt_buffer = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()).asIntBuffer();            ARBBufferObject.glGenBuffersARB(vboInt_buffer);         vboBuffer_id = vboInt_buffer.get(0);            vboIndices_buffer_id = vboInt_buffer.get(1);            ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, vboBuffer_id);           ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, vboIndices_buffer_id);           GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);         GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);                      GL11.glVertexPointer(3, GL11.GL_FLOAT, (3+2)*4, 0);         GL11.glTexCoordPointer(2, GL11.GL_FLOAT, (3+2)*4, (3)*4);                       textureUtil.map.add("images/minus.bmp");            textureUtil.map.add("images/minus.bmp");                        textureUtil.map.add("images/fontTest.bmp");                                             GL11.glEnable(GL11.GL_TEXTURE_2D);          textureUtil.addT("PNG", "textureMap.png");          textureUtil.bind(0);                                                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);                   while(true){                vFrameCount++;                              if (!Display.isVisible())uSleep(100);               else if(Display.isCloseRequested())System.exit(0);              GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);                GL11.glLoadIdentity();                GL11.glRotatef(vCameraLook,1.0f,0,0);               GL11.glRotatef(360.0f - vCameraAngle,0,1.0f,0);             GL11.glTranslatef(-vCameraX, -vCameraY, -vCameraZ);                             if(vVBOSETONCE){                    vLineGrid();                    vTriFillVbo();                                                          GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);                                      GL11.glVertexPointer(3, GL11.GL_FLOAT, (3+2)*4, 0);                 GL11.glTexCoordPointer(2, GL11.GL_FLOAT, (3+2)*4, (3)*4);                   ByteBuffer new_mapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB,ARBBufferObject.GL_WRITE_ONLY_ARB,vboMapped_buffer);                    if (new_mapped_buffer != vboMapped_buffer)vboMapped_float_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asFloatBuffer();                    vboMapped_buffer = new_mapped_buffer;                   new_mapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB,ARBBufferObject.GL_WRITE_ONLY_ARB,vboMapped_indices_buffer);                   if (new_mapped_buffer != vboMapped_indices_buffer)vboMapped_indices_int_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asIntBuffer();                    vboMapped_float_buffer.rewind();                    vboVertices.rewind();                   vboMapped_float_buffer.put(vboVertices);                    vboMapped_indices_int_buffer.rewind();                  vboIndices.rewind();                    vboMapped_indices_int_buffer.put(vboIndices);                   if (ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB) && ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB)){                        GL11.glDrawElements(GL11.GL_TRIANGLES, vTriangles.size()*3, GL11.GL_UNSIGNED_INT, 0);                   }                                                           GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);                                     GL11.glVertexPointer(3, GL11.GL_FLOAT,0, 0);                    vLineFillVbo();                                     ByteBuffer new_Linemapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB,ARBBufferObject.GL_WRITE_ONLY_ARB,vboLineMapped_buffer);                    if (new_Linemapped_buffer != vboLineMapped_buffer)vboLineMapped_float_buffer = new_Linemapped_buffer.order(ByteOrder.nativeOrder()).asFloatBuffer();                    vboLineMapped_buffer = new_Linemapped_buffer;                   new_Linemapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB,ARBBufferObject.GL_WRITE_ONLY_ARB,vboLineMapped_indices_buffer);                   if (new_Linemapped_buffer != vboLineMapped_indices_buffer)vboLineMapped_indices_int_buffer = new_Linemapped_buffer.order(ByteOrder.nativeOrder()).asIntBuffer();                    vboLineMapped_float_buffer.rewind();                    vboLineVertices.rewind();                   vboLineMapped_float_buffer.put(vboLineVertices);                    vboLineMapped_indices_int_buffer.rewind();                  vboLineIndices.rewind();                    vboLineMapped_indices_int_buffer.put(vboLineIndices);                   if (ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB) && ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB)){                        GL11.glDrawElements(GL11.GL_LINES, vLines.size()*2, GL11.GL_UNSIGNED_INT, 0);                   }               }               Display.update();               uSleep(1);              if(vThreadPausedHint){                  vThreadPausedHint = false;                  vThreadPaused = true;                   while(vThreadPaused){                       uSleep(1);                  }               }               else{                   if(vRefreshVbo){                        vTriFillVbo();                                              vRefreshVbo = false;                    }               }           }       }
项目:Sivx-3DDesktop    文件:engine.java   
public void vTriFillVbo(){          if(vTriangles.size() != 0){             vboVertices = ByteBuffer.allocateDirect(3 * 2 * (vTriangles.size()*3) * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();              vboIndices = ByteBuffer.allocateDirect((vTriangles.size()*3) * 4).order(ByteOrder.nativeOrder()).asIntBuffer();             for(int x = 0; x < vTriangles.size(); x++){                 ((vTriangle) vTriangles.get(x)).vPut();                 vboIndices.put(x*3+0).put(x*3+1).put(x*3+2);                }               vboVertices.rewind();               vboIndices.rewind();                ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 3 * 2 * (vTriangles.size()*3) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);             ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 3 * 2 * (vTriangles.size()*3) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);             if(!vVBOSETONCE)vVBOSETONCE=true;           }       }
项目:Sivx-3DDesktop    文件:engine.java   
public void vLineFillVbo(){         if(vLines.size() != 0){             vboLineVertices = ByteBuffer.allocateDirect(3 * (vLines.size()*2) * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();              vboLineIndices = ByteBuffer.allocateDirect((vLines.size()*2) * 4).order(ByteOrder.nativeOrder()).asIntBuffer();             for(int x = 0; x < vLines.size(); x++){                 ((vLine) vLines.get(x)).vPut();                 vboLineIndices.put(x*2+0).put(x*2+1);               }               vboLineVertices.rewind();               vboLineIndices.rewind();                ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 3 * (vLines.size()*2) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);             ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 3 * (vLines.size()*2) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);             if(!vVBOSETONCE)vVBOSETONCE=true;           }       }
项目:Sivx-3DDesktop    文件:engine.java   
public void run(){          debug("In the run block");          try{                debug("Setting Full Screen");               Display.setFullscreen(vFullscreen);             debug("Getting Available Display Modes");               DisplayMode d[] = Display.getAvailableDisplayModes();               for (int i = 0; i < d.length; i++) {                    debug("Possible mode: w[" + d[i].getWidth() + "] h[" + d[i].getHeight() + "] pixel depth["+d[i].getBitsPerPixel()+"]");                 if (d[i].getWidth() == vScreenW                     && d[i].getHeight() == vScreenH                     && d[i].getBitsPerPixel() == vDpi) {                        vDisplayMode = d[i];                        break;                  }               }               Display.setDisplayMode(vDisplayMode);               Display.setLocation(0,0);               Display.setTitle(vTitle);               Display.create();           }catch(Exception e){debug("Video Exception: " + e);}                        GL11.glMatrixMode(GL11.GL_PROJECTION);          GL11.glLoadIdentity();          GLU.gluPerspective(45.0f,(float) vDisplayMode.getWidth() / (float) vDisplayMode.getHeight(),0.1f,500.0f);           GL11.glMatrixMode(GL11.GL_MODELVIEW);           GL11.glDisable(GL11.GL_BLEND);          GL11.glEnable(GL11.GL_DEPTH_TEST);          GL11.glClearColor(0.18f, .18f, 1f, 0.0f);                                   if (!GLContext.getCapabilities().GL_ARB_vertex_buffer_object){              System.out.println("ARB VBO not supported!");               System.exit(1);         }           IntBuffer vboInt_buffer = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()).asIntBuffer();            ARBBufferObject.glGenBuffersARB(vboInt_buffer);         vboBuffer_id = vboInt_buffer.get(0);            vboIndices_buffer_id = vboInt_buffer.get(1);            ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, vboBuffer_id);           ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, vboIndices_buffer_id);           GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);         GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);                      GL11.glVertexPointer(3, GL11.GL_FLOAT, (3+2)*4, 0);         GL11.glTexCoordPointer(2, GL11.GL_FLOAT, (3+2)*4, (3)*4);                       textureUtil.map.add("images/minus.bmp");            textureUtil.map.add("images/minus.bmp");                        textureUtil.map.add("images/fontTest.bmp");                                             GL11.glEnable(GL11.GL_TEXTURE_2D);          textureUtil.addT("PNG", "textureMap.png");          textureUtil.bind(0);                                                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);                   while(true){                vFrameCount++;                              if (!Display.isVisible())uSleep(100);               else if(Display.isCloseRequested())System.exit(0);              GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);                GL11.glLoadIdentity();                GL11.glRotatef(vCameraLook,1.0f,0,0);               GL11.glRotatef(360.0f - vCameraAngle,0,1.0f,0);             GL11.glTranslatef(-vCameraX, -vCameraY, -vCameraZ);                             if(vVBOSETONCE){                    vLineGrid();                    vTriFillVbo();                                                          GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);                                      GL11.glVertexPointer(3, GL11.GL_FLOAT, (3+2)*4, 0);                 GL11.glTexCoordPointer(2, GL11.GL_FLOAT, (3+2)*4, (3)*4);                   ByteBuffer new_mapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB,ARBBufferObject.GL_WRITE_ONLY_ARB,vboMapped_buffer);                    if (new_mapped_buffer != vboMapped_buffer)vboMapped_float_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asFloatBuffer();                    vboMapped_buffer = new_mapped_buffer;                   new_mapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB,ARBBufferObject.GL_WRITE_ONLY_ARB,vboMapped_indices_buffer);                   if (new_mapped_buffer != vboMapped_indices_buffer)vboMapped_indices_int_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asIntBuffer();                    vboMapped_float_buffer.rewind();                    vboVertices.rewind();                   vboMapped_float_buffer.put(vboVertices);                    vboMapped_indices_int_buffer.rewind();                  vboIndices.rewind();                    vboMapped_indices_int_buffer.put(vboIndices);                   if (ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB) && ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB)){                        GL11.glDrawElements(GL11.GL_TRIANGLES, vTriangles.size()*3, GL11.GL_UNSIGNED_INT, 0);                   }                                                           GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);                                     GL11.glVertexPointer(3, GL11.GL_FLOAT,0, 0);                    vLineFillVbo();                                     ByteBuffer new_Linemapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB,ARBBufferObject.GL_WRITE_ONLY_ARB,vboLineMapped_buffer);                    if (new_Linemapped_buffer != vboLineMapped_buffer)vboLineMapped_float_buffer = new_Linemapped_buffer.order(ByteOrder.nativeOrder()).asFloatBuffer();                    vboLineMapped_buffer = new_Linemapped_buffer;                   new_Linemapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB,ARBBufferObject.GL_WRITE_ONLY_ARB,vboLineMapped_indices_buffer);                   if (new_Linemapped_buffer != vboLineMapped_indices_buffer)vboLineMapped_indices_int_buffer = new_Linemapped_buffer.order(ByteOrder.nativeOrder()).asIntBuffer();                    vboLineMapped_float_buffer.rewind();                    vboLineVertices.rewind();                   vboLineMapped_float_buffer.put(vboLineVertices);                    vboLineMapped_indices_int_buffer.rewind();                  vboLineIndices.rewind();                    vboLineMapped_indices_int_buffer.put(vboLineIndices);                   if (ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB) && ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB)){                        GL11.glDrawElements(GL11.GL_LINES, vLines.size()*2, GL11.GL_UNSIGNED_INT, 0);                   }               }               Display.update();               uSleep(1);              if(vThreadPausedHint){                  vThreadPausedHint = false;                  vThreadPaused = true;                   while(vThreadPaused){                       uSleep(1);                  }               }               else{                   if(vRefreshVbo){                        vTriFillVbo();                                              vRefreshVbo = false;                    }               }           }       }
项目:Sivx-3DDesktop    文件:engine.java   
public void vTriFillVbo(){          if(vTriangles.size() != 0){             vboVertices = ByteBuffer.allocateDirect(3 * 2 * (vTriangles.size()*3) * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();              vboIndices = ByteBuffer.allocateDirect((vTriangles.size()*3) * 4).order(ByteOrder.nativeOrder()).asIntBuffer();             for(int x = 0; x < vTriangles.size(); x++){                 ((vTriangle) vTriangles.get(x)).vPut();                 vboIndices.put(x*3+0).put(x*3+1).put(x*3+2);                }               vboVertices.rewind();               vboIndices.rewind();                ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 3 * 2 * (vTriangles.size()*3) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);             ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 3 * 2 * (vTriangles.size()*3) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);             if(!vVBOSETONCE)vVBOSETONCE=true;           }       }
项目:Sivx-3DDesktop    文件:engine.java   
public void vLineFillVbo(){         if(vLines.size() != 0){             vboLineVertices = ByteBuffer.allocateDirect(3 * (vLines.size()*2) * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();              vboLineIndices = ByteBuffer.allocateDirect((vLines.size()*2) * 4).order(ByteOrder.nativeOrder()).asIntBuffer();             for(int x = 0; x < vLines.size(); x++){                 ((vLine) vLines.get(x)).vPut();                 vboLineIndices.put(x*2+0).put(x*2+1);               }               vboLineVertices.rewind();               vboLineIndices.rewind();                ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 3 * (vLines.size()*2) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);             ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 3 * (vLines.size()*2) * 4, ARBBufferObject.GL_DYNAMIC_DRAW_ARB);             if(!vVBOSETONCE)vVBOSETONCE=true;           }       }