Saturday, October 24, 2009

Brazilian For Men Bangkok



PRO YECC ION:

F rente

Oblique

Pe rfile: Rarely.

Saturday, August 29, 2009

Milena Velba Barn -dailymotion

EDITORIAL VERTEX No. 5



Congress Manifesto VII

The life of any political organization is full of daily events and special occasions. One of these is the conclusion of the Seventh National Congress of FE-JONS because it will mark a before and after in the history of the party and the whole Trade Union Movement of National Liberation. Whatever the outcome of the conference, activists, members and supporters of the so-called Alternative Vertex

EXPRESS

which continue to struggle to make the instrument phalanx of the National People's Revolution English, which is necessary for a party with some very specific profiles.

- We want a patriotic party in the line of critical patriotism, which alone can give a sense of national passing away of folkloric zarzuela on the right.

- We want a social party, a destination to class and poorer social sectors of this system.

- We want a united party with all peoples struggling against imperialism plutocratic are headed by the United States, authentic human cancer.

- We want a party open and dynamic, where debate, discussion and open-mindedness are the property of their internal life and not some sort of party-dominated church dogmatism and ideological autarchy.

- We want a party with tables trained and prepared in the same working methods. A true phalanx ready for political combat.

- We want a party rooted in society . A party that, through their organizations, create a network of interconnections that allow us to be integrated and move naturally within our social environment.

- want a game with historical memory . Assuming and respecting our past, understand the present and the future we can win.

- We want a creative party, a true laboratory of ideas and initiatives for alternatives. The National-is not, nor will be ever finished. There will always be new routes to open and explore.

- We want a party that is crucible of the new values \u200b\u200b. Against bourgeois formal ethics, lift up a practice-based experiential revolutionize ethics consistent with our values.

- We want a community party. A militant community where the camaraderie is more than just a word. Never abandon the comrade who need help.

- We want a party unwavering. Determined not to give in, to never give up, not to fight for lost, not to flinch from harsh regardless of the circumstances. We want a game to win.

- We want a radical party. Essentially unyielding, firm in their identity. So elastic in the formal and superficial, as terribly hard and granite in their statements of principles.

- We want a game so revolutionary . Conservatives should not be anything that belongs to this biocide system. We must be contradiction, its subversion, a party of conspirators for their relentless destruction.

this and this we ask all Falangists. We build the organization, to lift up the illusion that shaping the enthusiasm to conquer the future ... We

Party

Madrid, October 24, 1998

Vertex. Publication alternative Falangist, No. 5, October 1998, pg. 4.

Thursday, August 27, 2009

Can Lemon Juice Really Dissolve Kidney Stones

JOGL resize a figure without distorting

Previously we how to draw a hexagon, octagon and a circle with JOGL but never resize the frame that contained them. The reason? it because we had not modified the method reshape () interface used by GLEventListener , then, to resize a frame may be that our figures are distorted as shown in this image:


deformed circle to resize the JFrame.


To prevent this, we must modify the code contained within the method reshape () as follows:

