本文整理汇总了Java中com.jogamp.opengl.GL2.glVertex2i方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glVertex2i方法的具体用法?Java GL2.glVertex2i怎么用?Java GL2.glVertex2i使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glVertex2i方法的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: drawHistogramFire
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
static public void drawHistogramFire(GL2 gl){
gl.glBegin (GL.GL_LINES);
for(int i = 0; i<dsx; i++){
if(xHistogram[i]>maxHistogramX) {
maxHistogramX = xHistogram[i];
}
if(xHistogram[i]>0){
gl.glColor3f(1,1,0);
gl.glVertex2i(i,0);
gl.glColor3f(1,0,0);
gl.glVertex2i(i,(xHistogram[i]*dsy)/maxHistogramX);
gl.glVertex2i(i,(xHistogram[i]*dsy)/maxHistogramX);
gl.glColor3f(0,0,0);
gl.glVertex2i(i,(2*xHistogram[i]*dsy)/maxHistogramX);
}
}
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: drawBox
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
protected void drawBox(GL2 gl, int x, int y, int sx, int sy, float angle) {
final float r2d = (float) (180 / Math.PI);
gl.glPushMatrix();
gl.glTranslatef(x, y, 0);
gl.glRotatef(angle * r2d, 0, 0, 1);
gl.glBegin(GL.GL_LINE_LOOP);
{
gl.glVertex2i(-sx, -sy);
gl.glVertex2i(+sx, -sy);
gl.glVertex2i(+sx, +sy);
gl.glVertex2i(-sx, +sy);
}
gl.glEnd();
if (dynamicAngleEnabled) {
gl.glBegin(GL.GL_LINES);
{
gl.glVertex2i(0, 0);
gl.glVertex2i(sx, 0);
}
gl.glEnd();
}
gl.glPopMatrix();
}
示例6: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate (GLAutoDrawable drawable){
if ( !isAnnotationEnabled() ){
return;
}
GL2 gl = drawable.getGL().getGL2();
gl.glColor3f(0,0,1);
gl.glLineWidth(.2f);
int n = 1 << surroundScale;
int sy = chip.getSizeY();
gl.glPushMatrix();
gl.glBegin(GL.GL_LINES);
for ( int i = 1 ; i < surSizeX ;
i++ ){
gl.glVertex2i(i * n,0);
gl.glVertex2i(i * n,sy);
}
int sx = chip.getSizeX();
for ( int i = 1 ; i < surSizeY ;
i++ ){
gl.glVertex2i(0,i * n);
gl.glVertex2i(sx,i * n);
}
gl.glEnd();
gl.glPopMatrix();
}
示例7: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
if(!isAnnotationEnabled() || !isFilterEnabled()) {
return;
}
if(!isFilterEnabled()) {
return;
}
GL2 gl=drawable.getGL().getGL2();
gl.glPushMatrix();
{
for(int ctr=0;ctr<maxBoxNum;ctr++) {
gl.glColor3f(0,0,ctr);
gl.glLineWidth(2f);
gl.glBegin(GL.GL_LINE_LOOP);
gl.glVertex2i(startX[ctr],startY[ctr]);
gl.glVertex2i(endX[ctr],startY[ctr]);
gl.glVertex2i(endX[ctr],endY[ctr]);
gl.glVertex2i(startX[ctr],endY[ctr]);
gl.glEnd();
}
gl.glPopMatrix();
}
}
示例8: drawBox
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
*
* @param gl
* @param x
* @param y
* @param radius
*/
protected void drawBox (GL2 gl,int x,int y,int radius){
gl.glPushMatrix();
gl.glTranslatef(x,y,0);
gl.glBegin(GL.GL_LINE_LOOP);
{
gl.glVertex2i(-radius,-radius);
gl.glVertex2i(+radius,-radius);
gl.glVertex2i(+radius,+radius);
gl.glVertex2i(-radius,+radius);
}
gl.glEnd();
gl.glPopMatrix();
}
示例9: drawReceptiveField
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Draws the neuron using OpenGL.
*
* @param drawable area to drawReceptiveField this.
*/
public void drawReceptiveField(GLAutoDrawable drawable) {
final float BOX_LINE_WIDTH = 2f; // in chip
GL2 gl = drawable.getGL().getGL2();
// set color and line width
gl.glColor3fv(rgb, 0);
gl.glLineWidth(BOX_LINE_WIDTH);
// draws the receptive field of a neuron
gl.glPushMatrix();
gl.glTranslatef((int) getLocation().x, (int) getLocation().y, 0);
if (filledReceptiveField) {
gl.glBegin(GL2.GL_QUADS);
} else {
gl.glBegin(GL.GL_LINE_LOOP);
}
int halfSize = receptiveFieldSize / 2;
gl.glVertex2i(-halfSize, -halfSize);
gl.glVertex2i(+halfSize, -halfSize);
gl.glVertex2i(+halfSize, +halfSize);
gl.glVertex2i(-halfSize, +halfSize);
gl.glEnd();
gl.glPopMatrix();
}
示例10: 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();
}
}
示例11: 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++;
}
示例12: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
GL2 gl=drawable.getGL().getGL2(); // when we getString this we are already set up with updateShape 1=1 pixel, at LL corner
if(gl==null) {
log.warning("null GL");
return;
}
final float BOX_LINE_WIDTH=3f; // in pixels
gl.glColor3f(1, 0, 0);
gl.glLineWidth(BOX_LINE_WIDTH);
final int sx=2, sy=2;
for(PanTiltCalibrationPoint p : sampleVector) {
gl.glPushMatrix();
final int x=(int) p.ret.x, y=(int) p.ret.y;
gl.glBegin(GL.GL_LINE_LOOP);
{
gl.glVertex2i(x-sx, y-sy);
gl.glVertex2i(x+sx, y-sy);
gl.glVertex2i(x+sx, y+sy);
gl.glVertex2i(x-sx, y+sy);
}
gl.glEnd();
gl.glPopMatrix();
}
}
示例13: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
if (!isFilterEnabled()) {
return;
}
tracker.annotate(drawable);
GL2 gl = drawable.getGL().getGL2(); // when we getString this we are already set up with updateShape 1=1 pixel, at LL corner
if (gl == null) {
log.warning("null GL");
return;
}
final float BOX_LINE_WIDTH = 3f; // in pixels
gl.glColor3f(1, 0, 0);
gl.glLineWidth(BOX_LINE_WIDTH);
final int sx = 2, sy = 2;
for (PanTiltCalibrationPoint p : calibrator.sampleVector) {
gl.glPushMatrix();
final int x = (int) p.ret.x, y = (int) p.ret.y;
gl.glBegin(GL.GL_LINE_LOOP);
{
gl.glVertex2i(x - sx, y - sy);
gl.glVertex2i(x + sx, y - sy);
gl.glVertex2i(x + sx, y + sy);
gl.glVertex2i(x - sx, y + sy);
}
gl.glEnd();
gl.glPopMatrix();
}
}
示例14: drawBox
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
protected void drawBox (GL2 gl,int x,int y,int sx,int sy){
gl.glBegin(GL.GL_LINE_LOOP);
{
gl.glVertex2i(x - sx,y - sy);
gl.glVertex2i(x + sx,y - sy);
gl.glVertex2i(x + sx,y + sy);
gl.glVertex2i(x - sx,y + sy);
}
gl.glEnd();
}
示例15: annotate
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void annotate(GLAutoDrawable drawable) {
if ((drawable == null) || (chip.getCanvas() == null)) {
return;
}
canvas = chip.getCanvas();
glCanvas = (GLCanvas) canvas.getCanvas();
// int sx = chip.getSizeX(), sy = chip.getSizeY();
GL2 gl = drawable.getGL().getGL2();
if (selecting) {
drawSelection(gl, selection, SELECT_COLOR);
}
gl.glPushMatrix();
{
if (!multiSelectionEnabled) {
gl.glColor3f(0, 0, 1);
gl.glLineWidth(2f);
gl.glBegin(GL.GL_LINE_LOOP);
gl.glVertex2i(startX, startY);
gl.glVertex2i(endX, startY);
gl.glVertex2i(endX, endY);
gl.glVertex2i(startX, endY);
gl.glEnd();
} else {
for (SelectionRectangle r : selectionList) {
r.draw(gl);
}
}
}
gl.glPopMatrix();
}