本文整理匯總了Java中javax.media.opengl.GL2.glPointSize方法的典型用法代碼示例。如果您正苦於以下問題:Java GL2.glPointSize方法的具體用法?Java GL2.glPointSize怎麽用?Java GL2.glPointSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.media.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glPointSize方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: renderCircle
import javax.media.opengl.GL2; //導入方法依賴的package包/類
public static void renderCircle(OpenGLContext context,float zoomWidth,float zoomHeight,List<Geometry>geometries,Geometry selectedGeometry,float size,Color color){
GL2 gl = context.getGL().getGL2();
float[] c = color.brighter().getColorComponents(null);
gl.glColor3f(c[0], c[1], c[2]);
gl.glBegin(GL.GL_POINTS);
for (int ii=0;ii<geometries.size();ii++) {
Geometry temp =geometries.get(ii);
gl.glLineWidth(temp == selectedGeometry ? size * 2 : size);
gl.glPointSize(temp == selectedGeometry ? size * 2 : size);
Coordinate point = temp.getCoordinate();
double dx=(point.x - context.getX()) / zoomWidth;
double dy=1 - (point.y - context.getY()) / zoomHeight;
for (int i=0; i < 360; i++){
//double angle = 2 * Math.PI * i / 360;
double xx = dx+Math.sin(i)*0.005;
double yy = dy+Math.cos(i)*0.005;
gl.glVertex2d(xx,yy);
}
}
gl.glEnd();
gl.glFlush();
}
示例2: draw
import javax.media.opengl.GL2; //導入方法依賴的package包/類
/**
*
* @param openGl
*/
public final synchronized void draw(final GL2 openGl) {
if (points == null || points.size() == 0) {
return;
}
AbstractDoubleCordinateBuffer.bindIfExists(verticesBuf, openGl);
openGl.glEnable(GL2.GL_POLYGON_OFFSET_FILL);
openGl.glPolygonOffset(1.0f, 1.0f);
AbstractDoubleCordinateBuffer.bindIfExists(lineColorBuf, openGl);
indicesBuf.drawLine(openGl, GL2.GL_LINE_LOOP, GL2.GL_FRONT_AND_BACK);
AbstractDoubleCordinateBuffer.unBindExists(lineColorBuf, openGl);
AbstractDoubleCordinateBuffer.bindIfExists(pointColorBuf, openGl);
float[] f = new float[1];
openGl.glGetFloatv(GL2.GL_POINT_SIZE, f, 0);
openGl.glPointSize(3.0f);
indicesBuf.drawLine(openGl, GL2.GL_POINTS, GL2.GL_FRONT);
openGl.glPointSize(f[0]);
AbstractDoubleCordinateBuffer.bindIfExists(pointColorBuf, openGl);
AbstractDoubleCordinateBuffer.unBindExists(verticesBuf, openGl);
}
示例3: renderPolygons
import javax.media.opengl.GL2; //導入方法依賴的package包/類
public static void renderPolygons(OpenGLContext context,float zoomWidth,float zoomHeight,List<Geometry>geometries,float size,Color color){
GL2 gl = context.getGL().getGL2();
float[] c = color.brighter().getColorComponents(null);
gl.glColor3f(c[0], c[1], c[2]);
gl.glPointSize(size);
gl.glBegin(GL.GL_POINTS);
for (Geometry temp : geometries) {
for (Coordinate point : temp.getCoordinates()) {
gl.glVertex2d((point.x - context.getX()) / zoomWidth, 1 - (point.y - context.getY()) / zoomHeight);
}
}
gl.glEnd();
gl.glFlush();
}
示例4: renderPolygon
import javax.media.opengl.GL2; //導入方法依賴的package包/類
public static void renderPolygon(OpenGLContext context,float zoomWidth,float zoomHeight,Coordinate[] coordinates,float size,Color color){
GL2 gl = context.getGL().getGL2();
float[] c = color.brighter().getColorComponents(null);
gl.glColor3f(c[0], c[1], c[2]);
gl.glPointSize(size);
gl.glBegin(GL.GL_LINE_STRIP);
for (Coordinate point : coordinates) {
gl.glVertex2d((point.x - context.getX()) / zoomWidth, 1 - (point.y - context.getY()) / zoomHeight);
}
//Coordinate point = temp.getCoordinates()[0];
//gl.glVertex2d((point.x - x) / width, 1 - (point.y - y) / height);
gl.glEnd();
gl.glFlush();
}
示例5: renderPoint
import javax.media.opengl.GL2; //導入方法依賴的package包/類
public static void renderPoint(OpenGLContext context,float zoomWidth,float zoomHeight,Coordinate point,float size,Color color){
GL2 gl = context.getGL().getGL2();
float[] c = color.brighter().getColorComponents(null);
gl.glColor3f(c[0], c[1], c[2]);
gl.glPointSize(size);
gl.glBegin(GL.GL_POINTS);
gl.glVertex2d((point.x - context.getX()) / zoomWidth, 1 - (point.y - context.getY()) / zoomHeight);
gl.glEnd();
gl.glFlush();
}
示例6: drawPoint
import javax.media.opengl.GL2; //導入方法依賴的package包/類
@Override
public void drawPoint(Vec2 argPoint, float argRadiusOnScreen, Color3f argColor) {
Vec2 vec = getWorldToScreen(argPoint);
GL2 gl = panel.getGL().getGL2();
gl.glPointSize(argRadiusOnScreen);
gl.glBegin(GL2.GL_POINTS);
gl.glVertex2f(vec.x, vec.y);
gl.glEnd();
}
示例7: drawPoint
import javax.media.opengl.GL2; //導入方法依賴的package包/類
@Override
public void drawPoint(Vec2 argPoint, float argRadiusOnScreen, Color3f argColor) {
Vec2 vec = getWorldToScreen(argPoint);
GL2 gl = panel.getGL().getGL2();
gl.glBegin(GL2.GL_POINT);
gl.glPointSize(argRadiusOnScreen);
gl.glVertex2f(vec.x, vec.y);
gl.glEnd();
}
示例8: drawPointsVBO
import javax.media.opengl.GL2; //導入方法依賴的package包/類
/**
* Draws points at this path's specified positions.
* <p/>
* Note: when the draw context is in picking mode, this binds the current GL_ARRAY_BUFFER to 0
* after using the currently bound GL_ARRAY_BUFFER to specify the vertex pointer. This does not
* restore GL_ARRAY_BUFFER to the its previous state. If the caller intends to use that buffer
* after this method returns, the caller must bind the buffer again.
*
* @param dc
* the current draw context.
* @param vboIds
* the ids of this shapes buffers.
* @param pathData
* the current globe-specific path data.
*/
@Override
protected void drawPointsVBO(final DrawContext dc, final int[] vboIds, final PathData pathData) {
final TourTrackConfig config = TourTrackConfigManager.getActiveConfig();
if (config.isShowTrackPosition == false) {
return;
}
final double d = getDistanceMetric(dc, pathData);
if (d > getShowPositionsThreshold()) {
return;
}
final IntBuffer posPoints = pathData.getPositionPoints();
if (posPoints == null || posPoints.limit() < 1) {
return;
}
final boolean useVertexColors = pathData.getTessellatedColors() != null && isShowTrackValueColor_Outline();
final GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
// Convert stride from number of elements to number of bytes.
gl.glVertexPointer(3, GL2.GL_FLOAT, 4 * pathData.getVertexStride(), 0);
if (dc.isPickingMode()) {
gl.glEnableClientState(GL2.GL_COLOR_ARRAY);
gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);
gl.glColorPointer(3, GL2.GL_UNSIGNED_BYTE, 0, pickPositionColors);
} else if (useVertexColors) {
// Apply this path's per-position colors if we're in normal rendering mode (not picking) and this path's
// positionColors is non-null. Convert the stride and offset from number of elements to number of bytes.
gl.glEnableClientState(GL2.GL_COLOR_ARRAY);
gl.glColorPointer(4, GL2.GL_FLOAT, 4 * pathData.getVertexStride(), 4 * pathData.getColorOffset());
}
prepareToDrawPoints(dc);
gl.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, vboIds[2]);
gl.glDrawElements(GL2.GL_POINTS, posPoints.limit(), GL2.GL_UNSIGNED_INT, 0);
// Restore the previous GL point state.
gl.glPointSize(1f);
gl.glDisable(GL2.GL_POINT_SMOOTH);
// Restore the previous GL color array state.
if (dc.isPickingMode() || useVertexColors) {
gl.glDisableClientState(GL2.GL_COLOR_ARRAY);
}
}