本文整理匯總了Java中javax.media.opengl.GL.glDisable方法的典型用法代碼示例。如果您正苦於以下問題:Java GL.glDisable方法的具體用法?Java GL.glDisable怎麽用?Java GL.glDisable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.media.opengl.GL
的用法示例。
在下文中一共展示了GL.glDisable方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createTexture
import javax.media.opengl.GL; //導入方法依賴的package包/類
public static JOGLTexture createTexture(GL gl, BufferedImage awtImage)
{
int textureID = createTextureID(gl);
gl.glEnable(GL.GL_TEXTURE_2D);
// convert that image into a byte buffer of texture data
ByteBuffer textureBuffer = ImageConverter.convertPowerOf2(awtImage);
gl.glBindTexture(GL.GL_TEXTURE_2D, textureID);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);
int texWidth = ImageConverter.powerOf2(awtImage.getWidth());
int texHeight = ImageConverter.powerOf2(awtImage.getHeight());
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA,
texWidth, texHeight, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, textureBuffer);
gl.glDisable(GL.GL_TEXTURE_2D);
return new JOGLTexture(gl, textureID, awtImage.getWidth(), awtImage.getHeight(), texWidth, texHeight);
}
示例2: init
import javax.media.opengl.GL; //導入方法依賴的package包/類
@Override
public synchronized void init(GLAutoDrawable glDrawable) {
GL gl = glDrawable.getGL();
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glClearDepth(1.0);
gl.glShadeModel(GL.GL_SMOOTH); // try setting this to GL_FLAT and see what happens.
/* float[] lightAmbient = new float[]{0.5f, 0.5f, 0.5f, 1.0f};
float[] lightDiffuse = new float[]{1.0f, 1.0f, 1.0f, 1.0f};
float[] lightPosition = new float[]{
0, 0, 0,
// (float)levelBox.getFlag().getCenterX(),
// (float)levelBox.getFlag().getCenterY(),
// (float)levelBox.getFlag().getCenterZ() + (float)levelBox.getFlag().getDeltaZ(),
1.0f};
gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, FloatBuffer.wrap(lightAmbient));
gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, FloatBuffer.wrap(lightDiffuse));
gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, FloatBuffer.wrap(lightPosition));
gl.glEnable(GL.GL_LIGHT0);
*/
gl.glDisable(GL.GL_LIGHTING);
// Now preprocess our data for rendering
agentRenderes.prepare(gl);
mapRenderer.prepare(gl);
}
示例3: renderFade
import javax.media.opengl.GL; //導入方法依賴的package包/類
/**
* Render passed fade line in passed color.
* @param gl
* @param fadeline Data about fadeline
* @param color what color should fadeline be drawn
*/
private void renderFade(GL gl, GlColor color, IFadeLine fadeline) {
gl.glEnable(GL.GL_BLEND);
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
gl.glBegin(GL.GL_QUADS);
Location lastLocation = null;
double lastAlpha = 0; // how much is point opaque
for (long ms = 0; ms < fadeline.getDuration(); ms += 100) {
Location currentLocation = fadeline.getPosition(ms);
double currentAlpha = ((double) ms) / fadeline.getDuration();
if (lastLocation == null) {
lastLocation = currentLocation;
lastAlpha = currentAlpha;
continue;
}
if (currentLocation != null) {
pushFadeQuad(gl, color, currentLocation, lastLocation, currentAlpha, lastAlpha);
lastLocation = currentLocation;
lastAlpha = currentAlpha;
}
}
gl.glEnd();
gl.glDisable(GL.GL_BLEND);
}
示例4: renderPlacedMapEvent
import javax.media.opengl.GL; //導入方法依賴的package包/類
/**
* Render {@link MapEvent} that is placed at fixed place (=not at the player).
* @param gl
* @param color what color should be map event drawn.
* @param mapEvent map event to render.
*/
private void renderPlacedMapEvent(GL gl, GlColor color, MapEvent mapEvent) {
LogMapMark mapMark = mapEvent.getMark();
Location position = mapMark.getLocation();
if (logger.isLoggable(Level.FINE)) logger.fine(" MSG: " + mapMark.getMessage() + ", LOC: " + position);
// gl.glEnable(GL.GL_BLEND);
// gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
gl.glPushMatrix();
{
gl.glTranslated(position.x, position.y, position.z + SPHERE_RADIUS * 1.1);
gl.glColor4d(color.r, color.g, color.b, color.a);
// glu.gluSphere(quadratic, SPHERE_RADIUS * 3, SPHERE_SLICES, SPHERE_STACKS);
glu.gluCylinder(quadratic, SPHERE_RADIUS, SPHERE_RADIUS, 2*SPHERE_RADIUS, 4, 1);
}
gl.glPopMatrix();
gl.glDisable(GL.GL_DEPTH_TEST);
{
gl.glColor3d(0, 0, 0);
gl.glRasterPos3d(position.x, position.y, position.z);
glut.glutBitmapString(GLUT.BITMAP_HELVETICA_12, mapEvent.getMessage());
gl.glColor3d(1, 1, 1);
}
gl.glEnable(GL.GL_DEPTH_TEST);
// gl.glDisable(GL.GL_BLEND);
}
示例5: disposeMaterial
import javax.media.opengl.GL; //導入方法依賴的package包/類
/**
* dispose of any resources that may have been claimed from the loading of the material.
* This should be called after the drawing of the part is complete.
* @param gl
*/
public void disposeMaterial(GL gl){
if(AvoGlobal.glView.OPENGL_FRAGMENT_SHADER_GLSL_ENABLED){
// TODO: dispose material in GLSL
}else{
if(AvoGlobal.glView.OPENGL_FRAGMENT_PROGRAM_ARB_ENABLED){
// TODO: dispose material in ARB
gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB);
}else{
// dispose r,g,b,a for material.. (no action really needed here)
gl.glColor4d(0.5, 0.5, 0.5, 1.0);
}
}
}
示例6: drawTileIDs
import javax.media.opengl.GL; //導入方法依賴的package包/類
protected void drawTileIDs(DrawContext dc, ArrayList<TextureTile> tiles)
{
java.awt.Rectangle viewport = dc.getView().getViewport();
TextRenderer textRenderer = OGLTextRenderer.getOrCreateTextRenderer(dc.getTextRendererCache(),
java.awt.Font.decode("Arial-Plain-13"));
GL gl = dc.getGL();
gl.glDisable(GL.GL_DEPTH_TEST);
gl.glDisable(GL.GL_BLEND);
gl.glDisable(GL.GL_TEXTURE_2D);
textRenderer.beginRendering(viewport.width, viewport.height);
textRenderer.setColor(java.awt.Color.YELLOW);
for (TextureTile tile : tiles)
{
String tileLabel = tile.getLabel();
if (tile.getFallbackTile() != null)
tileLabel += "/" + tile.getFallbackTile().getLabel();
LatLon ll = tile.getSector().getCentroid();
Vec4 pt = dc.getGlobe().computePointFromPosition(ll.getLatitude(), ll.getLongitude(),
dc.getGlobe().getElevation(ll.getLatitude(), ll.getLongitude()));
pt = dc.getView().project(pt);
textRenderer.draw(tileLabel, (int) pt.x, (int) pt.y);
}
textRenderer.setColor(java.awt.Color.WHITE);
textRenderer.endRendering();
}
示例7: turnGLLightsOff
import javax.media.opengl.GL; //導入方法依賴的package包/類
private void turnGLLightsOff(GL gl){
gl.glDisable(GL.GL_LIGHTING);
gl.glDisable(GL.GL_LIGHT0);
}
示例8: display
import javax.media.opengl.GL; //導入方法依賴的package包/類
@Override
public void display(GLAutoDrawable glAutoDrawable) {
// System.out.println("MER.display " + time + " " + this.mapEvent.getMessage());
GL gl = glAutoDrawable.getGL();
gl.glPushMatrix();
gl.glTranslated(location.x, location.y, location.z + 60 * 1.1);
// display small
// gl.glEnable(GL.GL_BLEND);
gl.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE_MINUS_SRC_ALPHA);
GlColor color = new GlColor(entity.getColor(), 0.5);
gl.glColor4d(color.r, color.g, color.b, color.a);
GLUquadric quadratic = glu.gluNewQuadric();
glu.gluSphere(quadratic, SPHERE_RADIUS, SPHERE_SLICES, SPHERE_STACKS);
gl.glPopMatrix();
gl.glDisable(GL.GL_DEPTH_TEST);
gl.glColor3d(1,1,1);
gl.glRasterPos3d(location.x, location.y, location.z);
glut.glutBitmapString(GLUT.BITMAP_HELVETICA_12, this.mapEvent.getMessage());
gl.glEnable(GL.GL_DEPTH_TEST);
// gl.glDisable(GL.GL_BLEND);
}