List of usage examples for org.lwjgl.opengl GL11 glBlendFunc
public static void glBlendFunc(@NativeType("GLenum") int sfactor, @NativeType("GLenum") int dfactor)
From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java
License:Mozilla Public License
public InspectorCanvas(Composite parent, int style, GLData data) { super(parent, style, data); setCurrent();//from w w w .j a va 2s.c om // Clear the canvas. GL11.glClearColor(CLEAR_COLOR[0], CLEAR_COLOR[1], CLEAR_COLOR[2], CLEAR_COLOR[3]); GL11.glClearDepth(1.0f); GL11.glLineWidth(1.0f); GL11.glPointSize(1.0f); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); GL11.glEnable(GL11.GL_POLYGON_SMOOTH); GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.01f); GL11.glEnable(GL11.GL_STENCIL_TEST); GL11.glStencilFunc(GL11.GL_ALWAYS, 0x1, 0xf); GL11.glStencilOp(GL11.GL_INCR, GL11.GL_KEEP, GL11.GL_INCR); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); reset(); mTransform = new Matrix4f(); mTransform.setIdentity(); addListener(SWT.Resize, this); addListener(SWT.Paint, this); addMouseListener(this); addMouseWheelListener(this); }
From source file:com.teambr.bookshelf.util.RenderUtils.java
License:Creative Commons License
/** * Draws a sphere, bind texture first!/*from w w w .j ava 2 s . c o m*/ * @param radius The radius of the sphere * @param stacks How many squares in a slice * @param slices How manay slices (try to match stacks) * @param tex The texture to place * @param drawMode The draw mode * @param color The color to apply */ public static void renderSphere(float radius, int stacks, int slices, TextureAtlasSprite tex, DrawableShape.TEXTURE_MODE drawMode, Color color) { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); setColor(color); GL11.glEnable(GL11.GL_ALPHA_TEST); TexturedSphere sphere = new TexturedSphere(); GL11.glShadeModel(GL11.GL_SMOOTH); sphere.setDrawStyle(GLU.GLU_FILL); sphere.setNormals(GLU.GLU_SMOOTH); sphere.setTextureFlag(true); sphere.setTextureMode(drawMode); sphere.setOrientation(GLU.GLU_OUTSIDE); GL11.glTexCoord4f(tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV()); sphere.draw(radius, slices, stacks, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV()); GL11.glPopMatrix(); }
From source file:com.teambr.bookshelf.util.RenderUtils.java
License:Creative Commons License
public static void renderCylinder(float radius, int stacks, int slices, TextureAtlasSprite tex, DrawableShape.TEXTURE_MODE drawMode, Color color) { GL11.glPushMatrix();/* w ww. java2 s . c o m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); setColor(color); GL11.glEnable(GL11.GL_ALPHA_TEST); TexturedCylinder cylinder = new TexturedCylinder(); GL11.glShadeModel(GL11.GL_SMOOTH); cylinder.setDrawStyle(GLU.GLU_FILL); cylinder.setNormals(GLU.GLU_SMOOTH); cylinder.setTextureFlag(true); cylinder.setTextureMode(drawMode); cylinder.setOrientation(GLU.GLU_OUTSIDE); GL11.glTexCoord4f(tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV()); cylinder.draw(radius, slices, stacks, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV()); GL11.glPopMatrix(); }
From source file:com.teambrmodding.neotech.client.renderers.tiles.TileTankFluidRenderer.java
License:Creative Commons License
@Override public void renderTileEntityAt(TileBasicTank te, double x, double y, double z, float partialTicks, int destroyStage) { if (te.tanks[TileBasicTank.TANK].getFluid() != null || te instanceof TileVoidTank) { GlStateManager.pushMatrix();//from w ww. j a v a 2s .c o m GlStateManager.pushAttrib(); GlStateManager.translate(x, y, z); RenderUtils.bindMinecraftBlockSheet(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.disableLighting(); if (!(te instanceof TileVoidTank)) { TextureAtlasSprite fluidIcon = Minecraft.getMinecraft().getTextureMapBlocks() .getAtlasSprite(te.tanks[TileBasicTank.TANK].getFluid().getFluid().getStill().toString()); if (te.tanks[TileBasicTank.TANK].getFluid().getFluid() != FluidRegistry.WATER) RenderUtils.setColor(Color .decode(String.valueOf(te.tanks[TileBasicTank.TANK].getFluid().getFluid().getColor()))); if (te.tanks[TileBasicTank.TANK].getFluid().getFluid().isGaseous()) GlStateManager.translate(0, 1 - (te.getFluidLevelScaled()) - 0.1, 0); RenderUtils.renderCubeWithTexture(2.01 / 16.0, 1.01 / 16.0, 2.01 / 16.0, 13.99 / 16.0, te.getFluidLevelScaled(), 13.99 / 16.0, fluidIcon.getMinU(), fluidIcon.getMinV(), fluidIcon.getMaxU(), fluidIcon.getMaxV()); } else { TextureAtlasSprite voidIcon = Minecraft.getMinecraft().getTextureMapBlocks() .getAtlasSprite("minecraft:blocks/portal"); RenderUtils.renderCubeWithTexture(2.01 / 16.0, 1.01 / 16, 2.01 / 16.0, 13.99 / 16.0, 13.99 / 16, 13.99 / 16.0, voidIcon.getMinU(), voidIcon.getMinV(), voidIcon.getMaxU(), voidIcon.getMaxV()); } RenderUtils.restoreColor(); GlStateManager.enableLighting(); GL11.glEnable(GL11.GL_DEPTH_TEST); GlStateManager.popAttrib(); GlStateManager.popMatrix(); } }
From source file:com.telinc1.rpjg.Game.java
License:Apache License
public void start() { // Start logging. Configurator.defaultConfig().writer(new ConsoleWriter()) .formatPattern("[{date:yyyy-MM-dd HH:mm:ss}] [{level}] [{class_name}] {message}").activate(); Logger.info("Creating and initializing game."); // Create the display. try {/*from w ww .j a v a2 s.co m*/ Display.setTitle(GameOptions.GAME_NAME); Display.setResizable(false); Display.setDisplayMode(new DisplayMode(640, 360)); Display.setVSyncEnabled(true); Display.setFullscreen(false); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(ExitCodes.INIT_DISPLAY); } finally { this.isRunning = true; Logger.info("Finished display creation."); } // Initialize OpenGL. GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glClearColor(0f, 0f, 0f, 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, Display.getWidth(), Display.getHeight()); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); // Load all textures. TextureLoader.initialize(); // Initialize the game. this.initialize(); // Load the default map. this.loadMap("dungeon"); ModuleManager.getInstance().openModule(new ModuleMap()); // Main game loop while (this.isRunning() && !Display.isCloseRequested()) { // Clear the screen from the previous frame. GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); this.loop(); this.draw(); this.collectInput(); // Sync and update the display. Display.update(); Display.sync(GameOptions.FRAME_RATE); } // Free up all resources and exit. Logger.info("Close requested!"); TextureLoader.destroy(); Display.destroy(); Logger.info("Resources destroyed - exiting."); System.exit(ExitCodes.CLOSE_REQUESTED); }
From source file:com.wicpar.sinkingsimulatorclassic.Sea.java
License:Open Source License
@Override public void draw() { GL11.glEnable(GL11.GL_DEPTH_TEST);// www .j a v a 2s . c om GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_POLYGON_SMOOTH); time = Base.getTimePassed(); GL11.glBegin(GL11.GL_QUAD_STRIP); GL11.glColor4f(SeaColor.r, SeaColor.g, SeaColor.b, SeaColor.a); for (int i = 0; i <= divisions; i++) { double pos = ((double) (i) / (divisions)) * 2 - 1; GL11.glVertex3d(pos, -1, -0.07); GL11.glVertex3d(pos, cam.transformY(getHeight(cam.untransformX(pos), time)), -0.07); } GL11.glEnd(); GL11.glEnable(GL11.GL_POLYGON_SMOOTH); GL11.glLineWidth(2); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glColor4f(SeaColor.r, SeaColor.g, SeaColor.b, 1); for (int i = 0; i <= divisions; i++) { double pos = ((double) (i) / (divisions)) * 2 - 1; GL11.glVertex3d(pos, cam.transformY(getHeight(cam.untransformX(pos), time)), -0.07); } GL11.glEnd(); GL11.glLineWidth(1); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glLineWidth(1); }
From source file:com.wicpar.sinkingsimulatorclassic.Ship.java
License:Open Source License
@Override public void draw() { final Camera cam = Main.ClassicSinkingSim.getInstance().getCam(); GL11.glEnable(GL11.GL_DEPTH_TEST);/* w ww. ja v a2 s .co m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPointSize((float) Main.ClassicSinkingSim.getInstance().getCam().scaleSize(0.1)); GL11.glBegin(GL11.GL_POINTS); for (Shipsel[] s : shipsels) { if (s != null) for (Shipsel shipsel : s) { if (shipsel != null) { Color c = shipsel.getColor(); Vector3d pos = shipsel.getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.8); } } } GL11.glEnd(); GL11.glPointSize(1); GL11.glLineWidth((float) Main.ClassicSinkingSim.getInstance().getCam().scaleSize(0.1)); boolean t, b, l, r, e, f; Color c; Vector3d pos; GL11.glBegin(GL11.GL_LINES); for (int y = 0; y < springs[1].length; y++) { for (int x = 0; x < springs[1][y].length; x++) { t = springs[0][y][x]; l = springs[2][y][x]; e = springs[1][y][x]; f = springs[3][y][x]; if (t && (shipsels[y][x] == null || shipsels[y][x + 1] == null)) { springs[0][y][x] = false; } if (l && (shipsels[y][x] == null || shipsels[y + 1][x] == null)) { springs[2][y][x] = false; } if (e && (shipsels[y][x] == null || shipsels[y + 1][x + 1] == null)) { springs[1][y][x] = false; } if (f && (shipsels[y][x + 1] == null || shipsels[y + 1][x] == null)) { springs[3][y][x] = false; } t = springs[0][y][x]; b = springs[0][y + 1][x]; l = springs[2][y][x]; r = springs[2][y][x + 1]; e = springs[1][y][x]; f = springs[3][y][x]; if (t && b && l && r && e && f) continue; if (t && r && e) continue; if (b && l && e) continue; if (t && l && f) continue; if (b && r && f) continue; if (t) { c = shipsels[y][x].getColor(); pos = shipsels[y][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); c = shipsels[y][x + 1].getColor(); pos = shipsels[y][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); } if (l) { c = shipsels[y][x].getColor(); pos = shipsels[y][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); c = shipsels[y + 1][x].getColor(); pos = shipsels[y + 1][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); } if (e) { c = shipsels[y][x].getColor(); pos = shipsels[y][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); c = shipsels[y + 1][x + 1].getColor(); pos = shipsels[y + 1][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); } if (f) { c = shipsels[y][x + 1].getColor(); pos = shipsels[y][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); c = shipsels[y + 1][x].getColor(); pos = shipsels[y + 1][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 0.9); } } } GL11.glEnd(); GL11.glBegin(GL11.GL_TRIANGLES); for (int y = 0; y < springs[1].length; y++) { for (int x = 0; x < springs[1][y].length; x++) { t = springs[0][y][x]; b = springs[0][y + 1][x]; l = springs[2][y][x]; r = springs[2][y][x + 1]; e = springs[1][y][x]; f = springs[3][y][x]; if (t && b && l && r && e && f) { c = shipsels[y][x].getColor(); pos = shipsels[y][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y][x + 1].getColor(); pos = shipsels[y][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x].getColor(); pos = shipsels[y + 1][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y][x + 1].getColor(); pos = shipsels[y][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x].getColor(); pos = shipsels[y + 1][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x + 1].getColor(); pos = shipsels[y + 1][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); } else { if (t && r && e) { c = shipsels[y][x].getColor(); pos = shipsels[y][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y][x + 1].getColor(); pos = shipsels[y][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x + 1].getColor(); pos = shipsels[y + 1][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); } if (b && l && e) { c = shipsels[y][x].getColor(); pos = shipsels[y][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x].getColor(); pos = shipsels[y + 1][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x + 1].getColor(); pos = shipsels[y + 1][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); } if (t && l && f) { c = shipsels[y][x].getColor(); pos = shipsels[y][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y][x + 1].getColor(); pos = shipsels[y][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x].getColor(); pos = shipsels[y + 1][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); } if (b && r && f) { c = shipsels[y + 1][x].getColor(); pos = shipsels[y + 1][x].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y + 1][x + 1].getColor(); pos = shipsels[y + 1][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); c = shipsels[y][x + 1].getColor(); pos = shipsels[y][x + 1].getPos(); GL11.glColor4f(c.r, c.g, c.b, c.a); GL11.glVertex3d(cam.transformX(pos.x), cam.transformY(pos.y), 1); } } } } GL11.glEnd(); GL11.glLineWidth(1); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_DEPTH_TEST); }
From source file:com.xrbpowered.gl.examples.GLGlass.java
License:Open Source License
@Override protected void drawObjects(RenderTarget target) { for (int i = 0; i < NUM_PLANES; i++) planeActors1[i].calcDepth();// w w w. j a v a 2s. c om Arrays.sort(planeActors1, depthSorter); Texture.unbind(3); Texture.unbind(5); for (int i = 0; i < NUM_OBJECTS; i++) objectActors[i].draw(); blurMask.bind(4); glassShader.useBuffer(false); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthMask(false); for (int i = 0; i < NUM_PLANES; i++) planeActors1[i].draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); OffscreenBuffers.blit(target, interBuffers, false); blurBuffers.use(); postProc.draw(interBuffers); target.use(); glassShader.useBuffer(true); interBuffers.bindColorBuffer(3); blurBuffers.bindColorBuffer(5); for (int i = 0; i < NUM_PLANES; i++) { planeActors2[i].draw(); } }
From source file:com.xrbpowered.gl.examples.GLPoints.java
License:Open Source License
@Override protected void setupResources() { super.setupResources(); FeedbackVertexInfo tInfo = (FeedbackVertexInfo) new FeedbackVertexInfo() .setFeedbackNames(new String[] { "out_Position", "out_Size" }).addAttrib("in_Position", 3) .addAttrib("in_Size", 1); VertexInfo rInfo = new VertexInfo().addAttrib("in_Position", 4).addAttrib("in_Size", 1); VertexInfo simpleInfo = new VertexInfo().addAttrib("in_Position", 3).addAttrib("in_Size", 1); pointData = new float[NUM_POINTS * 4]; indexData = new Integer[NUM_POINTS]; Random random = new Random(); int offs = 0; for (int i = 0; i < NUM_POINTS; i++) { pointData[offs++] = random.nextFloat() * 2f * POINTS_RANGE - POINTS_RANGE; pointData[offs++] = random.nextFloat() * 2f * POINTS_RANGE - POINTS_RANGE; pointData[offs++] = random.nextFloat() * 2f * POINTS_RANGE - POINTS_RANGE; pointData[offs++] = 0.1f;/*from w w w .ja v a 2 s. c om*/ } // points = new StaticMesh(info, pointData, GL11.GL_POINTS, NUM_POINTS, true); pointsTShader = new Shader(tInfo, "points_tv.glsl", null) { private int projectionMatrixLocation; private int viewMatrixLocation; private int screenHeightLocation; @Override protected void storeUniformLocations() { projectionMatrixLocation = GL20.glGetUniformLocation(pId, "projectionMatrix"); viewMatrixLocation = GL20.glGetUniformLocation(pId, "viewMatrix"); screenHeightLocation = GL20.glGetUniformLocation(pId, "screenHeight"); } @Override public void updateUniforms() { uniform(projectionMatrixLocation, scene.activeCamera.getProjection()); uniform(viewMatrixLocation, scene.activeCamera.getView()); GL20.glUniform1f(screenHeightLocation, getTargetHeight()); } }; pointsRShader = new Shader(rInfo, "points_pv.glsl", "points_f.glsl") { @Override protected void storeUniformLocations() { } @Override public void updateUniforms() { GL11.glEnable(GL32.GL_PROGRAM_POINT_SIZE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); } @Override public void unuse() { GL11.glDisable(GL11.GL_BLEND); super.unuse(); } }; points = new FeedbackVertices(pointsTShader, pointsRShader, NUM_POINTS, true); points.updateVertexData(pointData); simplePointsShader = new Shader(simpleInfo, "points_v.glsl", "points_f.glsl") { private int projectionMatrixLocation; private int viewMatrixLocation; private int screenHeightLocation; @Override protected void storeUniformLocations() { projectionMatrixLocation = GL20.glGetUniformLocation(pId, "projectionMatrix"); viewMatrixLocation = GL20.glGetUniformLocation(pId, "viewMatrix"); screenHeightLocation = GL20.glGetUniformLocation(pId, "screenHeight"); } @Override public void updateUniforms() { GL11.glEnable(GL32.GL_PROGRAM_POINT_SIZE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); uniform(projectionMatrixLocation, scene.activeCamera.getProjection()); uniform(viewMatrixLocation, scene.activeCamera.getView()); GL20.glUniform1f(screenHeightLocation, getTargetHeight()); } @Override public void unuse() { GL11.glDisable(GL11.GL_BLEND); super.unuse(); } }; simplePoints = new StaticMesh(simpleInfo, pointData, 1, NUM_POINTS, false); Client.checkError(); updateInfo(); }
From source file:com.xrbpowered.gl.ui.UIShader.java
License:Open Source License
@Override public void use() { GL11.glDisable(GL11.GL_DEPTH_TEST);//www .jav a 2 s . co m GL11.glDepthMask(true); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); super.use(); }