本文整理汇总了Java中processing.opengl.PGL类的典型用法代码示例。如果您正苦于以下问题:Java PGL类的具体用法?Java PGL怎么用?Java PGL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PGL类属于processing.opengl包,在下文中一共展示了PGL类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayScene
import processing.opengl.PGL; //导入依赖的package包/类
public void displayScene(PGraphicsOpenGL canvas){
if(canvas == skylight.renderer.pg_render){
canvas.background(BACKGROUND);
displaySamples(canvas);
}
if(canvas == geombuffer.pg_geom){
canvas.pgl.clearDepth(1.0f);
canvas.pgl.clearColor(1, 1, 1, clip_z_far);
canvas.pgl.clear(PGL.COLOR_BUFFER_BIT | PGL.DEPTH_BUFFER_BIT);
}
canvas.pushMatrix();
canvas.applyMatrix(mat_scene_view);
canvas.shape(shp_group);
canvas.popMatrix();
}
示例2: displayScene
import processing.opengl.PGL; //导入依赖的package包/类
public void displayScene(PGraphics3D pg){
if(pg == skylight.renderer.pg_render){
pg.background(16);
}
if(pg == geombuffer.pg_geom){
pg.background(255, 255);
pg.pgl.clearColor(1, 1, 1, 6000);
pg.pgl.clear(PGL.COLOR_BUFFER_BIT);
}
pg.pushMatrix();
pg.applyMatrix(mat_scene_view);
pg.shape(group_bulletbodies);
pg.popMatrix();
}
示例3: displayScene
import processing.opengl.PGL; //导入依赖的package包/类
public void displayScene(PGraphics3D pg){
if(pg == skylight.renderer.pg_render){
pg.background(180);
}
if(pg == geombuffer.pg_geom){
pg.background(255, 255);
pg.pgl.clearColor(1, 1, 1, 6000);
pg.pgl.clear(PGL.COLOR_BUFFER_BIT);
}
pg.pushMatrix();
pg.applyMatrix(mat_scene_view);
pg.shape(group_bulletbodies);
pg.popMatrix();
}
示例4: displayScene
import processing.opengl.PGL; //导入依赖的package包/类
public void displayScene(PGraphics3D pg){
if(pg == skylight.renderer.pg_render){
pg.background(16);
}
if(pg == geombuffer.pg_geom){
pg.background(255, 255);
pg.pgl.clearColor(1, 1, 1, 6000);
pg.pgl.clear(PGL.COLOR_BUFFER_BIT);
}
pg.pushMatrix();
pg.applyMatrix(mat_scene_view);
pg.shape(group_bulletbodies);
pg.shape(group_collisions);
pg.popMatrix();
}
示例5: changeTextureFormat
import processing.opengl.PGL; //导入依赖的package包/类
static public void changeTextureFormat(PGraphicsOpenGL pg, int internal_format, int format, int type, int filter, int wrap){
Texture tex = pg.getTexture();
if(!tex.available()){
System.out.println("ERROR DwGLTextureUtils.changeTextureFormat: PGraphicsOpenGL texture not available.");
return;
}
PGL pgl = pg.beginPGL();
pgl.bindTexture (tex.glTarget, tex.glName);
pgl.texParameteri(tex.glTarget, GL2ES2.GL_TEXTURE_MIN_FILTER, filter); // GL_NEAREST, GL_LINEAR
pgl.texParameteri(tex.glTarget, GL2ES2.GL_TEXTURE_MAG_FILTER, filter);
pgl.texParameteri(tex.glTarget, GL2ES2.GL_TEXTURE_WRAP_S, wrap);
pgl.texParameteri(tex.glTarget, GL2ES2.GL_TEXTURE_WRAP_T, wrap);
pgl.texImage2D (tex.glTarget, 0, internal_format, tex.glWidth, tex.glHeight, 0, format, type, null);
pgl.bindTexture (tex.glTarget, 0);
pg.endPGL();
pg.beginDraw();
pg.clear();
pg.endDraw();
}
示例6: displayScene
import processing.opengl.PGL; //导入依赖的package包/类
public void displayScene(PGraphics3D canvas){
// lights
canvas.directionalLight(255, 255, 255, 200,600,400);
canvas.directionalLight(255, 255, 255, -200,-600,-400);
canvas.ambientLight(64, 64, 64);
if(canvas == geombuffer.pg_geom){
canvas.background(255, 255);
canvas.pgl.clearColor(1, 1, 1, 6000);
canvas.pgl.clear(PGL.COLOR_BUFFER_BIT);
}
sceneShape(canvas);
}
示例7: changeTextureWrap
import processing.opengl.PGL; //导入依赖的package包/类
static public void changeTextureWrap(PGraphicsOpenGL pg, int wrap){
Texture tex = pg.getTexture();
if(!tex.available()){
System.out.println("ERROR DwGLTextureUtils.changeTextureWrap: PGraphicsOpenGL texture not available.");
return;
}
PGL pgl = pg.beginPGL();
pgl.bindTexture (tex.glTarget, tex.glName);
pgl.texParameteri(tex.glTarget, GL2ES2.GL_TEXTURE_WRAP_S, wrap);
pgl.texParameteri(tex.glTarget, GL2ES2.GL_TEXTURE_WRAP_T, wrap);
pgl.bindTexture (tex.glTarget, 0);
pg.endPGL();
}
示例8: changeTextureFilter
import processing.opengl.PGL; //导入依赖的package包/类
static public void changeTextureFilter(PGraphicsOpenGL pg, int min_filter, int mag_filter){
Texture tex = pg.getTexture();
if(!tex.available()){
System.out.println("ERROR DwGLTextureUtils.changeTextureFilter: PGraphicsOpenGL texture not available.");
return;
}
PGL pgl = pg.beginPGL();
pgl.bindTexture (tex.glTarget, tex.glName);
pgl.texParameteri(tex.glTarget, GL2ES2.GL_TEXTURE_MIN_FILTER, min_filter);
pgl.texParameteri(tex.glTarget, GL2ES2.GL_TEXTURE_MAG_FILTER, mag_filter);
pgl.bindTexture (tex.glTarget, 0);
pg.endPGL();
}
示例9: changeTextureParam
import processing.opengl.PGL; //导入依赖的package包/类
/**
* When chaning multiple parameters, its better to use this source-code directly.
*
* @param pg
* @param pname
* @param param
*/
static public void changeTextureParam(PGraphicsOpenGL pg, int pname, int param){
Texture tex = pg.getTexture();
if(!tex.available()){
System.out.println("ERROR DwGLTextureUtils.changeTextureParam: PGraphicsOpenGL texture not available.");
return;
}
PGL pgl = pg.beginPGL();
pgl.bindTexture (tex.glTarget, tex.glName);
pgl.texParameteri(tex.glTarget, pname, param);
pgl.bindTexture (tex.glTarget, 0);
pg.endPGL();
}
示例10: generateMipMaps
import processing.opengl.PGL; //导入依赖的package包/类
static public void generateMipMaps(PGraphicsOpenGL pg){
Texture tex = pg.getTexture();
if(!tex.available()){
System.out.println("ERROR DwGLTextureUtils.generateMipMaps: PGraphicsOpenGL texture not available.");
return;
}
PGL pgl = pg.beginPGL();
pgl.bindTexture (tex.glTarget, tex.glName);
pgl.texParameteri (tex.glTarget, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR);
// pgl.texParameteri (tex.glTarget, GL2.GL_GENERATE_MIPMAP, GL.GL_TRUE);
pgl.generateMipmap(tex.glTarget);
pgl.bindTexture (tex.glTarget, 0);
pg.endPGL();
}
示例11: update
import processing.opengl.PGL; //导入依赖的package包/类
public void update(){
pg_shadowmap.beginDraw();
// saves quite some time compared to background(0xFFFFFFFF);
pg_shadowmap.pgl.clearColor(1, 1, 1, 1);
pg_shadowmap.pgl.clearDepth(1);
pg_shadowmap.pgl.clear(PGL.COLOR_BUFFER_BIT | PGL.DEPTH_BUFFER_BIT);
// pg_shadowmap.background(0xFFFFFFFF);
pg_shadowmap.blendMode(PConstants.REPLACE);
pg_shadowmap.noStroke();
pg_shadowmap.applyMatrix(mat_scene_bounds);
pg_shadowmap.shader(shader_shadow);
scene_display.display(pg_shadowmap);
pg_shadowmap.endDraw();
}
示例12: initPointCloud
import processing.opengl.PGL; //导入依赖的package包/类
private void initPointCloud() {
PGL pgl = ((PGraphicsOpenGL) parentApplet.g).pgl;
// TODO: lookt at the shaders...
myShader = parentApplet.loadShader(PointCloud.class.getResource("points.frag").toString(),
PointCloud.class.getResource("points.vert").toString());
myShader.bind();
shaderProgram = myShader.glProgram;
vertLoc = pgl.getAttribLocation(shaderProgram, "vertex");
colorsLoc = pgl.getAttribLocation(shaderProgram, "color");
transformLoc = pgl.getUniformLocation(shaderProgram, "transform");
myShader.unbind();
// System.out.println("Shader program " + shaderProgram + " vertex loc " + vertLoc + " transform loc " + transformLoc + " colors " + colorsLoc);
// Allocate the buffer in central memory (native), then java, then OpenGL
// Native memory
int byteSize = nbPoints * 4 * 4; // 4 : SizeOf Float -> ? SIZEOF_FLOAT
verticesNative = ByteBuffer.allocateDirect(byteSize).order(ByteOrder.nativeOrder()).
asFloatBuffer();
colorsNative = ByteBuffer.allocateDirect(byteSize).order(ByteOrder.nativeOrder()).asIntBuffer();
// Java memory
verticesJava = new float[nbPoints * 4];
colorsJava = new int[nbPoints];
// System.out.println("Buffer vertex object: " + glVertBuff);
// unbind the buffer.
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
// Generate a buffer color data and color.
IntBuffer intBuffer = IntBuffer.allocate(2);
pgl.genBuffers(2, intBuffer);
vertexBuffer = intBuffer.get(0);
colorBuffer = intBuffer.get(1);
}
示例13: getPixelColorFast
import processing.opengl.PGL; //导入依赖的package包/类
public static int getPixelColorFast( PApplet p, PGraphics image, int x, int y ) {
PGL pgl = image.beginPGL();
ByteBuffer buffer = ByteBuffer.allocateDirect(1 * 1 * Integer.SIZE / 8);
pgl.readPixels(x, y, 1, 1, PGL.RGBA, PGL.UNSIGNED_BYTE, buffer);
// get the first three bytes
int r = buffer.get() & 0xFF;
int g = buffer.get() & 0xFF;
int b = buffer.get() & 0xFF;
buffer.clear();
image.endPGL();
return p.color(r, g, b);
}
示例14: apply
import processing.opengl.PGL; //导入依赖的package包/类
public void apply(PGraphics3D src, PGraphics3D dst){
int w = src.width;
int h = src.height;
resize(w, h);
// 1) GeometryBuffer Pass
pg_edges.beginDraw();
DwUtils.copyMatrices(src, pg_edges);
pg_edges.blendMode(PConstants.REPLACE);
pg_edges.pgl.clearColor(0.5f, 0.5f, 0.5f, 0.5f);
pg_edges.pgl.clear(PGL.COLOR_BUFFER_BIT);
shader_edges.set("wh", (float)w, (float)h);
pg_edges.shader(shader_edges);
pg_edges.noStroke();
scene_display.display(pg_edges);
pg_edges.endDraw();
// 2) AA Pass
if(src == dst){
System.out.println("GBAA error: read-write race");
return;
}
Texture tex_src = src.getTexture(); if(!tex_src.available()) return;
Texture tex_dst = dst.getTexture(); if(!tex_dst.available()) return;
Texture tex_edges = pg_edges.getTexture(); if(!tex_edges.available()) return;
context.begin();
context.beginDraw(dst);
shader_gbaa.begin();
shader_gbaa.uniform2f ("wh_rcp" , 1f/w, 1f/h);
shader_gbaa.uniformTexture("tex_src", tex_src.glName);
shader_gbaa.uniformTexture("tex_edges", tex_edges.glName);
shader_gbaa.drawFullScreenQuad();
shader_gbaa.end();
context.endDraw();
context.end("GBAA.apply");
}
示例15: beginPGL
import processing.opengl.PGL; //导入依赖的package包/类
public PGL beginPGL() {
return currentGraphics.beginPGL();
}