/** * Builds the display list for a given display list index. * * @param gl Instance of GL2. * @param iGLDisplayListIndex Index of the display list. */ private void buildDisplayList(final GL2 gl, int iGLDisplayListIndex) { if (pdRealRootElement != null && pdCurrentRootElement != null) { gl.glNewList(iGLDisplayListIndex, GL2.GL_COMPILE); float fXCenter = viewFrustum.getWidth() / 2; float fYCenter = viewFrustum.getHeight() / 2; gl.glLoadIdentity(); upwardNavigationSlider.draw( gl, pickingManager, textureManager, uniqueID, iUpwardNavigationSliderID, iUpwardNavigationSliderButtonID, iUpwardNavigationSliderBodyID); float fCurrentSliderWidth = upwardNavigationSlider.getScaledWidth(gl); float fCurrentSliderHeight = upwardNavigationSlider.getScaledHeight(gl); controlBox.setRectangle( 0, 0, fCurrentSliderWidth * 2, fCurrentSliderHeight + fCurrentSliderWidth); LabelManager.get().setControlBox(controlBox); drawingController.draw(fXCenter, fYCenter, gl, new GLU()); gl.glEndList(); } else { renderSymbol(gl, EIconTextures.RADIAL_SYMBOL.getFileName(), 0.5f); } }
public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); glut = new GLUT(); // float ambient[] = new float[] {0.0f, 0.0f, 0.0f, 1.0f}; float diffuse[] = new float[] {1.0f, 1.0f, 1.0f, 1.0f}; float specular[] = new float[] {1.0f, 1.0f, 1.0f, 1.0f}; float position[] = new float[] {0.0f, 3.0f, 3.0f, 0.0f}; float lmodel_ambient[] = new float[] {0.2f, 0.2f, 0.2f, 1.0f}; float local_view[] = new float[] {0.0f}; gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_SPECULAR, ambient, 0); gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, diffuse, 0); gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, position, 0); gl.glLightModelfv(GL2.GL_LIGHT_MODEL_AMBIENT, lmodel_ambient, 0); gl.glLightModelfv(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, local_view, 0); gl.glFrontFace(GL.GL_CW); gl.glEnable(GL2.GL_LIGHTING); gl.glEnable(GL2.GL_LIGHT0); gl.glEnable(GL2.GL_AUTO_NORMAL); gl.glEnable(GL2.GL_NORMALIZE); gl.glEnable(GL.GL_DEPTH_TEST); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClearAccum(0.0f, 0.0f, 0.0f, 0.0f); /* make teapot display list */ teapotList = gl.glGenLists(1); gl.glNewList(teapotList, GL2.GL_COMPILE); glut.glutSolidTeapot(0.5f); gl.glEndList(); }
/** * Rendering method. * * @param gl */ public final void render(GL2 gl) { boolean displayListsAllowedByLayoutManager = false; if (layoutManager != null) { displayListsAllowedByLayoutManager = layoutManager.isUseDisplayLists(); } if (displayListsAllowedByLayoutManager && !hasDisplayListIndex && permitsWrappingDisplayLists()) { displayListIndex = gl.glGenLists(1); hasDisplayListIndex = true; } prepare(); if (isDisplayListDirty() && permitsWrappingDisplayLists() && displayListsAllowedByLayoutManager) { gl.glNewList(displayListIndex, GL2.GL_COMPILE); renderContent(gl); gl.glEndList(); setDisplayListDirty(false); } if (permitsWrappingDisplayLists() && displayListsAllowedByLayoutManager) { gl.glCallList(displayListIndex); } else { renderContent(gl); } }
private void buildFont(GL2 gl) { // Build Our Font Display List base = gl.glGenLists(256); // Creating 256 Display Lists for (int loop1 = 0; loop1 < 256; loop1++) { // Loop Through All 256 // Lists float cx = (float) (loop1 % 16) / 16.0f; // X Position Of Current // Character float cy = (float) (loop1 / 16) / 16.0f; // Y Position Of Current // Character gl.glNewList(base + loop1, GL2.GL_COMPILE); // Start Building A List gl.glBegin(GL2.GL_QUADS); // Use A Quad For Each Character gl.glTexCoord2f(cx, 1.0f - cy - 0.0625f); // Texture Coord (Bottom // Left) gl.glVertex2d(0, 16); // Vertex Coord (Bottom Left) gl.glTexCoord2f(cx + 0.0625f, 1.0f - cy - 0.0625f); // Texture Coord // (Bottom // Right) gl.glVertex2i(16, 16); // Vertex Coord (Bottom Right) gl.glTexCoord2f(cx + 0.0625f, 1.0f - cy - 0.001f); // Texture Coord // (Top Right) gl.glVertex2i(16, 0); // Vertex Coord (Top Right) gl.glTexCoord2f(cx, 1.0f - cy - 0.001f); // Texture Coord (Top Left) gl.glVertex2i(0, 0); // Vertex Coord (Top Left) gl.glEnd(); // Done Building Our Quad (Character) gl.glTranslated(14, 0, 0); // Move To The Right Of The Character gl.glEndList(); // Done Building The Display List } // Loop Until All 256 Are Built }
public BlueShell(GL2 gl, Scene scene, Vehicle car, float trajectory) { super(gl, scene, car, trajectory); if (shellList == -1) { shellList = gl.glGenLists(1); gl.glNewList(shellList, GL2.GL_COMPILE); displayWildcardObject(gl, SHELL_FACES, textures); gl.glEndList(); spikeNode = new SceneNode(spike_model); spikeNode.setRenderMode(RenderMode.COLOR); noiseSampler = TextureLoader.load(gl, "tex/blast_noise.png"); float[] blastColor = RGB.INDIGO; blastLight = new Light(gl, new Vec3(), blastColor, blastColor, blastColor); blastLight.setConstantAttenuation(0.5f); blastLight.setLinearAttenuation(0.001f); blastLight.setQuadraticAttenuation(0.001f); blastLight.enableAttenuation = true; blastLight.disable(gl); } generator = new ParticleGenerator(); boundColor = RGB.toRGBA(RGB.INDIGO, BOUND_ALPHA); }
private void compile(GL2 gl) { startList = 12; gl.glNewList(startList, GL2.GL_COMPILE); gl.glColor3f(1f, 1f, 1f); glut.glutSolidCube(0.6f); gl.glEndList(); }
/** * Método que indica se ha finalizado de almacenar la lista. * * @param gl Contexto gráfico en el que se realiza a acción. */ public static void endList(GL2 gl) { gl.glEndList(); }