本文整理匯總了Java中javax.media.opengl.GL2.glBindFramebuffer方法的典型用法代碼示例。如果您正苦於以下問題:Java GL2.glBindFramebuffer方法的具體用法?Java GL2.glBindFramebuffer怎麽用?Java GL2.glBindFramebuffer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.media.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glBindFramebuffer方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doRoi
import javax.media.opengl.GL2; //導入方法依賴的package包/類
@Override protected void doRoi() {
transformer.transform(srcRoiPts, dstRoiPts, parameters, false);
double[] pts = dstRoiPts.get();
for (int i = 0; i < pts.length; i++) {
pts[i] /= (1<<pyramidLevel);
}
roi.x(0).y(0).width(maskCL[pyramidLevel].width).height(maskCL[pyramidLevel].height);
// Add +3 all around because cvWarpPerspective() needs it for interpolation,
// and there seems to be something funny with memory alignment and
// ROIs, so let's align our ROI to a 16 byte boundary just in case..
JavaCV.boundingRect(pts, roi, 3, 3, 16, 1);
//System.out.println(roi);
inputData.roiX = roi.x();
inputData.roiY = roi.y();
inputData.roiWidth = roi.width();
inputData.roiHeight = roi.height();
// GLContext glContext = context.getGLContext();
// glContext.makeCurrent();
GL2 gl = context.getGL2();
gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, maskfb[pyramidLevel]);
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
context.getGLU().gluOrtho2D(0.0f, maskCL[pyramidLevel].width, 0.0f, maskCL[pyramidLevel].height);
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glViewport(0, 0, maskCL[pyramidLevel].width, maskCL[pyramidLevel].height);
gl.glClearColor(0, 0, 0, 0);
gl.glClear(GL2.GL_COLOR_BUFFER_BIT);
gl.glColor4f(1, 1, 1, 1);
gl.glBegin(GL2.GL_POLYGON);
// XXX: Remove "extra" pixels here...
gl.glVertex2d(pts[0], pts[1]);
gl.glVertex2d(pts[2]+1, pts[3]);
gl.glVertex2d(pts[4]+1, pts[5]+1);
gl.glVertex2d(pts[6], pts[7]+1);
gl.glEnd();
// gl.glFinish();
// glContext.release();
}