private final ShortVBO[] makeSkyStripIndices() { ShortVBO[] strip_indices = new ShortVBO[subdiv_height - 2]; for (int i = 0; i < strip_indices.length; i++) { int size = subdiv_axis*2 + 2; ShortBuffer temp = BufferUtils.createShortBuffer(size); for (int j = 0; j < subdiv_axis; j++) { temp.put(j*2, (short)(i*subdiv_axis + j)); temp.put(j*2 + 1, (short)((i + 1)*subdiv_axis + j)); } temp.put(subdiv_axis*2, (short)(i*subdiv_axis)); temp.put(subdiv_axis*2 + 1, (short)((i + 1)*subdiv_axis)); strip_indices[i] = new ShortVBO(ARBBufferObject.GL_STATIC_DRAW_ARB, size); temp.rewind(); strip_indices[i].put(temp); } return strip_indices; }
public LandscapeRenderer(World world, WorldInfo world_info, GUIRoot gui_root, AnimationManager manager) { ShortBuffer indices = world.getLandscapeIndices().getIndices(); this.indices_vbo = new ShortVBO(ARBBufferObject.GL_STATIC_DRAW_ARB, indices.remaining()); this.indices_vbo.put(indices); this.landscape_vertices = new LandscapeTileVertices(world.getHeightMap(), HeightMap.GRID_UNITS_PER_PATCH_EXP, world.getHeightMap().getPatchesPerWorld()); this.patch_levels = new PatchLevel[world.getHeightMap().getPatchesPerWorld()][world.getHeightMap().getPatchesPerWorld()]; for (int y = 0; y < patch_levels.length; y++) for (int x = 0; x < patch_levels.length; x++) patch_levels[y][x] = new PatchLevel(); for (int y = 0; y < patch_levels.length; y++) for (int x = 0; x < patch_levels.length; x++) { PatchLevel right = getPatchWrapped(x + 1, y); PatchLevel top = getPatchWrapped(x, y + 1); patch_levels[y][x].init(right, top); } this.detail = world_info.detail; this.colormaps = world_info.colormaps; this.gui_root = gui_root; this.world = world; this.manager = manager; int levels = LandscapeTileIndices.getNumLOD(HeightMap.GRID_UNITS_PER_PATCH_EXP); patch_lists = new ArrayList[levels]; for (int i = 0; i < patch_lists.length; i++) patch_lists[i] = new ArrayList(); manager.registerAnimation(this); this.shadow_indices_buffer = BufferUtils.createShortBuffer(LandscapeTileIndices.getNumTriangles(world.getLandscapeIndices().getNumLOD() - 1)*3); resetEditing(); }
public TreeLowDetail(World world, Tree[] trees, LowDetailModel[] tree_low_details, List tree_positions, List palm_tree_positions, int terrain_type) { lowdetail_textures = new Texture[]{ (Texture)Resources.findResource(new TextureFile("/textures/models/lowdetail_tree", Globals.COMPRESSED_RGBA_FORMAT)), (Texture)Resources.findResource(new TextureFile("/textures/models/viking_lowdetail_tree", Globals.COMPRESSED_RGBA_FORMAT))}; int[] num_trees; switch (terrain_type) { case Landscape.NATIVE: num_trees = new int[]{tree_positions.size(), palm_tree_positions.size(), 0, 0}; break; case Landscape.VIKING: num_trees = new int[]{0, 0, tree_positions.size(), palm_tree_positions.size()}; break; default: throw new RuntimeException(); } this.low_details = tree_low_details; this.trees = trees; this.terrain_type = terrain_type; current_vertex_index = 0; int vertex_count = 0; int index_count = 0; for (int i = 0; i < num_trees.length; i++) { vertex_count += num_trees[i]*low_details[i].getVertices().length/3; index_count += num_trees[i]*low_details[i].getIndices().length; } vertices = new FloatVBO(ARBBufferObject.GL_DYNAMIC_DRAW_ARB, vertex_count*3); texcoords = new FloatVBO(ARBBufferObject.GL_STATIC_DRAW_ARB, vertex_count*2); tree_indices = new ShortVBO(ARBBufferObject.GL_STATIC_DRAW_ARB, index_count); }
public final void putSubData(int index, FloatBuffer buffer) { if (!use_vbo) { saved_buffer.position(index); saved_buffer.put(buffer); } else { makeCurrent(); ARBBufferObject.glBufferSubDataARB(getTarget(), index<<2, buffer); buffer.position(buffer.limit()); } }
private final ShortVBO makeSkyFanIndices() { int size = subdiv_axis + 2; ShortBuffer temp = BufferUtils.createShortBuffer(size); temp.put(0, (short)(sky_vertices.capacity()/3 - 1)); for (int i = 0; i < subdiv_axis; i++) { temp.put(i + 1, (short)((subdiv_height - 1)*subdiv_axis - i - 1)); } temp.put(subdiv_axis + 1, (short)((subdiv_height - 1)*subdiv_axis - 1)); ShortVBO fan_indices = new ShortVBO(ARBBufferObject.GL_STATIC_DRAW_ARB, size); temp.rewind(); fan_indices.put(temp); return fan_indices; }
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; } }
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; } }
private final static void makeCurrent(int target, int handle) { ARBBufferObject.glBindBufferARB(target, handle); }
protected final void doDelete() { if (use_vbo) { handle_buffer.put(0, handle); ARBBufferObject.glDeleteBuffersARB(handle_buffer); } }
private final void makeSkyVertices(float radius, float outer_utile, float outer_vtile, float inner_utile, float inner_vtile, float origin_x, float origin_y, float origin_z) { float r; float x, y, z; float height_coeff; float dome_height = radius; float h_angle_inc = ((float)java.lang.StrictMath.PI/2)/(subdiv_height - 1); float a_angle_inc = (float)java.lang.StrictMath.PI*2/subdiv_axis; // vertices.dumpInfo(); float offset_angle = a_angle_inc/2f; int num_vertices = subdiv_axis*(subdiv_height - 1) + 1; float[] vertices = new float[num_vertices*3]; float[] tex0 = new float[num_vertices*2]; float[] tex1 = new float[num_vertices*2]; float[] colors = new float[num_vertices*3]; // calculate skydome gradient colors float[] skydome_default_color = new float[] { (float)StrictMath.pow(SKYDOME_GRADIENT[terrain_type][0], SKYDOME_DEFAULT_COLOR), (float)StrictMath.pow(SKYDOME_GRADIENT[terrain_type][1], SKYDOME_DEFAULT_COLOR), (float)StrictMath.pow(SKYDOME_GRADIENT[terrain_type][2], SKYDOME_DEFAULT_COLOR) }; float[][] skydome_gradient = new float[SKYDOME_GRADIENT_LENGTH][3]; skydome_gradient[0] = SKYDOME_INITCOLOR[terrain_type]; float alpha; for (int i = 1; i < SKYDOME_GRADIENT_LENGTH; i++) { alpha = (float)i/(SKYDOME_GRADIENT_LENGTH - 1); skydome_gradient[i] = new float[] { alpha*skydome_default_color[0] + (1f - alpha)*skydome_gradient[i - 1][0]*SKYDOME_GRADIENT[terrain_type][0], alpha*skydome_default_color[1] + (1f - alpha)*skydome_gradient[i - 1][1]*SKYDOME_GRADIENT[terrain_type][1], alpha*skydome_default_color[2] + (1f - alpha)*skydome_gradient[i - 1][2]*SKYDOME_GRADIENT[terrain_type][2] }; } for (int i = 0; i < subdiv_height - 1; i++) { z = (float)java.lang.StrictMath.sin(h_angle_inc*i)*radius; r = (float)java.lang.StrictMath.cos(h_angle_inc*i)*radius; if (java.lang.StrictMath.abs(z) < 250f) height_coeff = dome_height/250f; else height_coeff = dome_height/z; for (int j = 0; j < subdiv_axis; j++) { x = (float)java.lang.StrictMath.cos(START_ANGLE + a_angle_inc*j + offset_angle*i)*r; y = (float)java.lang.StrictMath.sin(START_ANGLE + a_angle_inc*j + offset_angle*i)*r; if (i < SKYDOME_GRADIENT_LENGTH) putArray(skydome_gradient[i], i*subdiv_axis + j, colors); else putArray(skydome_default_color, i*subdiv_axis + j, colors); putArray(new float[]{x + origin_x, y + origin_y, z + origin_z}, i*subdiv_axis + j, vertices); putArray(new float[]{x*height_coeff/(radius*outer_utile) + 0.5f, y*height_coeff/(radius*outer_vtile) + 0.5f}, i*subdiv_axis + j, tex0); putArray(new float[]{x*height_coeff/(radius*inner_utile) + 0.5f, y*height_coeff/(radius*inner_vtile) + 0.5f}, i*subdiv_axis + j, tex1); } } int last_index = subdiv_axis*(subdiv_height - 1); if (subdiv_height - 1 < SKYDOME_GRADIENT_LENGTH) putArray(skydome_gradient[subdiv_height - 1], last_index, colors); else putArray(skydome_default_color, last_index, colors); putArray(new float[]{origin_x, origin_y, radius + origin_z}, last_index, vertices); putArray(new float[]{0.5f, 0.5f}, last_index, tex0); putArray(new float[]{0.5f, 0.5f}, last_index, tex1); sky_vertices = new FloatVBO(ARBBufferObject.GL_STATIC_DRAW_ARB, vertices); sky_tex0 = new FloatVBO(ARBBufferObject.GL_STATIC_DRAW_ARB, tex0); sky_tex1 = new FloatVBO(ARBBufferObject.GL_STATIC_DRAW_ARB, tex1); sky_colors = new FloatVBO(ARBBufferObject.GL_STATIC_DRAW_ARB, colors); }
@Override public int glGenBuffers() { return ARBBufferObject.glGenBuffersARB(); }
@Override public void glBindBuffer(int target, int buffer) { ARBBufferObject.glBindBufferARB(target, buffer); }
@Override public void glBufferData(int target, ByteBuffer data, int usage) { ARBBufferObject.glBufferDataARB(target, data, usage); }
@Override public void glDeleteBuffers(int buffer) { ARBBufferObject.glDeleteBuffersARB(buffer); }
public void glBindBuffer(int target, int buffer) { ARBBufferObject.glBindBufferARB(target, buffer); }
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; } } } }
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; } } } }