Java Code Examples for org.lwjgl.opengl.GL11#glNewList()

The following examples show how to use org.lwjgl.opengl.GL11#glNewList() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ItemEspHack.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onEnable()
{
	EVENTS.add(UpdateListener.class, this);
	EVENTS.add(CameraTransformViewBobbingListener.class, this);
	EVENTS.add(RenderListener.class, this);
	
	itemBox = GL11.glGenLists(1);
	GL11.glNewList(itemBox, GL11.GL_COMPILE);
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);
	GL11.glColor4f(1, 1, 0, 0.5F);
	RenderUtils.drawOutlinedBox(new Box(-0.5, 0, -0.5, 0.5, 1, 0.5));
	GL11.glEndList();
}
 
Example 2
Source File: TunnellerHack.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void updateCyanList()
{
	GL11.glNewList(displayLists[0], GL11.GL_COMPILE);
	
	GL11.glPushMatrix();
	GL11.glTranslated(start.getX(), start.getY(), start.getZ());
	GL11.glTranslated(0.5, 0.5, 0.5);
	
	GL11.glColor4f(0, 1, 1, 0.5F);
	GL11.glBegin(GL11.GL_LINES);
	RenderUtils.drawNode(new Box(-0.25, -0.25, -0.25, 0.25, 0.25, 0.25));
	GL11.glEnd();
	
	RenderUtils.drawArrow(Vec3d.of(direction.getVector()).multiply(0.25),
		Vec3d.of(direction.getVector()).multiply(Math.max(0.5, length)));
	
	GL11.glPopMatrix();
	GL11.glEndList();
}
 
Example 3
Source File: SearchHack.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void setDisplayListFromTask()
{
	ArrayList<int[]> vertices;
	
	try
	{
		vertices = compileVerticesTask.get();
		
	}catch(InterruptedException | ExecutionException e)
	{
		throw new RuntimeException(e);
	}
	
	GL11.glNewList(displayList, GL11.GL_COMPILE);
	for(int[] vertex : vertices)
		GL11.glVertex3d(vertex[0], vertex[1], vertex[2]);
	GL11.glEndList();
	
	displayListUpToDate = true;
}
 
Example 4
Source File: AutoFishHack.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onEnable()
{
	timer = 0;
	lastSoundPos = null;
	
	box = GL11.glGenLists(1);
	
	cross = GL11.glGenLists(1);
	GL11.glNewList(cross, GL11.GL_COMPILE);
	GL11.glColor4f(1, 0, 0, 0.5F);
	GL11.glBegin(GL11.GL_LINES);
	GL11.glVertex3d(-0.125, 0, -0.125);
	GL11.glVertex3d(0.125, 0, 0.125);
	GL11.glVertex3d(0.125, 0, -0.125);
	GL11.glVertex3d(-0.125, 0, 0.125);
	GL11.glEnd();
	GL11.glEndList();
	
	MinecraftForge.EVENT_BUS.register(this);
}
 
Example 5
Source File: ManualDisplayList.java    From OpenModsLib with MIT License 5 votes vote down vote up
public void compile(Renderer renderer) {
	if (isAllocated) GL11.glDeleteLists(displayList, 1);

	displayList = GL11.glGenLists(1);
	GL11.glNewList(displayList, GL11.GL_COMPILE);
	renderer.render();
	GL11.glEndList();

	isAllocated = isValid = true;
}
 
Example 6
Source File: PlayerEspHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onEnable()
{
	MinecraftForge.EVENT_BUS.register(this);
	
	playerBox = GL11.glGenLists(1);
	GL11.glNewList(playerBox, GL11.GL_COMPILE);
	GL11.glBegin(GL11.GL_LINES);
	AxisAlignedBB bb = new AxisAlignedBB(-0.5, 0, -0.5, 0.5, 1, 0.5);
	RenderUtils.drawOutlinedBox(bb);
	GL11.glEnd();
	GL11.glEndList();
}
 
Example 7
Source File: TunnellerHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean canRun()
{
	if(!torches.isChecked())
	{
		lastTorch = null;
		nextTorch = new BlockPos(WMinecraft.getPlayer());
		GL11.glNewList(displayLists[4], GL11.GL_COMPILE);
		GL11.glEndList();
		return false;
	}
	
	if(lastTorch != null)
		nextTorch = lastTorch.offset(direction,
			size.getSelected().torchDistance);
	
	GL11.glNewList(displayLists[4], GL11.GL_COMPILE);
	GL11.glColor4f(1, 1, 0, 0.5F);
	Vec3d torchVec = new Vec3d(nextTorch).addVector(0.5, 0, 0.5);
	RenderUtils.drawArrow(torchVec, torchVec.addVector(0, 0.5, 0));
	GL11.glEndList();
	
	BlockPos base = start.offset(direction, length);
	if(getDistance(start, base) <= getDistance(start, nextTorch))
		return false;
	
	return Blocks.TORCH.canPlaceBlockAt(WMinecraft.getWorld(),
		nextTorch);
}
 
