List of usage examples for org.lwjgl.opengl GL11 GL_MODELVIEW
int GL_MODELVIEW
To view the source code for org.lwjgl.opengl GL11 GL_MODELVIEW.
Click Source Link
From source file:eu.over9000.veya.gui.Gui.java
License:Open Source License
private static void setUpStates(final int width, final int height) { try {/*w w w . j av a 2s .c om*/ Display.setDisplayMode(new DisplayMode(width, height)); Display.create(); //Display.create(new PixelFormat().withSamples(4).withDepthBits(24), new ContextAttribs(3, 3)); Display.setVSyncEnabled(true); } catch (final LWJGLException e) { e.printStackTrace(); System.exit(0); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glClearColor(0.0f, 0.3f, 0.0f, 0.0f); GL11.glClearDepth(1); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glViewport(0, 0, width, height); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, width, height, 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:fable.imageviewer.views.ReliefView.java
License:Open Source License
@Override public void createPartControl(Composite parent) { thisView = this; parent.setLayout(new GridLayout(1, false)); GridUtils.removeMargins(parent);/*w w w. j a v a 2 s . c om*/ createActions(); Composite comp = new Composite(parent, SWT.NONE); comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); comp.setLayout(new FillLayout()); GLData data = new GLData(); data.doubleBuffer = true; canvas = new GLCanvas(comp, SWT.NONE, data); canvas.setSize(comp.getSize()); canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException ex) { FableUtils.excMsg(ReliefView.class, "Error in createPartControl using GLContext.useContext", ex); } // context = GLDrawableFactory.getFactory().createExternalGLContext(); canvas.addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { Rectangle bounds = canvas.getBounds(); // float fAspect = (float) bounds.width / (float) bounds.height; canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException ex) { FableUtils.excMsg(ReliefView.class, "Error in resize listener using GLContext.useContext", ex); } // context.makeCurrent(); // GL11 gl = context.getGL (); GL11.glViewport(0, 0, bounds.width, bounds.height); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); // GLU glu = new GLU(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); drawRelief(); canvas.swapBuffers(); // context.release(); } }); canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException ex) { FableUtils.excMsg(ReliefView.class, "Error in createPartControl using GLContext.useContext", ex); } // GL11 gl = context.getGL (); GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); GL11.glColor3f(1.0f, 0.0f, 0.0f); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glClearDepth(1.0); GL11.glLineWidth(2); GL11.glEnable(GL11.GL_DEPTH_TEST); // context.release(); // create the grip for users to change the orientation, translation and // zoom grip = new SceneGrip(canvas, this); canvas.addMouseListener(grip); canvas.addMouseMoveListener(grip); canvas.addListener(SWT.MouseWheel, grip); canvas.addKeyListener(grip); // apparently opengl has to be redrawn constantly (why ?) Display.getCurrent().asyncExec(new Runnable() { // int rot = 0; public void run() { if (canvas == null) return; if (!canvas.isDisposed()) { canvas.setCurrent(); Rectangle bounds = canvas.getBounds(); grip.setBounds(bounds); canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException ex) { FableUtils.excMsg(ReliefView.class, "Error in createPartControl using " + "GLContext.useContext", ex); } // GL11 gl = context.getGL (); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glClearColor(.0f, .0f, .0f, 1.0f); // black background drawRelief(); canvas.swapBuffers(); // context.release(); Display.getCurrent().timerExec(200, this); } } }); createImageInformationPanel(parent); }
From source file:fable.imageviewer.views.SceneGrip.java
License:Open Source License
/** * Warning called constantly in display loop - change with care. *///ww w .j a v a 2 s. c o m public void adjust() { canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException ex) { FableUtils.excMsg(ReliefView.class, "Error in adjust using GLContext.useContext", ex); } // gl = context.getGL (); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); /* set the orthogonal projection to the size of the window */ GL11.glOrtho(0, canvasWidth, canvasHeight, 0, -1.0e5f, 1.0e5f); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(canvasWidth / 2 + this.xoff, canvasHeight / 2 + this.yoff, 0); GL11.glScalef(zoff, zoff, zoff); /* * zoff has no effect on the orthogonal projection therefore zoom by * passing zoff to scale */ GL11.glRotatef(this.xrot, 1f, 0.0f, 0.0f); GL11.glRotatef(this.yrot, 0.0f, 1f, 0.0f); GL11.glTranslatef(-prov.getImageWidth() / 2, -prov.getImageHeight() / 2, 0); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void initPerspective(float angle) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();// w ww .j a v a 2 s . c o m //GL11.glPixelZoom( 1.0f, 1.0f ); //GL11.glViewport(0, 0, GLValues.screenWidth, GLValues.screenHeight); GLU.gluPerspective(angle, GLValues.glRatio, 0.001f, GLValues.glDepth); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void initOrtho() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();/*from ww w .ja va 2 s.co m*/ //GL11.glPixelZoom( 1.0f, 1.0f ); //GL11.glViewport(0, 0, GLValues.screenWidth, GLValues.screenHeight); GL11.glOrtho(0, GLValues.glWidth, GLValues.glHeight, 0, -GLValues.glDepth, GLValues.glDepth); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:flash.display.DisplayObject.java
License:Open Source License
public final void JITB$renderDisplayObject() { if (!visible()) { return;/*from w w w . j av a 2 s . co m*/ } GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); transform().matrix().JITB$toDoubleBuffer(modelViewMatrix); GL11.glLoadMatrix(modelViewMatrix); //GL11.glTranslated(x(), y(), 0.0); //GL11.glRotatef(_rotationRad, 0.0f, 0.0f, 1.0f); //GL11.glScaled(_scaleX, _scaleY, 1.0); GL11.glColor4d(_transform.colorTransform().redMultiplier, _transform.colorTransform().greenMultiplier, _transform.colorTransform().blueMultiplier, _transform.colorTransform().alphaMultiplier); final String blendMode = blendMode(); boolean disableDepthTest = false; if (blendMode.equals(BlendMode.ADD)) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); disableDepthTest = true; } try { JITB$render(); } finally { if (disableDepthTest) { GL11.glDisable(GL11.GL_BLEND); } GL11.glPopMatrix(); } }
From source file:forestry.core.render.CrateRenderingHandler.java
License:Open Source License
private void renderIn3D(ItemStack stack) { GL11.glPushMatrix();/*from w w w . j a va 2 s . c o m*/ Tessellator tessellator = Tessellator.instance; if (RenderManager.instance.renderEngine == null) { return; } int meta = stack.getItemDamage(); for (int pass = 0; pass < stack.getItem().getRenderPasses(meta); ++pass) { IIcon icon = stack.getItem().getIconFromDamageForRenderPass(meta, pass); if (icon == null) { continue; } if (renderItem.renderWithColor) { int color = stack.getItem().getColorFromItemStack(stack, pass); float c1 = (float) (color >> 16 & 255) / 255.0F; float c2 = (float) (color >> 8 & 255) / 255.0F; float c3 = (float) (color & 255) / 255.0F; GL11.glColor4f(c1, c2, c3, 1.0F); } float minU = icon.getMinU(); float maxU = icon.getMaxU(); float minV = icon.getMinV(); float maxV = icon.getMaxV(); if (stack.getItemSpriteNumber() == 0) { RenderManager.instance.renderEngine.bindTexture(BLOCK_TEXTURE); } else { RenderManager.instance.renderEngine.bindTexture(ITEM_TEXTURE); } ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), PIXEL); if (stack.hasEffect(pass)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); RenderManager.instance.renderEngine.bindTexture(GLINT_TEXTURE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f13 = 0.76F; GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f14 = 0.125F; GL11.glScalef(f14, f14, f14); float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f15, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, PIXEL); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f14, f14, f14); f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f15, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, PIXEL); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } GL11.glPopMatrix(); }
From source file:fr.def.iss.vd2.lib_v3d.camera.V3DCamera.java
License:Open Source License
public void display(float width, float height) { this.currentWidth = width; this.currentHeight = height; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();/* w ww . j av a 2 s .c o m*/ GL11.glOrtho(0, width, 0, height, -2000.0, 2000.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); backgroundScene.display(this); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); initPerspective(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glPushMatrix(); configureView(glu); if (!configured) { configured = true; if (cameraInitialisation != null) { cameraInitialisation.run(); cameraInitialisation = null; } } preDisplayScene(); if (currentScene != null) { currentScene.display(this); } postDisplayScene(); preDisplayGui(); postDisplayGui(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, width, 0, height, -2000.0, 2000.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); hudScene.display(this); GL11.glPopMatrix(); }
From source file:fr.def.iss.vd2.lib_v3d.V3DCanvas.java
License:Open Source License
/** * The only method that you should implement by yourself. * * @see javax.media.openGL11.GLEventListener#display(javax.media.openGL11.GLAutoDrawable) *//*from www . j a v a 2 s . c om*/ public void display() { GL11.glClear(GL11.GL_ACCUM_BUFFER_BIT); for (V3DCameraBinding binding : cameraList) { GL11.glViewport(binding.x, binding.y, binding.width, binding.height); //Clean Background I3dColor color = binding.camera.getBackgroundColor(); GL11.glClearColor(color.r, color.g, color.b, color.a); GL11.glScissor(binding.x, binding.y, binding.width, binding.height); GL11.glEnable(GL11.GL_SCISSOR_TEST); if (color.a == 1.0f) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); } else { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glOrtho(0, binding.width, 0, binding.height, -2000.0, 2000.0); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glColor4f(color.r, color.g, color.b, color.a); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(0, 0, 0); GL11.glVertex3f(binding.width, 0, 0); GL11.glVertex3f(binding.width, binding.height, 0); GL11.glVertex3f(0, binding.height, 0); GL11.glEnd(); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); } GL11.glDisable(GL11.GL_SCISSOR_TEST); binding.camera.display(binding.width, binding.height); GL11.glDisable(GL11.GL_DEPTH_TEST); // binding.getGui().display(); GL11.glEnable(GL11.GL_DEPTH_TEST); if (select && binding == focusCamera) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); //glu.gluPerspective(45.0f, h, 0.1, 2000.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); binding.camera.select(mouseX, mouseY); context.setMouseOverCameraBinding(binding); } } GL11.glFlush(); select = false; }
From source file:fr.mcnanotech.kevin_68.nanotechmod.main.client.renderer.RenderCreeperDriller.java
License:Creative Commons License
protected int renderMobCreeperDrillerPassModel(MobCreeperDriller mob, int par2, float par3) { if (mob.getPowered()) { if (par2 == 1) { float var4 = (float) mob.ticksExisted + par3; this.bindTexture(new ResourceLocation("textures/entity/creeper/creeper_armor.png")); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity();/* w w w . j a va2 s .co m*/ float var5 = var4 * 0.01F; float var6 = var4 * 0.01F; GL11.glTranslatef(var5, var6, 0.0F); this.setRenderPassModel(this.model); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_BLEND); float var7 = 0.5F; GL11.glColor4f(var7, var7, var7, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); return 1; } if (par2 == 2) { GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); } } return -1; }