本文整理汇总了Java中com.jogamp.opengl.GL2.glPointSize方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glPointSize方法的具体用法?Java GL2.glPointSize怎么用?Java GL2.glPointSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glPointSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawClusters
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void drawClusters(GLAutoDrawable drawable){
GL2 gl=drawable.getGL().getGL2();
for(int i = 0; i<maxElements;i++){
if(!elementPixels[i].isEmpty()){
//System.out.println("CLUSTER: "+i);
Iterator it = elementPixels[i].iterator();
gl.glPointSize(4);
while(it.hasNext()){
int idx = (Integer)it.next();
//System.out.println("Pixel-Idx: "+idx);
//System.out.println("Color: "+clusterColors[i][0]+", "+clusterColors[i][1]+", "+clusterColors[i][2]);
//System.out.println("Coord: "+frameBuffer[idx][1]+", "+frameBuffer[idx][2]);
gl.glBegin(GL.GL_POINTS);
gl.glColor3f(colors[i][0],colors[i][1],colors[i][2]);
gl.glVertex2i(frameBuffer[idx][1],frameBuffer[idx][2]);
gl.glEnd();
}
}
}
}
示例2: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void draw(GLAutoDrawable drawable){
GL2 gl=drawable.getGL().getGL2();
gl.glPointSize(6.0f);
gl.glBegin(GL.GL_POINTS);
if(hasEdge()){
gl.glColor3f(0.0f,0.0f,1.0f);
gl.glVertex2d(x,y);
}else if(angled){
gl.glColor3f(1.0f,0.0f,0.0f);
gl.glVertex2d(x,y);
}else{
gl.glColor4f(0.5f,0.0f,0.0f,0.2f);
//gl.glVertex2d(x,y);
}
gl.glEnd();
}
示例3: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
if(!isFilterEnabled()) {
return;
}
GL2 gl=drawable.getGL().getGL2();
if (gl == null) {
return;
}
gl.glColor3f(0,1,0);
gl.glPointSize(4f);
try{
gl.glBegin(GL.GL_POINTS);
{
for(int i = 0; i < detector.keypoints.size(); i++){
gl.glVertex2i(detector.keypoints.get(i).x, detector.keypoints.get(i).y);
}
}
} finally{
gl.glEnd();
}
}
示例4: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
if(!isFilterEnabled()) {
return;
}
GL2 gl=drawable.getGL().getGL2();
if (gl == null) {
return;
}
gl.glColor3f(0,1,0);
gl.glPointSize(4f);
try{
gl.glBegin(GL.GL_POINTS);
{
for(int i = 0; i < binaryMethod.keypointlist.size(); i++){
gl.glVertex2i(binaryMethod.keypointlist.get(i).x, binaryMethod.keypointlist.get(i).y);
}
}
} finally{
gl.glEnd();
}
}
示例5: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
void draw(GL2 gl) {
gl.glPushMatrix();
gl.glTranslatef(location.x, location.y, 0);
gl.glLineWidth(2);
gl.glColor3f(1, 1, 1);
gl.glPointSize(4);
gl.glBegin(GL.GL_POINTS);
gl.glVertex2f(0, 0);
gl.glEnd();
gl.glBegin(GL.GL_LINES);
gl.glVertex2f(0, 0);
Point2D.Float p = filter.getValue2d();
gl.glVertex2f(p.x * vectorScalingPixelsPerPPS, p.y * vectorScalingPixelsPerPPS);
gl.glEnd();
gl.glPopMatrix();
}
示例6: arrow
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void arrow(GL2 gl, float x,float y,float ux, float uy){
gl.glColor3f(1,1,1);
gl.glPointSize(5);
gl.glBegin(GL.GL_POINTS);
gl.glVertex3f(x,y,0);
gl.glEnd();
gl.glBegin(GL2.GL_LINES);
float ex=x+vectorLengthScale*MOTION_VECTOR_FACTOR*ux, ey=y+vectorLengthScale*MOTION_VECTOR_FACTOR*uy;
gl.glVertex2f(x,y);
gl.glVertex2f(ex,ey);
gl.glEnd();
}
示例7: drawMotionVector
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
* Plots a single motion vector which is the number of pixels per second
* times scaling. Color vectors by angle to x-axis.
*
* @param gl the OpenGL context
* @param e the event
*/
protected void drawMotionVector(GL2 gl, MotionOrientationEventInterface e) {
float[] rgb = null;
if (useColorForMotionVectors) {
rgb = motionColor(e);
} else {
rgb = new float[]{0, 0, 1};
}
gl.glColor3fv(rgb, 0);
float scale = ppsScale;
if (ppsScaleDisplayRelativeOFLength && displayGlobalMotion) {
scale = 100 * ppsScale / motionFlowStatistics.getGlobalMotion().meanGlobalSpeed;
}
if (displayVectorsEnabled) {
gl.glPushMatrix();
gl.glLineWidth(motionVectorLineWidthPixels);
// start arrow from event
// DrawGL.drawVector(gl, e.getX() + .5f, e.getY() + .5f, e.getVelocity().x, e.getVelocity().y, motionVectorLineWidthPixels, ppsScale);
// center arrow on location, rather that start from event location
float dx, dy;
dx = e.getVelocity().x * scale;
dy = e.getVelocity().y * scale;
if (displayVectorsAsUnitVectors) {
float s = 100 * scale / (float) Math.sqrt(dx * dx + dy * dy);
dx *= s;
dy *= s;
}
float x0 = e.getX() - (dx / 2) + .5f, y0 = e.getY() - (dy / 2) + .5f;
DrawGL.drawVector(gl, x0, y0, dx, dy, motionVectorLineWidthPixels, 1);
gl.glPopMatrix();
}
if (displayVectorsAsColorDots) {
gl.glPointSize(motionVectorLineWidthPixels * 5);
gl.glEnable(GL2.GL_POINT_SMOOTH);
gl.glBegin(GL.GL_POINTS);
gl.glVertex2f(e.getX(), e.getY());
gl.glEnd();
}
}
示例8: drawDot
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
static public void drawDot(GL2 gl){
for (int i=0; i<nrClusters; i++){
gl.glPointSize(10);
gl.glColor3f(1f,0.5f,0.5f);
gl.glBegin(GL.GL_POINTS);
gl.glVertex2i((int)xPos[i],(int)yPos[i]);
gl.glEnd();
}
}
示例9: drawPerls
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
static public void drawPerls(GL2 gl){
while (perls.size()<maxPerls){
perls.add(new Perl());
}
Iterator<Perl> itr = perls.iterator();
while(itr.hasNext()){
boolean drawPerl = true;
Perl perl = itr.next();
/*for(int j=0; j<nrClusters; j++){
if (perl.x > xPos[j]-margin && perl.y < xPos[j]+margin && drawPerl){
System.out.println("perl "+perl.x+"/"+perl.y+" removed");
perls.remove(perl);
drawPerl = false;
}
}*/
if(drawPerl){
perl.update();
gl.glPointSize(perl.size);
gl.glColor3f(perl.color*0.5f,perl.color*0.5f,perl.color);
gl.glBegin(GL.GL_POINTS);
gl.glVertex2i(perl.x,perl.y);
gl.glEnd();
}
}
for(int i = 0; i<refreshRate; i++){
int rmIndex = random.nextInt(perls.size());
while(perls.get(rmIndex) == null){
rmIndex = random.nextInt(perls.size());
}
if(perls.get(rmIndex).color<0.05) {
perls.remove(rmIndex);
}
}
phase++;
}
示例10: drawLineSegments
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public void drawLineSegments(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2(); // when we getString this we are already set up with updateShape 1=1 pixel, at LL corner
GLUT cGLUT = chip.getCanvas().getGlut();
if (gl == null) {
log.warning("null GL in ELiSeD.annotate");
return;
}
canvas = chip.getCanvas();
glCanvas = (GLCanvas) canvas.getCanvas();
gl.glPointSize(5.0f);
for (LineSupport ls : lineSupportRegions) {
if (ls == null || !ls.isLineSegment()) {
continue;
}
gl.glColor3f(0.0f, 0.0f, 0.0f);
if (annotateLineSegments) {
gl.glLineWidth(4.0f);
gl.glColor3f(0.0f, 0.0f, 0.0f);
gl.glBegin(GL.GL_LINES);
gl.glVertex2f(ls.getEndpointX1(), ls.getEndpointY1());
gl.glVertex2f(ls.getEndpointX2(), ls.getEndpointY2());
gl.glEnd();
gl.glColor3f(ls.getColor()[0], ls.getColor()[1], ls.getColor()[2]);
gl.glRasterPos3f(ls.getCenterX(), ls.getCenterY(), 0);
}
if (annotateAngles) {
cGLUT.glutBitmapString(GLUT.BITMAP_TIMES_ROMAN_10, String.format("orientation:=%f", ls.getOrientation()));
}
if (annotateWidth) {
gl.glColor3f(0.0f, 0.0f, 0.0f);
gl.glRasterPos3f(ls.getCenterX(), ls.getCenterY(), 0); // according to http://stackoverflow.com/questions/3818173/opengl-set-text-color , color changes are only effective if the position is set afterwards
cGLUT.glutBitmapString(GLUT.BITMAP_TIMES_ROMAN_10, String.format("width:=%f", ls.getWidth()));
gl.glColor3f(ls.getColor()[0], ls.getColor()[1], ls.getColor()[2]);
gl.glRasterPos3f(ls.getCenterX(), ls.getCenterY(), 0);
}
}
}
示例11: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public synchronized void annotate(GLAutoDrawable drawable) {
// vector and position are always displayed in blue
GL2 gl = drawable.getGL().getGL2();
gl.glColor3f(0, 0, 1);
gl.glPointSize(5f);
gl.glBegin(GL.GL_POINTS);
gl.glVertex2d(64 + globalPosition.x, 64 + globalPosition.y);
gl.glEnd();
DrawGL.drawVector(gl, 64, 64, globalAverageVelocityPPS.x, globalAverageVelocityPPS.y);
}
示例12: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public synchronized void annotate(GLAutoDrawable drawable) {
super.annotate(drawable);
// vector and position are always displayed in blue
GL2 gl = drawable.getGL().getGL2();
gl.glColor3f(0, 0, 1);
gl.glPointSize(5f);
gl.glBegin(GL.GL_POINTS);
gl.glVertex2d(64 + globalPosition.x, 64 + globalPosition.y);
gl.glEnd();
DrawGL.drawVector(gl, 64, 64, globalAverageVelocityPPS.x, globalAverageVelocityPPS.y);
}
示例13: init
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(GLAutoDrawable drawable)
{
GL2 gl = drawable.getGL().getGL2();
gl.glPointSize(5.0f);
gl.glLineWidth(1.0f);
gl.glEnable(GL2.GL_BLEND);
gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(-1, 1, -1, 1, 0.01, 1000);
//gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glEnable(GL2.GL_DEPTH_TEST);
gl.glDepthFunc(GL2.GL_LEQUAL);
// Enable smooth shading.
gl.glShadeModel(GL2.GL_SMOOTH);
gl.glEnable(GL2.GL_BLEND);
gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
// Define "clear" color.
gl.glClearColor(0f, 0f, 0f, 0f);
// We want a nice perspective.
gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST);
float[] pos = {1,-1,1,0};
float[] diff = {1,1,1,1};
gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, diff, 0);
gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, pos, 0);
gl.glEnable(GL2.GL_LIGHT0);
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_COLOR_MATERIAL);
if(Shoot.DEBUG)
drawable.getAnimator().setUpdateFPSFrames(25, System.out);
}
示例14: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
super.annotate(drawable);
GL2 gl = drawable.getGL().getGL2();
// draw slew-rate limited tilt values
final float size = .1f;
float sx = chip.getSizeX(), sy = chip.getSizeY();
{
gl.glPushMatrix();
gl.glTranslatef(-sx * size * 1.1f, .7f * sy, 0); // move outside chip array to lower left
gl.glScalef(sx * size, sx * size, sx * size); // scale everything so that when we draw 1 unit we cover this size*sx pixels
gl.glLineWidth(3f);
gl.glColor3f(1, 1, 1);
{
gl.glBegin(GL.GL_LINE_LOOP); // frame of slew-rate limited modelled controller output
gl.glVertex2f(0, 0);
gl.glVertex2f(1, 0);
gl.glVertex2f(1, 1);
gl.glVertex2f(0, 1);
gl.glEnd();
}
// draw tilt vector
float lim = controller.getTiltLimitRad() / 2;
float xlen = tiltsRadDelayed.x / lim;
float ylen = tiltsRadDelayed.y / lim;
gl.glLineWidth(4f);
if ((Math.abs(xlen) < .5f) && (Math.abs(ylen) < .5f)) {
gl.glColor4f(0, 1, 0, 1);
} else {
gl.glColor4f(1, 0, 0, 1);
}
gl.glPointSize(6f);
{
gl.glTranslatef(.5f, .5f, 0);
gl.glBegin(GL.GL_POINTS);
gl.glVertex2f(0, 0);
gl.glEnd();
}
gl.glLineWidth(4);
{
gl.glBegin(GL.GL_LINES);
gl.glVertex2f(0, 0);
gl.glVertex2f(xlen, ylen); // vector showing slew-rate limited controller output
gl.glEnd();
}
gl.glPopMatrix();
}
// draw virtual ball
// gl.glPointSize(44);
// gl.glColor4f(0,0,.5f,.5f);
// gl.glBegin(GL.GL_POINTS);
// gl.glVertex2f(ball.posPixels.x,ball.posPixels.y);
// gl.glEnd();
chip.getCanvas().checkGLError(gl, glu, "after virtual ball annotations");
ball.render(gl);
}
示例15: draw
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Draws this cluster using OpenGL.
*
* @param drawable area to draw this.
*/
public void draw (GLAutoDrawable drawable){
final float BOX_LINE_WIDTH = 2f; // in chip
final float PATH_POINT_SIZE = 4f;
final float SUPER_POINT_SIZE = 8f;
final float VEL_LINE_WIDTH = 4f;
GL2 gl = drawable.getGL().getGL2();
int x = (int)getLocation().x;
int y = (int)getLocation().y;
// set color and line width of cluster annotation
getColor().getRGBComponents(rgb);
gl.glColor3fv(rgb,0);
gl.glLineWidth(BOX_LINE_WIDTH);
// draw cluster rectangle
drawBox(gl,x,y,(int)maxRadius);
gl.glPointSize(PATH_POINT_SIZE);
ArrayList<ClusterPathPoint> points = getPath();
for ( Point2D.Float p:points ){
gl.glBegin(GL.GL_POINTS);
gl.glVertex2f(p.x,p.y);
gl.glEnd();
}
// now draw velocityPPT vector
if ( showClusterVelocity ){
gl.glLineWidth(VEL_LINE_WIDTH);
gl.glBegin(GL.GL_LINES);
{
gl.glVertex2i(x,y);
gl.glVertex2f(x + (getVelocityPPT().x * VELOCITY_VECTOR_SCALING * velocityVectorScaling),y + (getVelocityPPT().y * VELOCITY_VECTOR_SCALING * velocityVectorScaling));
}
gl.glEnd();
}
// text annoations on clusters, setup
final int font = GLUT.BITMAP_HELVETICA_18;
if(validForOSC){
gl.glColor3f(0,1,0);
}else{
gl.glColor3f(1,1,1);
}
gl.glRasterPos3f(location.x,location.y,0);
// annotate the cluster with hash ID
if ( showClusterNumber ){
chip.getCanvas().getGlut().glutBitmapString(font,String.format("#%d",hashCode()));
}
//annotate the cluster with the velocityPPT in pps
if ( showClusterVelocity ){
Point2D.Float velpps = getVelocityPPS();
chip.getCanvas().getGlut().glutBitmapString(font,String.format("%.0f,%.0f pps",velpps.x,velpps.y));
}
//show superPos
gl.glColor3f(1,0,0);
gl.glPointSize(SUPER_POINT_SIZE);
gl.glBegin(GL.GL_POINTS);
gl.glVertex2f(superPos.x,superPos.y);
gl.glEnd();
}