









Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Prepara tus exámenes
Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Prepara tus exámenes con los documentos que comparten otros estudiantes como tú en Docsity
Encuentra los documentos específicos para los exámenes de tu universidad
Estudia con lecciones y exámenes resueltos basados en los programas académicos de las mejores universidades
Responde a preguntas de exámenes reales y pon a prueba tu preparación
Consigue puntos base para descargar
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Comunidad
Pide ayuda a la comunidad y resuelve tus dudas de estudio
Ebooks gratuitos
Descarga nuestras guías gratuitas sobre técnicas de estudio, métodos para controlar la ansiedad y consejos para la tesis preparadas por los tutores de Docsity
ACtividad sobre programador en nettbens
Tipo: Apuntes
1 / 16
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!










frame.setLocationRelativeTo(null); frame.setVisible(true); animator.start(); } public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); System.err.println("INIT GL IS: " + gl.getClass().getName()); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { GL gl = drawable.getGL(); GLU glu = new GLU(); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); glu.gluOrtho2D(0.0, 640.0, 0.0, 480.0); } public void display(GLAutoDrawable drawable) { GL gl = drawable.getGL(); gl.glClear(GL.GL_COLOR_BUFFER_BIT); gl.glColor3f(1,1,1); double x, y; double xmin, xmax, ymin, ymax; double xpmin, xpmax, ypmin, ypmax;
double xpc, ypc; double xp, yp; double deltaX, deltaY; xpmax = 640; xpmin = 0; ypmax = 480; ypmin = 0; xpc = (xpmin + xpmax)/2; ypc = (ypmin + ypmax)/2; gl.glBegin(GL.GL_LINES); gl.glVertex2d(xpmin, ypc); gl.glVertex2d(xpmax, ypc); gl.glVertex2d(xpc, ypmin); gl.glVertex2d(xpc, ypmax); gl.glEnd(); gl.glColor3f(1, 1, 0); xmin = -10; xmax = 10; ymin = -10; ymax = 10; deltaX = xpc/xmax; deltaY = ypc/ymax; x = xmin; while (x<=xmax) { y=x*x; //y = Math.exp(x); //y = Math.cos(x); xp = xpc + x * deltaX; yp = ypc + y * deltaY; gl.glBegin(GL.GL_POINTS); gl.glVertex2d(xp, yp); gl.glEnd(); x = x + 1.0/deltaX; } gl.glFlush(); }
import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.media.opengl.GL; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCanvas; import javax.media.opengl.GLEventListener; import javax.media.opengl.glu.GLU; public class GraficaPolar implements GLEventListener { public static void main(String[] args) { Frame frame = new Frame("GraficaPolar"); GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new GraficaPolar()); frame.add(canvas); frame.setSize(640, 480); final Animator animator = new Animator(canvas); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { new Thread(new Runnable() { public void run() { animator.stop(); System.exit(0); } }).start(); } });
frame.setLocationRelativeTo(null); frame.setVisible(true); animator.start(); } public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); System.err.println("INIT GL IS: " + gl.getClass().getName()); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { GL gl = drawable.getGL(); GLU glu = new GLU(); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); glu.gluOrtho2D(0.0, 640.0, 0.0, 480.0); } public void display(GLAutoDrawable drawable) { GL gl = drawable.getGL(); gl.glClear(GL.GL_COLOR_BUFFER_BIT); gl.glColor3f(1,1,1); double x, y, a, pi, r, theta, i, b; double xmin, xmax, ymin, ymax; double xpmin, xpmax, ypmin, ypmax; double xpc, ypc; double xp, yp; double deltaX, deltaY; xpmax = 640;
gl.glFlush(); } public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { } }