mirror of https://github.com/rusefi/jzy3d-api.git
more parameters to configure texture
This commit is contained in:
parent
c38f0edeb8
commit
1b5f16739b
|
@ -66,19 +66,15 @@ public class Point extends AbstractDrawable implements ISingleColorable {
|
|||
|
||||
if (gl.isGL2()) {
|
||||
gl.getGL2().glPointSize(width);
|
||||
|
||||
gl.getGL2().glBegin(GL.GL_POINTS);
|
||||
gl.getGL2().glColor4f(rgb.r, rgb.g, rgb.b, rgb.a);
|
||||
colorGL2(gl, rgb);
|
||||
vertexGL2(gl, xyz);
|
||||
//gl.getGL2().glVertex3f(xyz.x, xyz.y, xyz.z);
|
||||
gl.getGL2().glEnd();
|
||||
} else {
|
||||
GLES2CompatUtils.glPointSize(width);
|
||||
|
||||
GLES2CompatUtils.glBegin(GL.GL_POINTS);
|
||||
GLES2CompatUtils.glColor4f(rgb.r, rgb.g, rgb.b, rgb.a);
|
||||
colorGLES2(rgb);
|
||||
vertexGLES2(xyz);
|
||||
//GLES2CompatUtils.glVertex3f(xyz.x, xyz.y, xyz.z);
|
||||
GLES2CompatUtils.glEnd();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,10 @@ import org.jzy3d.plot3d.primitives.textured.DrawableTexture;
|
|||
import org.jzy3d.plot3d.primitives.textured.TexturedCube;
|
||||
import org.jzy3d.plot3d.rendering.textures.BufferedImageTexture;
|
||||
|
||||
import com.jogamp.opengl.GL;
|
||||
import com.jogamp.opengl.GLProfile;
|
||||
import com.jogamp.opengl.util.texture.awt.AWTTextureIO;
|
||||
|
||||
/**
|
||||
* Create {@link DrawableTexture} symbols based on an {@link java.awt.Shape}
|
||||
*
|
||||
|
|
|
@ -54,16 +54,16 @@ public class SharedTexture implements IGLBindedResource{
|
|||
}
|
||||
|
||||
protected void load(GL gl, String fileName) throws GLException, IOException {
|
||||
texture = TextureIO.newTexture(new File(fileName), false);
|
||||
texture.setTexParameteri(gl, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
|
||||
texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
|
||||
texture = TextureIO.newTexture(new File(fileName), useMipMap);
|
||||
texture.setTexParameteri(gl, GL.GL_TEXTURE_MAG_FILTER, textureMagnificationFilter);
|
||||
texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, textureMinificationFilter);
|
||||
}
|
||||
|
||||
protected void load(GL gl, BufferedImage image){
|
||||
|
||||
texture = AWTTextureIO.newTexture(GLProfile.getDefault(), image, false);
|
||||
texture.setTexParameteri(gl, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
|
||||
texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
|
||||
texture = AWTTextureIO.newTexture(GLProfile.getDefault(), image, useMipMap);
|
||||
texture.setTexParameteri(gl, GL.GL_TEXTURE_MAG_FILTER, textureMagnificationFilter);
|
||||
texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, textureMinificationFilter);
|
||||
}
|
||||
|
||||
public String getFile() {
|
||||
|
@ -81,16 +81,52 @@ public class SharedTexture implements IGLBindedResource{
|
|||
public float getHalfHeight() {
|
||||
return halfHeight;
|
||||
}
|
||||
|
||||
public boolean isUseMipMap() {
|
||||
return useMipMap;
|
||||
}
|
||||
|
||||
/*
|
||||
* public BoundingBox3d getBounds(PlaneAxis plane){
|
||||
/**
|
||||
* Will apply if set before actually loading the texture.
|
||||
*
|
||||
* }
|
||||
* @param useMipMap
|
||||
*/
|
||||
public void setUseMipMap(boolean useMipMap) {
|
||||
this.useMipMap = useMipMap;
|
||||
}
|
||||
|
||||
public int getTextureMagnificationFilter() {
|
||||
return textureMagnificationFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will apply if set before actually loading the texture.
|
||||
*
|
||||
* @param textureMagnificationFilter
|
||||
*/
|
||||
public void setTextureMagnificationFilter(int textureMagnificationFilter) {
|
||||
this.textureMagnificationFilter = textureMagnificationFilter;
|
||||
}
|
||||
|
||||
public int getTextureMinificationFilter() {
|
||||
return textureMinificationFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will apply if set before actually loading the texture.
|
||||
*
|
||||
* @param textureMinificationFilter
|
||||
*/
|
||||
public void setTextureMinificationFilter(int textureMinificationFilter) {
|
||||
this.textureMinificationFilter = textureMinificationFilter;
|
||||
}
|
||||
|
||||
protected Texture texture;
|
||||
protected String file;
|
||||
protected TextureCoords coords;
|
||||
protected float halfWidth;
|
||||
protected float halfHeight;
|
||||
protected boolean useMipMap = false;
|
||||
protected int textureMagnificationFilter = GL.GL_NEAREST;
|
||||
protected int textureMinificationFilter = GL.GL_NEAREST;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ public class BufferedImageTexture extends SharedTexture {
|
|||
public BufferedImageTexture(BufferedImage image) {
|
||||
super();
|
||||
this.image = image;
|
||||
this.textureMagnificationFilter = GL.GL_LINEAR;
|
||||
this.textureMinificationFilter = GL.GL_LINEAR;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,9 +42,9 @@ public class BufferedImageTexture extends SharedTexture {
|
|||
}
|
||||
|
||||
protected void load(GL gl, BufferedImage image) {
|
||||
texture = AWTTextureIO.newTexture(GLProfile.getDefault(), image, false);
|
||||
texture.setTexParameteri(gl, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); // different from shared texture!
|
||||
texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
|
||||
texture = AWTTextureIO.newTexture(GLProfile.getDefault(), image, useMipMap);
|
||||
texture.setTexParameteri(gl, GL.GL_TEXTURE_MAG_FILTER, textureMagnificationFilter);
|
||||
texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, textureMinificationFilter);
|
||||
}
|
||||
|
||||
/** returns null*/
|
||||
|
|
Loading…
Reference in New Issue