Difference between revisions 1367 and 1368 on hiwikiversity{{कंप्यूटर ग्राफिक्स -- 2013-2014 -- info.uvt.ro/पेज हैडर}} === एंटीअलियासिंग (Antialising) === * '''रंग ब्लेंडिंग (Color Blending)''' - <source lang="Java"> [...] public void init(GLAutoDrawable canvas) { [...] // Activate the GL_LINE_SMOOTH state variable. Other options include // GL_POINT_SMOOTH and GL_POLYGON_SMOOTH. gl.glEnable(GL.GL_LINE_SMOOTH); // Activate the GL_BLEND state variable. Means activating blending. gl.glEnable(GL.GL_BLEND); // Set the blend function. For antialiasing it is set to GL_SRC_ALPHA for the source // and GL_ONE_MINUS_SRC_ALPHA for the destination pixel. gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); // Control GL_LINE_SMOOTH_HINT by applying the GL_DONT_CARE behavior. // Other behaviours include GL_FASTEST or GL_NICEST. gl.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_DONT_CARE); // Uncomment the following two lines in case of polygon antialiasing //gl.glEnable(GL.GL_POLYGON_SMOOTH); //glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); } public void display(GLAutoDrawable canvas) { GL2 gl = canvas.getGL().getGL2(); [...] gl.glLineWidth(1.5f); gl.glColor3f(1.f, 0.f, 0.f); gl.glBegin(GL2.GL_LINES); gl.glVertex2f(0.2f, 0.2f); gl.glVertex2f(0.9f, 0.9f); gl.glEnd(); gl.glColor3f(0.f, 1.f, 0.f); gl.glBegin(GL2.GL_LINES); gl.glVertex2f(0.9f, 0.2f); gl.glVertex2f(0.2f, 0.9f); gl.glEnd(); [...] } [...] </source> === बहुभुज(Polygons) === ==== वैधता(Validity) ==== ==== बहुभुज का निर्माण ब्लॉक (Building blocks of polyons) ==== ==== आयामी (Dimensionality) ==== ==== प्रिमिटिवस (Primitives) ==== <source lang="java"> public class MainFrame { [...] public void display(GLAutoDrawable canvas) { GL2 gl = canvas.getGL().getGL2(); [...] 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> लिंक: * [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[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, (byte)0x80, 0x01, (byte)0xC0, 0x06, (byte)0xC0, 0x03, 0x60, 0x04, 0x60, 0x06, 0x20, 0x04, 0x30, 0x0C, 0x20, 0x04, 0x18, 0x18, 0x20, 0x04, 0x0C, 0x30, 0x20, 0x04, 0x06, 0x60, 0x20, 0x44, 0x03, (byte)0xC0, 0x22, 0x44, 0x01, (byte)0x80, 0x22, 0x44, 0x01, (byte)0x80, 0x22, 0x44, 0x01, (byte)0x80, 0x22, 0x44, 0x01, (byte)0x80, 0x22, 0x44, 0x01, (byte)0x80, 0x22, 0x44, 0x01, (byte)0x80, 0x22, 0x66, 0x01, (byte)0x80, 0x66, 0x33, 0x01, (byte)0x80, (byte)0xCC, 0x19, (byte)0x81, (byte)0x81, (byte)0x98, 0x0C, (byte)0xC1, (byte)0x83, 0x30, 0x07, (byte)0xe1, (byte)0x87, (byte)0xe0, 0x03, 0x3f, (byte)0xfc, (byte)0xc0, 0x03, 0x31, (byte)0x8c, (byte)0xc0, 0x03, 0x33, (byte)0xcc, (byte)0xc0, 0x06, 0x64, 0x26, 0x60, 0x0c, (byte)0xcc, 0x33, 0x30, 0x18, (byte)0xcc, 0x33, 0x18, 0x10, (byte)0xc4, 0x23, 0x08, 0x10, 0x63, (byte)0xC6, 0x08, 0x10, 0x30, 0x0c, 0x08, 0x10, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00, 0x08}; public void display(GLAutoDrawable canvas) { GL2 gl = canvas.getGL().getGL2(); gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2.GL_FILL); // Set the polygon mask. gl.glPolygonStipple (mask, 0); // Enable polygon stipple. gl.glEnable (GL2.GL_POLYGON_STIPPLE); // 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(); // Disable polygon stipple. 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) == {{कंप्यूटर ग्राफिक्स -- 2013-2014 -- info.uvt.ro/पेज फ़ुटर}} [[Category:HI]] [[Category:कंप्यूटर ग्राफिक्स]]⏎ [[Category:ग्राफिक्स]] 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=1368.
![]() ![]() 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.
|