private static void printBufferObjectChecks( PrintWriter writer, ExecutableElement method, Mode mode, boolean context_specific) { EnumSet<BufferKind> check_set = EnumSet.noneOf(BufferKind.class); for (VariableElement param : method.getParameters()) { BufferObject bo_annotation = param.getAnnotation(BufferObject.class); if (bo_annotation != null) { check_set.add(bo_annotation.value()); } } for (BufferKind kind : check_set) { printBufferObjectCheck(writer, kind, mode, context_specific); } }
public void draw(ShaderProgram program, BoundingFrustum frustum) { program.reset(); final Matrix matrix = getModelMatrix(); final LWJGLModel3D model = (LWJGLModel3D) getModel(); for (final Group g : model.getGroups()) { for (final IBufferObject ib : g.getBuffers()) { BufferObject b = (BufferObject) ib; final BoundingSphere sph = TEMP_SPHERE_DRAW.set(b); sph.add(matrix.getTranslation()); if (frustum.contains(sph) != ContainmentType.Disjoint) { b.bind(program); program.setModelMatrix(matrix); b.draw(program); } } } }
public MapRenderer(Map map) { mMap = map; mViewport = new GLViewport(); mBufferPool = new NativeBufferPool(); /* FIXME should be done in 'destroy' method * clear all previous vbo refs */ BufferObject.clear(); setBackgroundColor(Color.DKGRAY); }
/** * Adds the given BufferObject to this VertexArray's list of BufferObjects that are usable as * vertex buffers in this array * * @param name String id for the given BufferObject * @param buffer BufferObject with a BufferType of Array * @return True if the given BufferObject is a compatible type and was added, false otherwise */ public boolean addVertexBuffer(String name, BufferObject buffer) { // check that the buffer type is a valid type if (buffer.getType() == BufferType.ARRAY) { vbos.put(name, buffer); bufferIndices.put(name, highestBufferIndex); highestBufferIndex++; return true; } else { return false; } }
private void draw() { GLState.setClearColor(mClearColor); gl.depthMask(true); gl.stencilMask(0xFF); gl.clear(GL.COLOR_BUFFER_BIT | GL.DEPTH_BUFFER_BIT | GL.STENCIL_BUFFER_BIT); gl.depthMask(false); gl.stencilMask(0); GLState.test(false, false); GLState.blend(false); GLState.bindTex2D(-1); GLState.useProgram(-1); GLState.bindElementBuffer(-1); GLState.bindVertexBuffer(-1); mViewport.setFrom(mMap); if (GLAdapter.debugView) { /* modify this to scale only the view, to see * which tiles are rendered */ mViewport.mvp.setScale(0.5f, 0.5f, 1); mViewport.viewproj.multiplyLhs(mViewport.mvp); mViewport.proj.multiplyLhs(mViewport.mvp); } /* update layers */ LayerRenderer[] layers = mMap.layers().getLayerRenderer(); for (int i = 0, n = layers.length; i < n; i++) { LayerRenderer renderer = layers[i]; if (!renderer.isInitialized) { renderer.setup(); renderer.isInitialized = true; } renderer.update(mViewport); if (renderer.isReady) renderer.render(mViewport); if (GLAdapter.debug) GLUtils.checkGlError(renderer.getClass().getName()); } if (GLUtils.checkGlOutOfMemory("finish")) { BufferObject.checkBufferUsage(true); // FIXME also throw out some textures etc } }
public void onSurfaceCreated() { // log.debug(GL.getString(GL20.EXTENSIONS)); String vendor = gl.getString(GL.VENDOR); String renderer = gl.getString(GL.RENDERER); String version = gl.getString(GL.VERSION); log.debug("{}/{}/{}", vendor, renderer, version); // Prevent issue with Adreno 3xx series if (renderer != null && renderer.startsWith("Adreno (TM) 3")) { log.debug("==> not using glBufferSubData"); GLAdapter.NO_BUFFER_SUB_DATA = true; } GLState.init(); // Set up some vertex buffer objects BufferObject.init(200); // classes that require GL context for initialization RenderBuckets.initRenderer(); mNewSurface = true; }