-
-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add placeholder PBR textures fixing many issues with many shaderpacks (…
- Loading branch information
1 parent
503952c
commit 306b490
Showing
4 changed files
with
73 additions
and
2 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
43 changes: 43 additions & 0 deletions
43
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,43 @@ | ||
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.IntBuffer; | ||
|
||
public class SingleColorTexture extends GlResource { | ||
public SingleColorTexture(int color) { | ||
super(GL11C.glGenTextures()); | ||
GlStateManager.bindTexture(getGlId()); | ||
|
||
IntBuffer pixel = createBuffer(color); | ||
|
||
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); | ||
} | ||
|
||
private IntBuffer createBuffer(int color) { | ||
IntBuffer pixel = BufferUtils.createIntBuffer(1); | ||
pixel.put(color); | ||
pixel.position(0); | ||
|
||
return pixel; | ||
} | ||
|
||
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