Example 8
Source File: CachedRendererFactory.java    From OpenModsLib with MIT License 5 votes vote down vote up
public DisplayListRenderer(Tessellator tes) {
	displayList = GL11.glGenLists(1);
	if (isDisplayListValid()) {
		GL11.glNewList(displayList, GL11.GL_COMPILE);
		tes.draw();
		GL11.glEndList();
	}
}
 
Example 9
Source File: RendererLathe.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
public RendererLathe() {
	try {
		model = new WavefrontObject(new ResourceLocation("advancedrocketry:models/lathe.obj"));
	} catch (ModelFormatException e) {
		e.printStackTrace();
	}

	GL11.glNewList(bodyList = GL11.glGenLists(1), GL11.GL_COMPILE);
	model.renderOnly("body");
	GL11.glEndList();
}
 
Example 10
Source File: ChestEspHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
private void setupDisplayLists()
{
	Box box = new Box(BlockPos.ORIGIN);
	
	greenBox = GL11.glGenLists(1);
	GL11.glNewList(greenBox, GL11.GL_COMPILE);
	GL11.glColor4f(0, 1, 0, 0.25F);
	RenderUtils.drawSolidBox(box);
	GL11.glColor4f(0, 1, 0, 0.5F);
	RenderUtils.drawOutlinedBox(box);
	GL11.glEndList();
	
	orangeBox = GL11.glGenLists(1);
	GL11.glNewList(orangeBox, GL11.GL_COMPILE);
	GL11.glColor4f(1, 0.5F, 0, 0.25F);
	RenderUtils.drawSolidBox(box);
	GL11.glColor4f(1, 0.5F, 0, 0.5F);
	RenderUtils.drawOutlinedBox(box);
	GL11.glEndList();
	
	cyanBox = GL11.glGenLists(1);
	GL11.glNewList(cyanBox, GL11.GL_COMPILE);
	GL11.glColor4f(0, 1, 1, 0.25F);
	RenderUtils.drawSolidBox(box);
	GL11.glColor4f(0, 1, 1, 0.5F);
	RenderUtils.drawOutlinedBox(box);
	GL11.glEndList();
	
	purpleBox = GL11.glGenLists(1);
	GL11.glNewList(purpleBox, GL11.GL_COMPILE);
	GL11.glColor4f(1, 0, 1, 0.25F);
	RenderUtils.drawSolidBox(box);
	GL11.glColor4f(1, 0, 1, 0.5F);
	RenderUtils.drawOutlinedBox(box);
	GL11.glEndList();
	
	normalChests = GL11.glGenLists(1);
}
 
Example 11
Source File: MobSpawnEspHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
private void compileDisplayList()
{
	GL11.glNewList(displayList, GL11.GL_COMPILE);
	
	GL11.glColor4f(1, 0, 0, 0.5F);
	GL11.glBegin(GL11.GL_LINES);
	new ArrayList<>(red).forEach(pos -> {
		GL11.glVertex3d(pos.getX(), pos.getY() + 0.01, pos.getZ());
		GL11.glVertex3d(pos.getX() + 1, pos.getY() + 0.01,
			pos.getZ() + 1);
		GL11.glVertex3d(pos.getX() + 1, pos.getY() + 0.01, pos.getZ());
		GL11.glVertex3d(pos.getX(), pos.getY() + 0.01, pos.getZ() + 1);
	});
	
	GL11.glColor4f(1, 1, 0, 0.5F);
	new ArrayList<>(yellow).forEach(pos -> {
		GL11.glVertex3d(pos.getX(), pos.getY() + 0.01, pos.getZ());
		GL11.glVertex3d(pos.getX() + 1, pos.getY() + 0.01,
			pos.getZ() + 1);
		GL11.glVertex3d(pos.getX() + 1, pos.getY() + 0.01, pos.getZ());
		GL11.glVertex3d(pos.getX(), pos.getY() + 0.01, pos.getZ() + 1);
	});
	GL11.glEnd();
	
	GL11.glEndList();
	doneCompiling = true;
}
 
