本文整理匯總了Java中javax.media.opengl.GL.glGetIntegerv方法的典型用法代碼示例。如果您正苦於以下問題:Java GL.glGetIntegerv方法的具體用法?Java GL.glGetIntegerv怎麽用?Java GL.glGetIntegerv使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.media.opengl.GL
的用法示例。
在下文中一共展示了GL.glGetIntegerv方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: renderText
import javax.media.opengl.GL; //導入方法依賴的package包/類
private void renderText(GL gl, String text, int x, int y, int font) {
int viewport[] = new int[4];
gl.glGetIntegerv(GL.GL_VIEWPORT, viewport, 0);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
{
gl.glOrtho(0, viewport[2], 0, viewport[3], -1, 1);
gl.glColor3d(1, 1, 1);
gl.glRasterPos3d(0, 0, 0);
glut.glutBitmapString(font, text);
}
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPopMatrix();
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPopMatrix();
}
示例2: getWorldCoordinates
import javax.media.opengl.GL; //導入方法依賴的package包/類
public static Location getWorldCoordinates(GL gl, GLU glu, Location screen, Location store) {
if (store == null) {
store = new Location(0,0,0);
}
// Modelview matrix
DoubleBuffer mvBuffer = DoubleBuffer.allocate(16);
gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, mvBuffer);
// Projection_matrix
DoubleBuffer prBuffer = DoubleBuffer.allocate(16);
gl.glGetDoublev(GL.GL_PROJECTION_MATRIX, prBuffer);
// Viewport matrix
IntBuffer vpBuffer = IntBuffer.allocate(16); // 4 is necessary
gl.glGetIntegerv(GL.GL_VIEWPORT, vpBuffer);
// 3d coordinates
DoubleBuffer result = DoubleBuffer.allocate(3);
glu.gluUnProject(screen.x,
screen.y,
screen.z,
mvBuffer,
prBuffer,
vpBuffer,
result);
store = new Location(result.get(0), result.get(1), result.get(2));
return store;
}
示例3: getScreenCoordinates
import javax.media.opengl.GL; //導入方法依賴的package包/類
public static Location getScreenCoordinates(GL gl, GLU glu, Location worldPosition, Location store) {
if (store == null) {
store = new Location(0,0,0);
}
// Modelview matrix
DoubleBuffer mvBuffer = DoubleBuffer.allocate(16);
gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, mvBuffer);
// Projection_matrix
DoubleBuffer prBuffer = DoubleBuffer.allocate(16);
gl.glGetDoublev(GL.GL_PROJECTION_MATRIX, prBuffer);
// Viewport matrix
IntBuffer vpBuffer = IntBuffer.allocate(16);
gl.glGetIntegerv(GL.GL_VIEWPORT, vpBuffer);
DoubleBuffer result = DoubleBuffer.allocate(3);
glu.gluProject(worldPosition.x,
worldPosition.y,
worldPosition.z,
mvBuffer,
prBuffer,
vpBuffer,
result);
store = new Location(result.get(0), result.get(1), result.get(2));
return store;
}
示例4: getViewport
import javax.media.opengl.GL; //導入方法依賴的package包/類
public static Rectangle getViewport(GL gl) {
int viewport[] = new int[4];
gl.glGetIntegerv(GL.GL_VIEWPORT, viewport, 0);
return new Rectangle(viewport[0], viewport[1], viewport[2], viewport[3]);
}