List of usage examples for org.lwjgl.opengl GL11 glLineWidth
public static void glLineWidth(@NativeType("GLfloat") float width)
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);//from w ww.j a v a2s.c o m 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:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void drawLineCircle(float radius, float segments, float lineWidth) { GL11.glBindTexture(GL11.GL_TEXTURE_2D, -1); GL11.glLineWidth(lineWidth); GL11.glBegin(GL11.GL_LINE_LOOP);//w ww .j ava 2s. c om for (float a = 0; a < 2 * Math.PI; a += (2.0f * Math.PI) / segments) { GL11.glVertex3d(Math.sin(a) * radius, Math.cos(a) * radius, 0); } GL11.glEnd(); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void drawLineRect(float w, float x0, float y0, float x1, float y1, float z) { GL11.glBindTexture(GL11.GL_TEXTURE_2D, -1); GL11.glLineWidth(w); GL11.glBegin(GL11.GL_LINE_LOOP);/*from w w w. j a v a2 s .c o m*/ GL11.glVertex3d(x0, y1, z); GL11.glVertex3d(x1, y1, z); GL11.glVertex3d(x1, y0, z); GL11.glVertex3d(x0, y0, z); GL11.glEnd(); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void drawLine(float x0, float y0, float x1, float y1, float z0, float z1, float lineWidth) { GL11.glLineWidth(lineWidth); GL11.glBegin(GL11.GL_LINES);//from ww w.j a v a2 s. co m GL11.glVertex3f(x0, y0, z0); GL11.glVertex3f(x1, y1, z1); GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.camera.V3DSimple2DCamera.java
License:Open Source License
private void displayTarget() { GL11.glColor4f(1.0f, 0.5f, 0.5f, 0.8f); GL11.glLineWidth(1.2f); GL11.glBegin(GL11.GL_LINES);//from w w w. j a v a2s .c o m { GL11.glColor4f(1.0f, 0.0f, 0.0f, 0.8f); GL11.glVertex3d(-1, 0, 0); GL11.glVertex3d(1, 0, 0); GL11.glVertex3d(0.9, 0.1, 0); GL11.glVertex3d(1, 0, 0); GL11.glVertex3d(0.9, -0.1, 0); GL11.glVertex3d(1, 0, 0); //y GL11.glColor4f(0.0f, 1.0f, 0.0f, 0.8f); GL11.glVertex3d(0, -1, 0); GL11.glVertex3d(0, 1, 0); GL11.glVertex3d(0.1, 0.9, 0); GL11.glVertex3d(0, 1, 0); GL11.glVertex3d(-0.1, 0.9, 0); GL11.glVertex3d(0, 1, 0); //z GL11.glColor4f(0.0f, 0.0f, 1.0f, 0.8f); GL11.glVertex3d(0, 0, -1); GL11.glVertex3d(0, 0, 1); GL11.glVertex3d(0.1, 0, 0.9); GL11.glVertex3d(0, 0, 1); GL11.glVertex3d(-0.1, 0, 0.9); GL11.glVertex3d(0, 0, 1); } GL11.glEnd(); GL11.glPointSize(1.2f); GL11.glBegin(GL11.GL_POINTS); { GL11.glVertex3d(position.x, position.y, 0); } GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.camera.V3DSimple3DCamera.java
License:Open Source License
private void displayTarget() { GL11.glColor4f(1.0f, 0.5f, 0.5f, 0.8f); GL11.glLineWidth(1.2f); GL11.glBegin(GL11.GL_LINES);//from w w w. j a va 2 s .com { GL11.glColor4f(1.0f, 0.0f, 0.0f, 0.8f); GL11.glVertex3d(-1, 0, 0); GL11.glVertex3d(1, 0, 0); GL11.glVertex3d(0.9, 0.1, 0); GL11.glVertex3d(1, 0, 0); GL11.glVertex3d(0.9, -0.1, 0); GL11.glVertex3d(1, 0, 0); //y GL11.glColor4f(0.0f, 1.0f, 0.0f, 0.8f); GL11.glVertex3d(0, -1, 0); GL11.glVertex3d(0, 1, 0); GL11.glVertex3d(0.1, 0.9, 0); GL11.glVertex3d(0, 1, 0); GL11.glVertex3d(-0.1, 0.9, 0); GL11.glVertex3d(0, 1, 0); //z GL11.glColor4f(0.0f, 0.0f, 1.0f, 0.8f); GL11.glVertex3d(0, 0, -1); GL11.glVertex3d(0, 0, 1); GL11.glVertex3d(0.1, 0, 0.9); GL11.glVertex3d(0, 0, 1); GL11.glVertex3d(-0.1, 0, 0.9); GL11.glVertex3d(0, 0, 1); } GL11.glEnd(); GL11.glPointSize(1.2f); GL11.glBegin(GL11.GL_POINTS); { GL11.glVertex3d(position.x, position.y, position.z); } GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.element.basemap.PolyBasemap.java
License:Open Source License
@Override protected void doDisplay(I3dCamera cameraDistance) { GL11.glLineWidth(1.0f); //GL11.GLCallList(listId); draw(); }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DBoundingBox.java
License:Open Source License
public void displayFlatLines() { float x0 = position.x - size.x / 2; float y0 = position.y - size.y / 2; float x1 = position.x + size.x / 2; float y1 = position.y + size.y / 2; GL11.glColor4f(lineColor.r, lineColor.g, lineColor.b, lineColor.a); GL11.glLineWidth(2.0f); GL11.glBegin(GL11.GL_LINE_LOOP);// ww w . jav a 2s . c o m GL11.glVertex3d(x0, y1, 0); GL11.glVertex3d(x0, y0, 0); GL11.glVertex3d(x1, y0, 0); GL11.glVertex3d(x1, y1, 0); GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DBoundingBox.java
License:Open Source License
public void displayThickLines() { float x0 = position.x - size.x / 2; float x1 = position.x + size.x / 2; float y0 = position.y - size.y / 2; float y1 = position.y + size.y / 2; float z0 = position.z - size.z / 2; float z1 = position.z + size.z / 2; GL11.glColor4f(lineColor.r, lineColor.g, lineColor.b, lineColor.a); GL11.glLineWidth(2.0f); GL11.glBegin(GL11.GL_LINE_LOOP);//from ww w. j av a 2 s. c o m GL11.glVertex3d(x0, y0, z1); GL11.glVertex3d(x0, y1, z1); GL11.glVertex3d(x1, y1, z1); GL11.glVertex3d(x1, y0, z1); GL11.glEnd(); GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex3d(x0, y1, z0); GL11.glVertex3d(x0, y0, z0); GL11.glVertex3d(x1, y0, z0); GL11.glVertex3d(x1, y1, z0); GL11.glEnd(); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3d(x0, y1, z1); GL11.glVertex3d(x0, y1, z0); GL11.glVertex3d(x0, y0, z1); GL11.glVertex3d(x0, y0, z0); GL11.glVertex3d(x1, y0, z1); GL11.glVertex3d(x1, y0, z0); GL11.glVertex3d(x1, y1, z1); GL11.glVertex3d(x1, y1, z0); GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DBox.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { float x0 = -size.x / 2; float x1 = size.x / 2; float y0 = -size.y / 2; float y1 = size.y / 2; float z0 = -size.z / 2; float z1 = size.z / 2; if (renderMode == RenderMode.PLAIN) { //GL11.glEnable(GL11.GL_LIGHTING); GL11.glBegin(GL11.GL_QUADS);/*w ww . jav a 2 s. co m*/ GL11.glNormal3f(0, 1, 0); GL11.glVertex3d(x0, y0, z1); GL11.glVertex3d(x0, y0, z0); GL11.glVertex3d(x1, y0, z0); GL11.glVertex3d(x1, y0, z1); GL11.glNormal3f(1, 0, 0); GL11.glVertex3d(x0, y1, z1); GL11.glVertex3d(x0, y1, z0); GL11.glVertex3d(x0, y0, z0); GL11.glVertex3d(x0, y0, z1); GL11.glNormal3f(0, -1, 0); GL11.glVertex3d(x1, y1, z1); GL11.glVertex3d(x1, y1, z0); GL11.glVertex3d(x0, y1, z0); GL11.glVertex3d(x0, y1, z1); GL11.glNormal3f(-1, 0, 0); GL11.glVertex3d(x1, y0, z1); GL11.glVertex3d(x1, y0, z0); GL11.glVertex3d(x1, y1, z0); GL11.glVertex3d(x1, y1, z1); GL11.glNormal3f(0, 0, 1); GL11.glVertex3d(x0, y0, z0); GL11.glVertex3d(x0, y1, z0); GL11.glVertex3d(x1, y1, z0); GL11.glVertex3d(x1, y0, z0); GL11.glNormal3f(0, 0, -1); GL11.glVertex3d(x0, y1, z1); GL11.glVertex3d(x0, y0, z1); GL11.glVertex3d(x1, y0, z1); GL11.glVertex3d(x1, y1, z1); GL11.glEnd(); GL11.glDisable(GL11.GL_LIGHTING); } if (renderMode == RenderMode.SOLID) { GL11.glLineWidth(thickness); GL11.glEnable(GL11.GL_LINE_STIPPLE); GL11.glLineStipple(stippleFactor, stipplePattern); GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex3d(x0, y0, z1); GL11.glVertex3d(x0, y1, z1); GL11.glVertex3d(x1, y1, z1); GL11.glVertex3d(x1, y0, z1); GL11.glEnd(); GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex3d(x0, y1, z0); GL11.glVertex3d(x0, y0, z0); GL11.glVertex3d(x1, y0, z0); GL11.glVertex3d(x1, y1, z0); GL11.glEnd(); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3d(x0, y1, z1); GL11.glVertex3d(x0, y1, z0); GL11.glVertex3d(x0, y0, z1); GL11.glVertex3d(x0, y0, z0); GL11.glVertex3d(x1, y0, z1); GL11.glVertex3d(x1, y0, z0); GL11.glVertex3d(x1, y1, z1); GL11.glVertex3d(x1, y1, z0); GL11.glEnd(); GL11.glDisable(GL11.GL_LINE_STIPPLE); } }