Example 12
Source File: MobEspHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onEnable()
{
	EVENTS.add(UpdateListener.class, this);
	EVENTS.add(CameraTransformViewBobbingListener.class, this);
	EVENTS.add(RenderListener.class, this);
	
	mobBox = GL11.glGenLists(1);
	GL11.glNewList(mobBox, GL11.GL_COMPILE);
	Box bb = new Box(-0.5, 0, -0.5, 0.5, 1, 0.5);
	RenderUtils.drawOutlinedBox(bb);
	GL11.glEndList();
}
 
Example 13
Source File: DisplayListWrapper.java    From OpenModsLib with MIT License 5 votes vote down vote up
public void render() {
	if (pendingInvalidate) reset();

	if (!isValid) {
		displayList = GL11.glGenLists(1);
		GL11.glNewList(displayList, GL11.GL_COMPILE);
		compile();
		GL11.glEndList();
		isValid = true;
	}

	GL11.glCallList(displayList);
}
 
Example 14
Source File: TunnellerHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean canRun()
{
	if(!torches.isChecked())
	{
		lastTorch = null;
		nextTorch = new BlockPos(MC.player.getPos());
		GL11.glNewList(displayLists[4], GL11.GL_COMPILE);
		GL11.glEndList();
		return false;
	}
	
	if(lastTorch != null)
		nextTorch = lastTorch.offset(direction,
			size.getSelected().torchDistance);
	
	GL11.glNewList(displayLists[4], GL11.GL_COMPILE);
	GL11.glColor4f(1, 1, 0, 0.5F);
	Vec3d torchVec = Vec3d.ofBottomCenter(nextTorch);
	RenderUtils.drawArrow(torchVec, torchVec.add(0, 0.5, 0));
	GL11.glEndList();
	
	BlockPos base = start.offset(direction, length);
	if(getDistance(start, base) <= getDistance(start, nextTorch))
		return false;
	
	return Blocks.TORCH.canPlaceAt(BlockUtils.getState(nextTorch),
		MC.world, nextTorch);
}
 
Example 15
Source File: FreecamHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onEnable()
{
	EVENTS.add(UpdateListener.class, this);
	EVENTS.add(PacketOutputListener.class, this);
	EVENTS.add(IsPlayerInWaterListener.class, this);
	EVENTS.add(PlayerMoveListener.class, this);
	EVENTS.add(CameraTransformViewBobbingListener.class, this);
	EVENTS.add(IsNormalCubeListener.class, this);
	EVENTS.add(SetOpaqueCubeListener.class, this);
	EVENTS.add(RenderListener.class, this);
	
	fakePlayer = new FakePlayerEntity();
	
	GameOptions gs = MC.options;
	KeyBinding[] bindings = {gs.keyForward, gs.keyBack, gs.keyLeft,
		gs.keyRight, gs.keyJump, gs.keySneak};
	
	for(KeyBinding binding : bindings)
		binding.setPressed(((IKeyBinding)binding).isActallyPressed());
	
	playerBox = GL11.glGenLists(1);
	GL11.glNewList(playerBox, GL11.GL_COMPILE);
	Box bb = new Box(-0.5, 0, -0.5, 0.5, 1, 0.5);
	RenderUtils.drawOutlinedBox(bb);
	GL11.glEndList();
}
 
Example 16
Source File: ChestEspHack.java    From ForgeWurst with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onEnable()
{
	MinecraftForge.EVENT_BUS.register(this);
	AxisAlignedBB bb = new AxisAlignedBB(BlockPos.ORIGIN);
	
	greenBox = GL11.glGenLists(1);
	GL11.glNewList(greenBox, GL11.GL_COMPILE);
	GL11.glColor4f(0, 1, 0, 0.25F);
	GL11.glBegin(GL11.GL_QUADS);
	RenderUtils.drawSolidBox(bb);
	GL11.glEnd();
	GL11.glColor4f(0, 1, 0, 0.5F);
	GL11.glBegin(GL11.GL_LINES);
	RenderUtils.drawOutlinedBox(bb);
	GL11.glEnd();
	GL11.glEndList();
	
	orangeBox = GL11.glGenLists(1);
	GL11.glNewList(orangeBox, GL11.GL_COMPILE);
	GL11.glColor4f(1, 0.5F, 0, 0.25F);
	GL11.glBegin(GL11.GL_QUADS);
	RenderUtils.drawSolidBox(bb);
	GL11.glEnd();
	GL11.glColor4f(1, 0.5F, 0, 0.5F);
	GL11.glBegin(GL11.GL_LINES);
	RenderUtils.drawOutlinedBox(bb);
	GL11.glEnd();
	GL11.glEndList();
	
	cyanBox = GL11.glGenLists(1);
	GL11.glNewList(cyanBox, GL11.GL_COMPILE);
	GL11.glColor4f(0, 1, 1, 0.25F);
	GL11.glBegin(GL11.GL_QUADS);
	RenderUtils.drawSolidBox(bb);
	GL11.glEnd();
	GL11.glColor4f(0, 1, 1, 0.5F);
	GL11.glBegin(GL11.GL_LINES);
	RenderUtils.drawOutlinedBox(bb);
	GL11.glEnd();
	GL11.glEndList();
	
	normalChests = GL11.glGenLists(1);
}
 
