forked from IrisShaders/Iris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit b2ffbe1 Author: coderbot <coderbot16@gmail.com> Date: Tue Mar 23 12:40:08 2021 -0700 Fix the placeholder normal map texture having incorrect content commit 306b490 Author: coderbot <coderbot16@gmail.com> Date: Tue Mar 23 12:05:14 2021 -0700 Add placeholder PBR textures fixing many issues with many shaderpacks (IrisShaders#130) commit 503952c Author: coderbot <coderbot16@gmail.com> Date: Tue Mar 23 10:05:28 2021 -0700 Fix ArrayIndexOutOfBoundsException when parsing buffer clear directives
- Loading branch information
1 parent
b6547d7
commit a80c001
Showing
5 changed files
with
86 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/net/coderbot/iris/rendertarget/SingleColorTexture.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package net.coderbot.iris.rendertarget; | ||
|
||
import com.mojang.blaze3d.platform.GlStateManager; | ||
import net.coderbot.iris.gl.GlResource; | ||
import org.lwjgl.BufferUtils; | ||
import org.lwjgl.opengl.GL11C; | ||
import org.lwjgl.opengl.GL13C; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
public class SingleColorTexture extends GlResource { | ||
public SingleColorTexture(int red, int green, int blue, int alpha) { | ||
super(GL11C.glGenTextures()); | ||
GlStateManager.bindTexture(getGlId()); | ||
|
||
ByteBuffer pixel = BufferUtils.createByteBuffer(4); | ||
pixel.put((byte) red); | ||
pixel.put((byte) green); | ||
pixel.put((byte) blue); | ||
pixel.put((byte) alpha); | ||
pixel.position(0); | ||
|
||
GL11C.glTexParameteri(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_MIN_FILTER, GL11C.GL_LINEAR); | ||
GL11C.glTexParameteri(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_MAG_FILTER, GL11C.GL_LINEAR); | ||
GL11C.glTexParameteri(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_WRAP_S, GL13C.GL_REPEAT); | ||
GL11C.glTexParameteri(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_WRAP_T, GL13C.GL_REPEAT); | ||
GL11C.glTexImage2D(GL11C.GL_TEXTURE_2D, 0, GL11C.GL_RGBA, 1, 1, 0, GL11C.GL_RGBA, GL11C.GL_UNSIGNED_BYTE, pixel); | ||
|
||
GlStateManager.bindTexture(0); | ||
} | ||
|
||
public int getTextureId() { | ||
return getGlId(); | ||
} | ||
|
||
@Override | ||
protected void destroyInternal() { | ||
GL11C.glDeleteTextures(getGlId()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters