Difference between revisions 1362 and 1363 on hiwikiversity{{Computer graphics -- 2013-2014 -- info.uvt.ro/Page header}} === एंटीअलियासिंग=== * '' 'रंग ब्लेंडिंग' '' - <source lang="Java"> [...] public void init(GLAutoDrawable canvas) { (contracted; show full) [...] } </source> लिंक: * [http://www.felixgers.de/teaching/jogl/polygonPrimitives.html बहुभुज प्रिमिटिवस] === बहुभुज भरने और ओरिएंटेशन (Polygon filling and orientation) === <source lang="java"> public class MainFrame { [...] public void display(GLAutoDrawable canvas) { GL2 gl = canvas.getGL().getGL2(); [...] // Do not render front-faced polygons. gl.glCullFace(GL.GL_FRONT); // Culling must be enabled in order to work. gl.glEnable(GL.GL_CULL_FACE); gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); // Define vertices in clockwise order (back-faced) gl.glBegin(GL2.GL_POLYGON); gl.glColor3f(1.f, 0.f, 0.f); gl.glVertex2f(0.2f, 0.2f); gl.glColor3f(0.f, 1.f, 0.f); gl.glVertex2f(0.2f, 0.4f); gl.glColor3f(0.f, 0.f, 1.f); gl.glVertex2f(0.4f, 0.4f); gl.glColor3f(1.f, 1.f, 1.f); gl.glVertex2f(0.4f, 0.2f); gl.glEnd(); [...] } [...] } </source> <source lang="java"> public class MainFrame { [...] public void display(GLAutoDrawable canvas) { GL2 gl = canvas.getGL().getGL2(); [...] // Do not render back-faced polygons. gl.glCullFace(GL.GL_BACK); // Culling must be enabled in order to work. gl.glEnable(GL.GL_CULL_FACE); gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); // Define vertices in clockwise order (back-faced). gl.glBegin(GL2.GL_POLYGON); gl.glColor3f(1.f, 0.f, 0.f); gl.glVertex2f(0.2f, 0.2f); gl.glColor3f(0.f, 1.f, 0.f); gl.glVertex2f(0.2f, 0.4f); gl.glColor3f(0.f, 0.f, 1.f); gl.glVertex2f(0.4f, 0.4f); gl.glColor3f(1.f, 1.f, 1.f); gl.glVertex2f(0.4f, 0.2f); gl.glEnd(); [...] } [...] } </source> === बहुभुज स्टिपल (Polygon stipple)=== <source lang="java"> public class MainFrame { [...] byte mask[] = { (contracted; show full) gl.glDisable (GL2.GL_POLYGON_STIPPLE); [...] } [...] } </source> === बहुभुज नार्मल (Polygon normals)=== <source lang="java"> public class MainFrame { [...] public void display(GLAutoDrawable canvas) { GL2 gl = canvas.getGL().getGL2(); [...] // Do not render front-faced polygons. gl.glCullFace(GL.GL_FRONT); // Culling must be enabled in order to work. gl.glEnable(GL.GL_CULL_FACE); gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); // Define vertices in clockwise order (back-faced). gl.glBegin(GL2.GL_POLYGON); // Define normal for vertex 1 gl.glNormal3f(0.f, 0.f, 1.f); gl.glColor3f(1.f, 0.f, 0.f); gl.glVertex2f(0.2f, 0.2f); // Define normal for vertex 2 gl.glNormal3f(0.f, 0.f, 1.f); gl.glColor3f(0.f, 1.f, 0.f); gl.glVertex2f(0.2f, 0.4f); // Define normal for vertex 3 gl.glNormal3f(0.f, 0.f, 1.f); gl.glColor3f(0.f, 0.f, 1.f); gl.glVertex2f(0.4f, 0.4f); // Define normal for vertex 4 gl.glNormal3f(0.f, 0.f, 1.f); gl.glColor3f(1.f, 1.f, 1.f); gl.glVertex2f(0.4f, 0.2f); gl.glEnd(); [...] } [...] } </source> ==== बम्प मैपिंग प्राइमर (Bump mapping primer)==== === बिल्डिंग डिस्प्ले सूचियाँ (Building Display Lists)=== <source lang="java"> public class MainFrame { [...] int aCircle; public void init(GLAutoDrawable canvas) { [...] // Generate a unique ID for our list. aCircle = gl.glGenLists(1); // Generate the Display List gl.glNewList(aCircle, GL2.GL_COMPILE); drawCircle(gl, 0.5f, 0.5f, 0.4f); gl.glEndList(); } int aCircle; public void display(GLAutoDrawable canvas) { GL2 gl = canvas.getGL().getGL2(); [...] gl.glColor3f(1.0f, 1.0f, 1.0f); // Call the Display List i.e. call the commands stored in it. gl.glCallList(aCircle); } // Here we define the function for building a circle from line segments. private void drawCircle(GL gl, float xCenter, float yCenter, float radius) { double x,y, angle; gl.glBegin(GL2.GL_LINE_LOOP); for (int i=0; i<360; i++) { angle = Math.toRadians(i); x = radius * Math.cos(angle); y = radius * Math.sin(angle); gl.glVertex2d(xCenter + x, yCenter + y); } gl.glEnd(); } [...] } </source> == एपीआई (API) == * [http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/package-summary.html java.media.opengl]; ** [http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GL.html GL]; ** [http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GL.html#glPolygonMode(int,%20int) glPolygonMode(int, int)]; ** [http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GL.html#glRectd(double,%20double,%20double,%20double) glRect(double, double, double, double)]; ** [http://www.opengl.org/sdk/docs/man/xhtml/glPolygonStipple.xml glPolygonStipple(ByteBuffer)]; ** [http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GL.html#glCullFace(int) glCullFace(int)]; ** [http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GL.html#glFrontFace(int) glFrontFace(int)]; ** [http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GL.html#glNormal3f(float,%20float,%20float) glNormal3f(float, float, float)]; ** [http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GL.html#glGenLists(int) glGenLists(int)]; ** [http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GL.html#glNewList(int,%20int) glNewList(int, int)]; ** [http://download.java.net/media/jogl/builds/nightly/javadoc_public/javax/media/opengl/GL.html#glEndList() glEndList()]; == अभ्यास (Exercises)==⏎ ⏎ [[Category:HI]] All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://hi.wikiversity.org/w/index.php?diff=prev&oldid=1363.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|