Example 17
Source File: RotorSpecialRenderer.java    From BigReactors with MIT License 4 votes vote down vote up
int generateRotor(RotorInfo rotorInfo) {
	int list = GLAllocation.generateDisplayLists(1);
	GL11.glNewList(list,  GL11.GL_COMPILE);

	ForgeDirection rotorDir = rotorInfo.rotorDirection;
	int rotorLen = rotorInfo.rotorLength;
	CoordTriplet currentRotorCoord = new CoordTriplet(0,0,0);

	Tessellator tessellator = Tessellator.instance;
	if(rotorDir.offsetX != 0) {
		tessellator.setTranslation(0, -0.5, -0.5);
	}
	else if(rotorDir.offsetY != 0) {
		tessellator.setTranslation(-0.5, 0, -0.5);
	}
	else {
		tessellator.setTranslation(-0.5, -0.5, 0);
	}

	tessellator.startDrawingQuads();
	tessellator.setBrightness(256);
	tessellator.setColorOpaque(255, 255, 255);
	
	CoordTriplet bladeCoord = new CoordTriplet(0,0,0);
	int rotorIdx = 0;
	boolean[] hasBlades = new boolean[4];
	ForgeDirection[] bladeDirs = StaticUtils.neighborsBySide[rotorInfo.rotorDirection.ordinal()];

	while(rotorIdx < rotorInfo.rotorLength) {
		
		for(int i = 0; i < hasBlades.length; i++) {
			hasBlades[i] = rotorInfo.bladeLengths[rotorIdx][i] > 0;
		}

		RotorSimpleRenderer.renderRotorShaft(BigReactors.blockTurbineRotorPart, renderBlocks, BlockTurbineRotorPart.METADATA_SHAFT, rotorDir, hasBlades, currentRotorCoord.x, currentRotorCoord.y, currentRotorCoord.z, false);
		for(int bladeIdx = 0; bladeIdx < bladeDirs.length; bladeIdx++) {
			bladeCoord.copy(currentRotorCoord);
			int bladeLen = 0;
			bladeCoord.translate(bladeDirs[bladeIdx]);
			while(bladeLen < rotorInfo.bladeLengths[rotorIdx][bladeIdx]) {
				RotorSimpleRenderer.renderBlade(renderBlocks, bladeCoord.x, bladeCoord.y, bladeCoord.z, BigReactors.blockTurbineRotorPart, BlockTurbineRotorPart.METADATA_BLADE, rotorInfo.rotorDirection);
				bladeLen++;
				bladeCoord.translate(bladeDirs[bladeIdx]);
			}
		}
		rotorIdx++;
		currentRotorCoord.translate(rotorDir);
	}
	tessellator.setTranslation(0, 0, 0);
	tessellator.draw();
	
	GL11.glEndList();
	return list;
}
 
Example 18
Source File: RenderPlanetarySky.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
public RenderPlanetarySky() {
	axis = new Vector3F<Float>(1f, 0f, 0f);

	this.starGLCallList = GLAllocation.generateDisplayLists(3);
	GL11.glPushMatrix();
	GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE);
	this.renderStars();
	GL11.glEndList();
	GL11.glPopMatrix();
	BufferBuilder buffer = Tessellator.getInstance().getBuffer();
	this.glSkyList = this.starGLCallList + 1;
	GL11.glNewList(this.glSkyList, GL11.GL_COMPILE);
	byte b2 = 64;
	int i = 256 / b2 + 2;
	float f = 16.0F;
	int j;
	int k;

	for (j = -b2 * i; j <= b2 * i; j += b2)
	{
		for (k = -b2 * i; k <= b2 * i; k += b2)
		{
			buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
			buffer.pos((double)(j + 0), (double)f, (double)(k + 0)).endVertex();
			buffer.pos((double)(j + b2), (double)f, (double)(k + 0)).endVertex();
			buffer.pos((double)(j + b2), (double)f, (double)(k + b2)).endVertex();
			buffer.pos((double)(j + 0), (double)f, (double)(k + b2)).endVertex();
			Tessellator.getInstance().draw();
		}
	}

	GL11.glEndList();
	this.glSkyList2 = this.starGLCallList + 2;
	GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE);
	f = -16.0F;
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);

	for (j = -b2 * i; j <= b2 * i; j += b2)
	{
		for (k = -b2 * i; k <= b2 * i; k += b2)
		{
			buffer.pos((double)(j + 0), (double)f, (double)(k + 0)).endVertex();
			buffer.pos((double)(j + b2), (double)f, (double)(k + 0)).endVertex();
			buffer.pos((double)(j + b2), (double)f, (double)(k + b2)).endVertex();
			buffer.pos((double)(j + 0), (double)f, (double)(k + b2)).endVertex();
		}
	}

	Tessellator.getInstance().draw();
	GL11.glEndList();
}
 