public void reshape ( GLAutoDrawable drawable, int x, int and int width, int height) {

/ / Load the projection of our image
gl . glMatrixMode (GL.GL_PROJECTION)
gl.glLoadIdentity ();

/ / When the height is larger than the width
if (w \u0026lt;= h) {

/ / Update the background (bottom ) and top (top) of
/ / so as not to warp our picture
gl.glOrtho (-xrange, xrange, yrange
-* ((float) h / (float) w) yrange * ((float) h / (float) w)-zRange, zRange)

} / / When the width is bigger than the high

else {
/ / Update the left side (left ) and the right side (right) of
/ / so as not to warp our picture
gl.glOrtho (-xrange * ((float) w / (float) h), xrange * ((float) w / (float) h),
-yrange, yrange, "zRange, zRange);}

/ / Load the model view
/ / with the new dimensions (width, height)
gl . glMatrixMode (GL.GL_MODELVIEW)
gl.glViewport (x, y, width, height);
/ / redraw the object
canvas.repaint ();}


As can be seen in the previous method, we used three new variables: xrange, yrange, zRange, these variables define our work space and must be declared and initialized in the constructor of our program

float xrange = 5.0f;
float yrange = 5.0f;
zRange float = 5.0f;

With this, our space Work will continue to comprise the ranges:
  • x = [-5.5]
  • y = [-5.5]
  • z = [-5.5]
method reshape receives as parameters four variables:
  1. GLAutodrawable
  2. int drawable x
  3. and
  4. int int
  5. int width height
These variables define the new dimensions of our object content in GLCanvas and it is necessary to manipulate the final shape is not deformed. Thus, when resizing the frame that contains the figure, no matter if the width or height increases, the figure shown within the object GLCanvas remain undistorted as shown in the following figures:







If you wish to download the source code you can click on the following link: Download

dibujarCircunferenciaNODeforme.java source
far

Tuesday, August 4, 2009

Mapouka Reference Watch Online

Draw lines to form a circle with

We have seen the basic pricipios draw lines and we have drawn a quadrilateral . We will use these same principles to draw a circle using the same code by simply changing the method display () .

circle drawn with JOGL.



What we will do first is to draw a hexagon. To achieve our mission, we draw 6 vertices as follows:
  1. The first corner as we draw to the coordinate (4, 0).
  2. We rotate the apex 60 º (360 º / 6) and we redraw in its new coordinates.
  3. repeat the previous step 5 times to draw a total of 6 vertices that form our hexagon.
Recall the formula for rotating a point angle , the new point be defined by:




We help an array of float size [6] [2], which represent our 6 coordinates, the array will initialize in the constructor.

Within the methods glBegin () and glEnd () declare our vertices:

gl.glBegin (GL.GL_LINE_LOOP)
/ / Initialize the first vertex
/ / x
point [0] [0] = 4.0F;

/ / coordinate and
point [0] [1] = 0.0f;

/ / Draw the first vertex
gl.glVertex2d (point [0] [0], item [0] [1]);

/ * Draw the 5 remaining vertices by rotating
* above 60 º , use the equivalent in radians *
as the functions sin and cos of
* Java Math package works with the latter * /

for (int i = 1; i \u0026lt;6; i + +)
{
/ / x '= x * cos (60 °) - y * sin (60 º)
point [i] [0] = point [i-1] [0] * Math.cos (Math.toRadians (60)) -
point [i-1] [1] * Math.sin (Math.toRadians (60));


/ / y '= x * sin (60 º) + y * cos (60 º)
point [i] [1] = point [i-1] [0] * Math.sin (Math.toRadians (60)) +
point [i-1] [1] * Math.cos (Math.toRadians (60));


/ / Draw the new vertex obtained
gl.glVertex2d (point [i] [0], item [i] [1]);}

gl.glEnd ();

When you compile and run the modified code shows a result as follows:

Hexagon drawn with JOGL.

now return to modify the code, but now, to draw an octagon. Use the same method used above, only this time instead of rotating 60 degrees (360 º / 6) we will rotate the top 45 º (360 º / 8) and the vertex we draw 8 times.
We
help of a float array of dimensions [8] [2], which represent our 8 coordinates, the array will initialize in the constructor.

Within the methods glBegin () and glEnd () declare our vertices:

gl.glBegin (GL.GL_LINE_LOOP)
/ / Initialize the first vertex
/ / x
point [0] [0] = 4.0F;

/ / coordinate and
point [0] [1] = 0.0f;

/ / Draw the first vertex
gl.glVertex2d (point [0] [0], item [0] [1]);

/ * We draw the 8 remaining vertices by rotating
* above 45 degrees, use the equivalent
* radians as the functions sin and cos of
* package Math Java works with recent * /

for (int i = 1; i \u0026lt;8; i + +)
{
/ / x '= x * cos (45 degrees) - and * sin (45 º)
point [i] [0] = point [i-1] [0] * Math.cos (Math.toRadians (45) ) -
point [i-1] [1] * Math.sin (Math.toRadians (45));


/ / y '= x * sin (45 º) + y * cos (45 º)
point [i] [1] = point [i-1] [0] * Math.sin (Math.E toRadians (45)) +
point [i-1] [1] * Math.cos (Math.toRadians (45));


/ / Draw the new vertex obtained
gl.glVertex2d (point [i ] [0], item [i] [1]);}

gl.glEnd ();

When you compile and run the modified code shows a result like this

drawn with JOGL Octagon.

As can be seen in the examples above, if we continue to expand the sides of the figures, these are becoming more the shape of a circle. Modify the code again but this time to draw a circular polygon 360. Use the same method used above, only this time instead of rotating 45 degrees (360 º / 8) vertex we will rotate only 1 º (360 º / 360) and the vertex we draw 360 times.

We help of a float array of dimensions [360] [2], which represent our 360 coordinates, it will initialize array within the constructor.

Within the methods glBegin () and glEnd () declare our vertices:

gl.glBegin (GL.GL_LINE_LOOP)
/ / Initialize the first vertex
/ / x
point [0] [0] = 4.0F;

/ / coordinate and
point [0] [1] = 0.0f;

/ / Draw the first vertex
gl . glVertex2d (point [0] [0], item [0] [1]);

/ * Draw the 359 remaining vertices by rotating
* above 1, we use the equivalent
* radians as the functions sin and cos of
* package Math Java works with recent * /

for (int i = 1, i \u0026lt; , 360; i + +)
{
/ / x '= x * cos (1 °) - and * sin (1 °)
point [i] [0] = point [i-1] [0 ] * Math.cos (Math.toRadians (1)) -
point [i-1] [1] * Math.sin (Math.toRadians (1));


/ / y '= x * sin (1 °) + y * cos (1 °)
point [i] [1] = point [i-1] [0] * Math.sin (Math.toRadians (1))
+ point [i-1] [1] * Math.cos (Math.toRadians (1));


/ / Draw the new vertex obtained
gl.glVertex2d (point [i] [0] point [i] [1]);}

gl.glEnd ();

When you compile and run the modified code shows a result as follows:

Circumference drawn with JOGL.

And here we have our circle made with JOGL, as the sides are so close and so small they are almost imperceptible giving the appearance of a circle. This JOGL because we did not offer specific functions to draw circles.

If you wish to download the source code of the figures shown in the examples given just click on any of the following links:

Download dibujarHexagono.java source
dibujarOctagono Download source code . java
Download dibujaCircunferencia.java source

FINAL NOTE
The examples use a two-dimensional array to draw the vertices this was just to make it understandable. Just as a recommendation, to save memory in the system, do not use an array because the larger it will occupy more memory. Instead of using an array bidemensional, simply use two variables called, say, coordenadaX and sobreescribánlas coordenadaY and for each cycle using two auxiliary variables. Download the following source code to see the right thing to do:

dibujaCircunferencia.java Download source code without using two-dimensional array.

Table In Everyone Loves Raymond

JOGL Draw lines to form a square with JOGL

We will see a simple example of a program that lets you draw lines using several variations of the methods glVertex of OpenGL obviously using the Java language and libraries JOGL. We have explained earlier how draw a point using JOGL libraries , well, the same code as "used to draw lines.

lines defining the sides of a square with JOGL


The code will modify the contents inside the methods:
  • init ( GLAutoDrawable drawable)
  • reshape ( GLAutoDrawable drawable, int x, int and int width, int height)
  • display ( GLAutoDrawable drawable)
addition, for the moment, will not allow our JFrame is resized. Then post the method parameter setRezizable ( boolean flag), located within the constructor, false. Start by explaining changes in the methods:

init ( GLAutoDrawable drawable)

In the code we use to draw point also print the mark of your video card and operating system screen, this time simply initializes the background color to black:

public void init ( GLAutoDrawable drawable) {

gl.glClearColor (0.0f, 0.0f , 0.0f, 0.0f);}


reshape ( GLAutoDrawable drawable, int x, int and int width, int height)

In this method which we will define a "space work "that includes the following ranges:
  • x = [-5, 5]
  • y = [-5, 5]
  • z = [-5, 5]
As we are working in two dimensions z axis is imperceptible. Our code will be as follows:

public void reshape ( GLAutoDrawable drawable, int x, int and int width, int height) {

gl.glMatrixMode (GL.GL_PROJECTION) gl.glLoadIdentity ();
gl.glOrtho (-5.0f, 5.0f,-5.0f, 5.0f,-5.0f, 5.0f);
canvas.repaint ();}


remember the way we define our "workspace"
  1. glOrtho method (double left, double right, double bottom, double top, double near, double far) is used to define the orthographic projection.
  2. Therefore, this method will create a "workspace" similar to a bucket where the bottom left corner front is defined by coordinates (left, bottom, far) and the right rear corner is defined by coordinates (right, top, near) .
Definition of our "workspace"

display ( GLAutoDrawable drawable)

modify Here code so that we can use different methods to draw lines and to form a polygon. First we will start clearing the buffers used by your video card to draw and define the color with which we draw our lines. In this case I have decided to use the color CYAN, however, we can use any other color if it is different from that defined in the background.

gl.glClear (GL.GL_COLOR_BUFFER_BIT)
gl.glColor3f (0.0f, 1.0f, 1.0f);

JOGL Now we will tell what the charts are drawn using the methods glBegin (GLenum mode) and glEnd () . Recall that in these methods will all graphics to be displayed in our view GLCanvas . Use the method glVertex2d (double x, double y) to tell JOGL begins and ends where the vertices of the lines you draw.

In this example, we will do is draw a square. To achieve our mission will draw just 4 vertices:
  1. (-4, -4)
  2. (4, -4)
  3. (4, 4)
  4. (-4, 4) We help
a float array of dimensions [4] [2], which represent our 4 coordinates, the array will initialize in the constructor.

Within methods glBegin () and glEnd () declare our vertices:

gl.glBegin (GL.GL_LINE_LOOP)
/ / Initialize the first vertex
/ / x (first vertex)
point [0] [0] = -4.0;
/ / y (first vertex)
point [0] [1] = -4.0;

/ / Initialize the second vertex
/ / x (second point)
point [1] [0] = 4.0;
/ / y (second point)
point [1] [1] = -4.0;

/ / Initialize the third vertex

/ / x (third point)
point [2] [0] = 4.0;
/ / y-coordinate (third point)
point [2] [1] = 4.0;

/ / Initialize the fourth vertex

/ / Coordinates x (fourth vertex)
point [3] [0] = -4.0;
/ / y-coordinate (fourth vertex)
point [3] [1] = 4.0;

/ / Draw ALL

vertices gl.glVertex2d (point [0] [0], item [0] [1]);
gl.glVertex2d (point [1] [0], item [1] [1]) ;
gl.glVertex2d (point [2] [0], item [2] [1]);
gl.glVertex2d (point [3] [0], item [3] [1]);

gl.glEnd ();
gl.glFlush ();


When you compile and run the modified code shows a result as follows:


lines using parameter GL.GL_LINE_LOOP

The Mode parameter of the method glBegin (GLenum mode) will modify that to show different ways to draw lines with JOGL. In the previous example was used GL_LINE_LOOP , thus connecting all the vertices with line segments as follows:
  • Draw a line segment of the first vertex to the second.
  • Draw a line segment of the second vertex to the third.
  • . . .
  • Draw a line segment of the last vertex to the first.
With parameter GL_LINES each successive pair of vertices, defined within methods glBegin () and glEnd () generates a line segment. If we change the method code:

gl.glBegin (GL.GL_LINE_LOOP)

by:

gl.glBegin (GL.GL_LINES)

obtain a result like this:


lines using parameter GL.GL_LINES

GL_LINE_STRIP parameter makes points defined within methods glBegin ( ) and glEnd () generate a sequence of line segments where the endpoint of a line segment will be the starting point of the next line segment , similar to what happens with GL_LINE_LOOP with the difference that the last vertex does not generate a line segment with the first vertex . If we change the method code:

gl.glBegin (GL.GL_LINE_LOOP)

by:

gl.glBegin (GL.GL_LINE_STRIP)

get a result like the following:

lines using parameter GL.GL_LINE_STRIP

You can change the line thickness using the method:

gl.glLineWidth ( float width);

For example if we modify the method code:

gl.glBegin (GL.GL_LINE_LOOP)

by:

gl.glLineWidth (5);
gl.glBegin (Gal. GL_LINE_LOOP )

obtain a result like this:

gl.glLineWidth points using the method (5)

What happens if you simply draw the vertices ? Modica method code:

gl.glBegin (GL.GL_LINE_LOOP)

by:

/ / points of 12 pixels so you can see
gl.glPointSize (12);
gl.glBegin (GL.GL_POINTS)

get a result like following:

GL.GL_POINTS points using parameter

If you wish to download the source code POSE to click on the following link: Download

dibujaLineas.java source

Friday, July 31, 2009

Fruit For Man To Masterbate

simple program to draw a point with Program

Now vemermos a simple program to draw a point using JOGL and also show in the command line version of your operating system and brand of video card you have installed on our computer. All this will do using a JFrame centered on the screen .



To begin, we must import the library:

javax.media.opengl import. * ;

which contains classes and interfaces required to call methods in Java OpenGL among which are:
  • GL Interface. This interface give us access to OpenGL functions.
  • GLEventListener Interface. This interface declares events which are used by client code to handle OpenGL rendering through GLAutoDrawable. Everything is handled by GLAutoDrawable be displayed through an instantiated object of class GLCanvas. Class
  • GLCanvas . This class will provide support for rendering OpenGL graphics, the object instances of this class must be placed inside a JPanel to be displayed.
Our main class, as well as extending the JFrame class, must implement GLEventListener interface, described above, so that the source code will be as follows:

import javax.swing. JFrame ;
import javax.swing. JPanel ;
import java.awt. Container ;
import java.awt. BorderLayout ;
import java.awt. Toolkit;
import java.awt. Dimension ;

/ / OpenGL import library import
javax.media.opengl. * ;

public class puntoJOGL extends JFrame implements GLEventListener
JPanel {
panelDibujo;
Container container;
Toolkit kit;
dimensionPantalla Dimension;
int height;
int width;

/ / GL interface will provide access to OpenGL functions
static GL gl;

/ * GLCanvas class provides support for rendering
* OpenGL graphics for the moment only the use
* to show the four main methods of GLEventListener * / static GLCanvas
canvas;

/ / Constructor public
puntoJOGL () {

super ( "Punto drawn with JOGL" )
Toolkit.getDefaultToolkit kit = (); kit.getScreenSize
dimensionPantalla = ();
height = (int ) dimensionPantalla.getHeight ();
width = (int ) dimensionPantalla.getWidth ();

/ / Create class object GLCanvas
canvas = new GLCanvas ();

/ * Add the event listener for OpenGL rendering,
* this automatically call init () and render the graphics
* whose code is written inside the method display () * /
canvas.addGLEventListener ( this )

/ * Initialize the interface GL which
use * to call OpenGL functions * / gl =
canvas.getGL ();

panelDibujo = new JPanel (new BorderLayout ()) ;

/ * add the object in the center GLCanvas
JPanel * for graphics rendering in the
GLCanvas * object can be visualized. * /
panelDibujo.add (canvas, BorderLayout. CENTER);

container = getContentPane ();
container.add (panelDibujo, BorderLayout.CENTER);
this.setSize (width / 2, height / 2);
this.setLocation (width / 4, height / 4);
this.setResizable (true);
this.setVisible (true); this
. setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);


} / / Below are the methods used by GLEventListener

/ * As explained, this method is that
* initialize the OpenGL graphics GLCanvas used,
* to call OpenGL functions use the object gl
* created earlier. * /
public void init ( GLAutoDrawable drawable)

{/ / write the screen version of the OS
System.out.println (gl.glGetString (GL.GL_VERSION));
/ / write on the screen of our brand video card
System.out.println (gl.glGetString (GL.GL_VENDOR));
/ * The bottom of the graphics displayed on the object
* GLCanvas will be black. As you can see, we
* using the method of OpenGL glClearColor (float, float, float, float)
* by GL interface. * /
gl.glClearColor (0.0f, 0.0f, 0.0f, 0.0f);

} public void
reshape ( GLAutoDrawable drawable, int x, int and int width, int height) {

/ * This method, as explained, is used for the
* user can modify the "viewport"
graphics * properly. In this case, declare that our space
* work is the same size as the JFrame. This is done so that
* the point you draw appears exactly in the center of the JFrame .* /
gl.glMatrixMode (GL.GL_PROJECTION)
gl.glLoadIdentity ();

/ * Define the point of view (viewport) of our object GLCanvas
* which, as noted above, will be the same size as the
* JFrame. Thus, if there is a change in the size of
* JFrame, the workspace will adjust the size of it to
* that point to continue showing in the center. * /
gl.glOrtho (0, width, 0, height, -1.0, 1.0);

/ * If the JFrame is sized, are redrawn graphics. * /
canvas.repaint ();}


public void display ( GLAutoDrawable drawable)

{/ * This method is used to create all the graphics that
* will be drawn within the object GLCanvas. First call the
* OpenGL method glClear (GLBitField mask) which will cleanse
* all buffers for drawing. * /
gl.glClear (GL.GL_COLOR_BUFFER_BIT)

/ * Now call the method glColor3f (float, float, float)
* which will define the color of the graphics that
* drawn. In this case, draw a blue dot. * /
gl.glColor3f (0.0f, 0.0f, 1.0f);

/ * define the size of the point drawn using
glPointSize * method () in OpenGL, in this case will 10 pixels. * /
gl.glPointSize (10);

/ * This is nearly identical to a statement
* in C or C + + using OpenGL. Indicated that begin
* Drawing on the method glBegin (GLenum mode) and finalize
* with the method glEnd (). In both methods will
* ALL graphics drawings. * /
gl.glBegin (GL.GL_POINTS)
/ * For now, only draw a vertex exactly
* GLCanvas middle of our order. Because the object
* GLCanvas is in the center of the JPanel and it is
* In the center of the JFrame, the
* dot appears right in the middle of the latter. * /
gl.glVertex2i (width / 2, height / 2);
gl.glEnd ();

/ * Indicates draw immediately after using the method
* glFlush (); * /
gl.glFlush ();

} public void
displayChanged ( GLAutoDrawable drawable, boolean
ModeChanged, boolean deviceChanged)

{/ * Method for handling events in exchange for display,
* it will not use it now. * /}


/ / Stop the methods used by GLEventListener

/ / main method to start executing our program
public static void main (String [] args) {

/ * Simply create a class object
* puntoJOGL, then the program will run
* constructor code. * /
puntoJOGL new ();
}}


When you compile and run the code above, we show a centered JFrame with a dot drawn in the middle like the figure below:


While in the command line shown us some data as follows:


If you wish to download the source code you can click on the link below:

puntoJOGL.java Download source

OpenGL methods used.

glClearColor (float, float, float)

In the method init () , we can change the background graphics using the method OpenGL, glClearColor (float, float, float, float ) named by GL interface implemented in the constructor. The method glClearColor (float, float, float, float) handles colors using the RGBA model with a color depth interval between 0 and 255. Because managed float data type, we must use the formula:

(r/255, g/255, b/255, alpha)

being r, g, b desired color intensity and alpha transparency thereof, the combination of all of us will result in the requested color. To be more clear, here are some examples:
  1. Color YELLOW . To create this color combination is needed (255, 255, 0, 0), therefore, in OpenGL is (1.0f, 1.0f, 0.0f, 0.0f). CYAN Color
  2. . To create this color combination is needed (0, 255, 255, 0), therefore, in OpenGL is (0.0f, 1.0f, 1.0f, 0.0f). MAGENTA Color
  3. . To create this color combination is needed (255, 0, 255), 0, therefore, in OpenGL is (1.0f, 0.0f, 1.0f, 0.0f). ORANGE Color
  4. . To create this color combination is needed (255, 128, 0, 0), therefore, in OpenGL is (1.0f, 0.5f, 0.0f, 0.0f). PURPLE Color
  5. . To create this color combination is needed (128, 0, 255, 0), therefore, in OpenGL is (0.5f, 0.0f, 1.0f, 0.0f). Color
  6. ROSA. To create this color combination is needed (255, 0, 128, 0), therefore, in OpenGL is (1.0f, 0.0f, 0.5f, 0.0f).
can be tested by changing the values \u200b\u200bin the method glClearColor (float, float, float, float) within the method init () .

For more information visit the glClearColor method documentation () .

glColor3f (float, float, float)

This method is used to define the color of the graphics are drawn, the colors created using the RGB model . So to change the colors used a similar method with glClearColor (float, float, float, float) , only this time we will not use the variable alpha . Other variants glColor method * () that depend on the type of data they handle eg
  1. glColor3i void (int, int, int)
  2. void glColor3f (float, float, float) - Seen in the sample program. Void
  3. glColor3d (double, double, double) void
  4. glColor3fv (float [], int alpha) - This method, like glClearColor , use color transparency alpha defined.
can be tested by changing the values \u200b\u200bin the method glColor3f (float, float, float, float) within the method display () . For

information visit the glColor method documentation * () .

glBegin (GL.GL_POINTS) and glEnd ()

These methods especidican the beginning and end of the drawn object , in this case is a point. The general form of these methods is as follows:

glBegin (GLenum mode)
/ / Draw object
glEnd () Where

mode includes parameters such as:
  • GL_POINTS - Used in this program .
  • GL_LINES - Used to draw lines, there are other alternatives.
  • GL_TRIANGLES - Used to draw triangles, there are other alternatives.
  • GL_QUADS - Used to draw squares, exitsten other variants.
  • GL_POLYGON - Used to draw polygons.
Later we will see some concrete examples, if you want more information check the documentation for the method glBegin () .

glPointSize (int pixels)

This method is used to define the size of the point to draw, in this example program was 10 pixels.

glMatrixMode (GLenum mode);
gl.glLoadIdentity ();
gl.glOrtho (double left, double right, double bottom, double top, double near, double far)

These methods are necessary to define the orthographic projection is ie in tems easier, defines our workspace. In the case of our program define a workspace width x height x 2 , in this case the 2 is not seen as we are working in two dimensions only. To have a better idea, consider the workspace as a "hub" where:
  • The front lower left corner is defined by coordinates (Left, bottom, far)
  • The right rear corner is defined by coordinates (right, top, near)




For more information, visit the documentation glOrtho () .

glVertex2i (int x, int y)


This method draw a vertex located at coordinates (x, y) in the sample program are located exactly at the top half of our JFrame using the height and width variables . Because the method defined gl.glOrtho a workspace (width, height, 2) then, calling the method glVertex2i (width / 2, height / 2) we are putting our corner right in the middle of our area of \u200b\u200bwork, which, being situated in the middle of JFrame shows the point exactly between latter. The method glVertex * () contains many variants, among which are:
  • glVertex2i (int x, int y) - Used in the example program.
  • glVertex2f (float x, float y)
  • glVertex2i (int x, int y, int z) - Used to draw 3-D graphics.
For more information, visit the documentation glVertex () .

Finally, they can play with the code and make changes to see the results. Here are some variations by modifying the code:

glClearColor (1.0f, 1.0f, 1.0f, 0.0f)
glColor3f (1.0f, 0.0f, 0.0f)


glClearColor (0.5f, 0.0f, 1.0f, 0.0f)
glColor3f (0.0f, 0.0f, 0.0f)


glClearColor (1.0f, 0.0f, 0.0f, 0.0f)
glColor3f (1.0f, 1.0f, 0.0f)

FINAL NOTE: Remember that
call OpenGL functions must do so through JOGL GL interface.

Does Lipoma Look Like

JOGL to draw a JFrame centered on the screen of a structure

already explained above how is the general structure of a program written in Java using JOGL for the time show you how to draw a centered JFrame screen whatever the resolution of it so that later , we can draw into the same few graphics using JOGL . this way begin to study the general structure of a program written in Java why, later, exploring the methods used by GLEventListener .



Here's the code:

/ * Import the JFrame and JPanel classes
contained within the package * SWING * /
import javax.swing. JFrame ;
import javax.swing. JPanel ;

/ * import Container class, BorderLayout,
* Dimension Toolkit AWT package. * /
import java.awt. Container ;
import java.awt. BorderLayout ;
import java.awt. Toolkit;
import java.awt. Dimension ;

/ / Create our main class that extends JFrame class public class
jFrameCentrado extends JFrame {

/ * need a JPanel to enter
* the items displayed in the JFrame. * /
JPanel panel;

/ * declare a container to enter
* our main panel, the container
* is the JFrame in general. * /
Container container;

/ * The toolkit is useful for
* basic information about the computer, how resolution
* or size of the screen, where
* is running the program * /
Toolkit kit;

/ * This variable will use to store
* Dimension (W x H) in pixels, of
* screen where the program is running. * / Dimension
dimensionPantalla;

/ / Variable to store the height, in pixels, screen
int height;
/ / Variable to store the width, in pixels,
screen int width;

/ / Constructor public
jFrameCentrado ()

{/ * Call the superclass of JFrame
* which put a title to it. * /
super ( "Frame centered" )

/ * instantiate an object of Toolkit for
* general data on our computer. * /
Toolkit kit = . GetDefaultToolkit ();

/ * obtain the screen size in pixels * /
kit.getScreenSize dimensionPantalla = ();

/ * store the height and width, in pixels, of the screen.
* Because methods "getHeight" and "getWidth"
return a variable of type double *, we need to force
* this program to convert int variable, ie we will "cast." * /
height = (int ) dimensionPantalla.getHeight ();
width = (int ) dimensionPantalla.getWidth ();

/ * We tell Java that container will be the same JFrame * /
container = getContentPane ();

/ * Instantiate an object of class JPanel in this
* case is empty. * /
panel = new JPanel ();

/ * add the JPanel in the JFrame using the
* prebuilt container, placing the JPanel
* in the center of the JFrame using BorderLayout * /
container.add (panel, BorderLayout. CENTER);

/ * Since we have obtained the height and width, in pixels
* screen, define the size of the JFrame.
* In this case is the size of half the width
* screen for half the height of the screen. * /
this . SetSize (width / 2, height / 2);

/ * Now we place the JFrame exactly in the center of the
* screen is running the program * /
this . setLocation (width / 4, height / 4);

/ * We do resizable and visible * /
this . setResizable ( true);
this . SetVisible (true )

/ * Finally, we tell Java that we want our
* JFrame closes when clicking on demos close button (cross)
* will appear at the top right of it. * /
this . SetDefaultCloseOperation ( JFrame. EXIT_ON_CLOSE)
} / / End of constructor

/ / main method to start execution
our program public static void main (String [] args) {

/ * Simply create a class object
* jFrameCentrado, then the program will run
* constructor code. * /
jFrameCentrado new ();}

} / / End of class jFrameCentrado

When you compile and run the code above, we show a centered JFrame like figure following:

JFrame
This will be very useful in our subsequent program, as we enter within it with the help of JPanel created graphics created with JOGL . If you want to download the source code you can click on the following insertion in social class:

Download jFrameCentrado.java source