List of usage examples for org.lwjgl.opengl GL11 glVertex3f
public static native void glVertex3f(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:fr.def.iss.vd2.lib_v3d.element.V3DCircle.java
License:Open Source License
private void drawExternCircle() { float step = 2f * (float) Math.PI / (float) quality; if (customColor) { GL11.glPushAttrib(GL11.GL_CURRENT_BIT); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); }//from w ww . j ava2 s . co m GL11.glBegin(GL11.GL_TRIANGLE_STRIP); for (int i = 0; i <= quality; i++) { if (customColor) { GL11.glColor4f(innerColor.r, innerColor.g, innerColor.b, innerColor.a); } GL11.glVertex3f((float) (innerRadius * Math.cos(step * i)), (float) (innerRadius * Math.sin(step * i)), 0f); if (customColor) { GL11.glColor4f(outerColor.r, outerColor.g, outerColor.b, outerColor.a); } GL11.glVertex3f((float) (radius * Math.cos(step * i)), (float) (radius * Math.sin(step * i)), 0f); } GL11.glEnd(); if (customColor) { GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glPopAttrib(); } }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DCircle.java
License:Open Source License
private void drawSolidCircle() { float step = 2f * (float) Math.PI / (float) quality; GL11.glBegin(GL11.GL_LINE_LOOP);/*from w w w . j av a2s . c o m*/ for (int i = 0; i <= quality; i++) { GL11.glVertex3f((float) (radius * Math.cos(step * i)), (float) (radius * Math.sin(step * i)), 0f); } GL11.glEnd(); GL11.glBegin(GL11.GL_POINTS); for (int i = 0; i <= quality; i++) { GL11.glVertex3f((float) (radius * Math.cos(step * i)), (float) (radius * Math.sin(step * i)), 0f); } 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 w w. j av a2 s . c o m*/ 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.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 ww w.j a va 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.def.iss.vd2.lib_v3d.v3draw.V3DrawReader.java
License:Open Source License
private void draw2dLineStripList() { int lineCount = buffer.getInt(); for (int lineIndex = 0; lineIndex < lineCount; lineIndex++) { int lineLenght = buffer.getInt(); GL11.glBegin(GL11.GL_LINE_STRIP); // Draw line for (int j = 0; j < lineLenght; j++) { GL11.glVertex3f(buffer.getFloat(), buffer.getFloat(), 0.0f); }/*from w w w . j av a 2 s . c om*/ GL11.glEnd(); } }
From source file:fr.def.iss.vd2.lib_v3d.v3draw.V3DrawReader.java
License:Open Source License
private void draw3dQuadList() { int quadCount = buffer.getInt(); GL11.glBegin(GL11.GL_QUADS);/*from w ww.java2 s . c om*/ for (int quadIndex = 0; quadIndex < quadCount; quadIndex++) { for (int i = 0; i < 4; i++) { GL11.glTexCoord2f(buffer.getFloat(), buffer.getFloat()); GL11.glNormal3f(buffer.getFloat(), buffer.getFloat(), buffer.getFloat()); GL11.glVertex3f(buffer.getFloat(), buffer.getFloat(), buffer.getFloat()); } } GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.v3draw.V3DrawReader.java
License:Open Source License
private void draw3dTriangleList() { int triangleCount = buffer.getInt(); GL11.glBegin(GL11.GL_TRIANGLES);//from www . ja v a 2 s . c om for (int triangleIndex = 0; triangleIndex < triangleCount; triangleIndex++) { for (int i = 0; i < 3; i++) { GL11.glTexCoord2f(buffer.getFloat(), buffer.getFloat()); GL11.glNormal3f(buffer.getFloat(), buffer.getFloat(), buffer.getFloat()); GL11.glVertex3f(buffer.getFloat(), buffer.getFloat(), buffer.getFloat()); } } GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.v3draw.V3DrawReader.java
License:Open Source License
private void draw3dPolygonList() { int polygonCount = buffer.getInt(); for (int polygonIndex = 0; polygonIndex < polygonCount; polygonIndex++) { GL11.glBegin(GL11.GL_POLYGON);//from w ww .j a v a 2 s . co m int vertexCount = buffer.getInt(); for (int i = 0; i < vertexCount; i++) { GL11.glTexCoord2f(buffer.getFloat(), buffer.getFloat()); GL11.glNormal3f(buffer.getFloat(), buffer.getFloat(), buffer.getFloat()); GL11.glVertex3f(buffer.getFloat(), buffer.getFloat(), buffer.getFloat()); } GL11.glEnd(); } }
From source file:fr.def.iss.vd2.lib_v3d.v3draw.V3DrawReader.java
License:Open Source License
private void drawRegistrated3dConcavePolygon() { int polygonIndex = buffer.getInt(); Tesselation tesselation = concavePolygonList.get(polygonIndex); List<Integer> vertexTypeList = tesselation.getVertexTypeList(); for (int i = 0; i < vertexTypeList.size(); i++) { List<V3DrawVertex> vertexList = tesselation.getVertexListList().get(i); GL11.glBegin(vertexTypeList.get(i)); for (V3DrawVertex vertex : vertexList) { GL11.glTexCoord2f(vertex.texture.x, vertex.texture.y); GL11.glNormal3f(vertex.normal.x, vertex.normal.y, vertex.normal.z); GL11.glVertex3f(vertex.position.x, vertex.position.y, vertex.position.z); }/* www . j a v a2 s . c om*/ GL11.glEnd(); } }
From source file:game.graphics.GUI_Button.java
License:Open Source License
public void Render() { texture.bind();/*w w w . j a v a2 s . c om*/ GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex3f(ScreenX, ScreenY, 0); GL11.glTexCoord2f(0, 1); GL11.glVertex3f(ScreenX, ScreenY + ScreenButtonHeight * (MouseInsideMe ? MouseOverMultiplier : 1), 0); GL11.glTexCoord2f(1, 1); GL11.glVertex3f(ScreenX + ScreenButtonWidth * (MouseInsideMe ? MouseOverMultiplier : 1), ScreenY + ScreenButtonHeight * (MouseInsideMe ? MouseOverMultiplier : 1), 0); GL11.glTexCoord2f(1, 0); GL11.glVertex3f(ScreenX + ScreenButtonWidth * (MouseInsideMe ? MouseOverMultiplier : 1), ScreenY, 0); GL11.glEnd(); }