Example 19
Source File: LwJglRenderingEngine.java    From Gaalop with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void run() {
    startEngine();
    //long start = System.currentTimeMillis();
    while (!Display.isCloseRequested()) {
        //System.out.println(System.currentTimeMillis()-start);
        //start = System.currentTimeMillis();
        
        if (rendering.isNewDataSetAvailable()) {
            if (list != -1) GL11.glDeleteLists(list, 1);
            list = GL11.glGenLists(1);
            GL11.glNewList(list, GL11.GL_COMPILE);
            draw(rendering.getDataSet(), rendering.getVisibleObjects(), rendering.getLoadedPointClouds());
            GL11.glEndList();
            changed = true;
        }
        
        
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // clear the screen
        GL11.glLoadIdentity(); // apply camPos before rotation

        GL11.glTranslatef(0.0f, 0.0f, -5.0f);
        // draw
        GLU.gluLookAt(camPos.x, camPos.y, camPos.z, // Position
                camPos.x + camDir.x, camPos.y + camDir.y, camPos.z + camDir.z, // Lookat
                camUp.x, camUp.y, camUp.z);               // Up-direction
        // apply rotation
        GL11.glRotatef(camAngleX, 0, 1, 0); // window x axis rotates around up vector
        GL11.glRotatef(camAngleY, 1, 0, 0); // window y axis rotates around x

        //Render the scene
        if (list != -1) GL11.glCallList(list);

        pollInput();
        Display.update();
        if (recorder != null) {
            if (changed || firstFrame) {
                recorder.makeScreenshot();
                changed = false;
            }
            firstFrame = false;
            Display.sync(25); // cap fps to 60fps
        }
        else 
            Display.sync(60); 
    }

    Display.destroy();
}
 
Example 20
Source File: Model.java    From pycode-minecraft with MIT License 4 votes vote down vote up
public void genList() {
        this.glList = GL11.glGenLists(1);
        GL11.glNewList(this.glList, GL11.GL_COMPILE);
//        if use_texture: glEnable(GL_TEXTURE_2D)
        GL11.glFrontFace(GL11.GL_CCW);
        GL11.glEnable(GL11.GL_CULL_FACE);

        GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
        GL11.glDepthFunc(GL11.GL_LESS);
        GL11.glCullFace(GL11.GL_BACK);
        String currentMaterial = "";
        Material mtl;
        for (Face face : this.faces) {
            if (!face.material.equals(currentMaterial)) {
                currentMaterial = face.material;
                mtl = this.materials.get(face.material);
                if (mtl == null) {
                    GL11.glColor3f(1, 1, 1);
                } else {
//                    if 'texture_Kd' in mtl:
//                    # use diffuse texmap
//                    glBindTexture(GL_TEXTURE_2D, mtl['texture_Kd'])
                    GL11.glColor3f(mtl.diffuse.x, mtl.diffuse.y, mtl.diffuse.z);
                }
            }

            GL11.glBegin(GL11.GL_POLYGON);
            for (int i = 0; i < face.vertexes.size(); i++) {
                if (face.normals.get(i) != 0) {
                    Vector3f n = this.normals.get(face.normals.get(i));
                    GL11.glNormal3f(n.x, n.y, n.z);
                }
//                if texture_coords[i]:
//                    glTexCoord2fv(self.texcoords[texture_coords[i] - 1])
                Vector3f v = this.vertices.get(face.vertexes.get(i));
                GL11.glVertex3f(v.x, v.y, v.z);
            }
            GL11.glEnd();
        }

        GL11.glCullFace(GL11.GL_BACK);
        GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);

        GL11.glDisable(GL11.GL_CULL_FACE);

//      if use_texture: glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEndList();
    }