List of usage examples for org.lwjgl.opengl GL11 glBegin
public static native void glBegin(@NativeType("GLenum") int mode);
From source file:fr.def.iss.vd2.lib_v3d.element.V3DLine.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { GL11.glLineWidth(thickness);//from w ww . jav a2 s. c o m GL11.glEnable(GL11.GL_LINE_STIPPLE); GL11.glLineStipple(stippleFactor, stipplePattern); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3d(locationA.x, locationA.y, locationA.z); GL11.glVertex3d(locationB.x, locationB.y, locationB.z); GL11.glEnd(); GL11.glDisable(GL11.GL_LINE_STIPPLE); }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DPoint.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { GL11.glPointSize(size); GL11.glBegin(GL11.GL_POINTS); GL11.glVertex3d(0, 0, 0); GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DPolygon.java
License:Open Source License
private void displayPlainPolygon() { if (needCompute) { // TODO repair //computePolygon(); needCompute = false;/*from ww w . j a v a 2 s . com*/ } for (int i = 0; i < vertexTypeList.size(); i++) { List<double[]> vertexList = vertexListList.get(i); GL11.glBegin(vertexTypeList.get(i)); for (double[] vertex : vertexList) { GL11.glVertex3d(vertex[0], vertex[1], 0); } GL11.glEnd(); } }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DPolygon.java
License:Open Source License
private void displaySolidPolygon() { GL11.glLineWidth(thickness);//from ww w . j a v a 2 s. c o m GL11.glBegin(GL11.GL_LINES); for (int j = 0; j < pointListList.size(); j++) { List<V3DVect3> pointList = pointListList.get(j); for (int i = 0; i < pointList.size(); i++) { if (i == 0) { drawLine(pointList.get(pointList.size() - 1), pointList.get(i)); } else { drawLine(pointList.get(i - 1), pointList.get(i)); } } } GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DPolygonWalls.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { if (renderMode == RenderMode.PLAIN) { GL11.glEnable(GL11.GL_LIGHTING); GL11.glBegin(GL11.GL_QUADS); for (int i = 0; i < pointList.size(); i++) { if (i == 0) { drawQuad(pointList.get(pointList.size() - 1), pointList.get(i)); } else { drawQuad(pointList.get(i - 1), pointList.get(i)); }/*from w w w. j av a2s. com*/ } GL11.glEnd(); GL11.glDisable(GL11.GL_LIGHTING); } if (renderMode == RenderMode.SOLID) { GL11.glLineWidth(thickness); GL11.glBegin(GL11.GL_LINES); for (V3DVect3 point : pointList) { float z0 = -height / 2; float z1 = height / 2; GL11.glVertex3d(point.x, point.y, z1); GL11.glVertex3d(point.x, point.y, z0); } GL11.glEnd(); } }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DRectangle.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { float x0 = -size.x / 2; float y0 = -size.y / 2; float x1 = size.x / 2; float y1 = size.y / 2; GL11.glLineWidth(thickness);// w w w . j a v a 2 s .co m if (renderMode == RenderMode.SOLID) { GL11.glEnable(GL11.GL_LINE_STIPPLE); GL11.glLineStipple(stippleFactor, stipplePattern); GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex3d(x0, y1, 0); GL11.glVertex3d(x0, y0, 0); GL11.glVertex3d(x1, y0, 0); GL11.glVertex3d(x1, y1, 0); GL11.glEnd(); GL11.glDisable(GL11.GL_LINE_STIPPLE); } else { GL11.glBegin(GL11.GL_QUADS); 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.V3DSprite.java
License:Open Source License
@Override protected void doDisplay(V3DCamera camera) { if (!enableColor) { GL11.glPushAttrib(GL11.GL_CURRENT_BIT); GL11.glColor4f(1, 1, 1, opacity); }/*from w ww .ja va2s . c om*/ GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f); GL11.glEnable(GL11.GL_ALPHA_TEST); if (disableRotation) { camera.disableRotation(); } float w = 0.5f * size.x * image.getWidth(); float h = 0.5f * size.y * image.getHeight(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getID()); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(-w, -h, 0.0f); GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex3f(w, -h, 0.0f); GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex3f(w, h, 0.0f); GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex3f(-w, h, 0.0f); GL11.glEnd(); if (disableRotation) { camera.enableRotation(); } GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_TEXTURE_2D); if (!enableColor) { GL11.glPopAttrib(); } }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DTriangle.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { float x0 = -size.x / 2; float y0 = -size.y / 2; float x1 = size.x / 2; float y1 = size.y / 2; GL11.glLineWidth(thickness);/*from w w w .java2s .c om*/ if (renderMode == RenderMode.SOLID) { GL11.glEnable(GL11.GL_LINE_STIPPLE); GL11.glLineStipple(stippleFactor, stipplePattern); GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex3d(x0, y1, 0); GL11.glVertex3d((x1 + x0) / 2, y0, 0); GL11.glVertex3d(x1, y1, 0); GL11.glEnd(); GL11.glDisable(GL11.GL_LINE_STIPPLE); } else { GL11.glBegin(GL11.GL_TRIANGLES); GL11.glVertex3d(x0, y1, 0); GL11.glVertex3d((x1 + x0) / 2, y0, 0); GL11.glVertex3d(x1, y1, 0); GL11.glEnd(); } }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DTube.java
License:Open Source License
@Override protected void doDisplay(I3dCamera camera) { if (renderMode == RenderMode.PLAIN) { GL11.glEnable(GL11.GL_LIGHTING); GL11.glBegin(GL11.GL_QUADS); for (int i = 0; i < pointList.size(); i++) { if (i == 0) { drawQuad(pointList.get(pointList.size() - 1), pointList.get(i)); } else { drawQuad(pointList.get(i - 1), pointList.get(i)); }//from w ww . j a v a2 s . c om } GL11.glEnd(); GL11.glDisable(GL11.GL_LIGHTING); } if (renderMode == RenderMode.SOLID) { GL11.glLineWidth(thickness); GL11.glBegin(GL11.GL_LINES); for (V3DVect3 point : pointList) { float z0 = -height / 2; float z1 = height / 2; GL11.glVertex3d(point.x, point.y, z1); GL11.glVertex3d(point.x, point.y, z0); } GL11.glEnd(); } /* Dessine des normales sur les sommets en gradients de couleurs GL11.glLineWidth(thickness); GL11.glEnable(GL11.GL_LINE_STIPPLE); GL11.GLLineStipple(1, (short) 0xFFFF); GL11.glPushAttrib(GL11.GL_COLOR); GL11.glBegin(GL11.GL_LINES); for (int i = 0; i < pointList.size(); i++) { drawNorm( pointList.get(i), radius * 0.6f); } GL11.glPopAttrib(); GL11.glEnd(); GL11.glDisable(GL11.GL_LINE_STIPPLE); */ }
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 w w w. ja va 2 s. com 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; }