Difference between revisions 1312 and 1313 on hiwikiversity

{{कंप्यूटर ग्राफिक्स -- 2013-2014 -- info.uvt.ro/पेज हैडर}}
== पूर्ण उदाहरण ==
दो उदाहरण टेम्पलेट्स यहां दिए गए हैं। एक ऑर्थोग्राफिक प्रोजेक्शन का उपयोग दृश्यों के लिए और एक पर्सपेक्टिव प्रोजेक्शन का उपयोग दृश्यों के लिए। उदाहरणों को भविष्य के जीओजीएल(JOGL) आधारित एप्लीकेशन के लिए टेम्पलेट्स के रूप में इस्तेमाल किया जा सकता हैं।

=== ऑर्थोग्राफिक प्रोजेक्शन उदाहरण ===

<source lang="java">
import javax.media.opengl.GL;
(contracted; show full)		
		// Initialize GLU. We'll need it for perspective and camera setup.
		this.glu = GLU.createGLU();

		// Setting the clear color -- the color which will be used to erase the canvas.
		gl.glClearColor(0, 0, 0, 0);
		
		// 
Selecting the modelview matrix.मॉडलव्यु मैट्रिक्स का चयन करना
		gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);

	}
	
	public void display(GLAutoDrawable canvas)
	{
		GL2 gl = canvas.getGL().getGL2();
		
		// Erasing the canvas -- filling it with the clear color.कैनवास मिटाकर - यह स्पष्ट रंग से भरना
		gl.glClear(GL.GL_COLOR_BUFFER_BIT);

		gl.glLoadIdentity();

		// Add your scene code here
		
		// Forcing the scene to be rendered.अपना स्क्रीन कोड यहां जोड़ें
		
		// रेन्डरिग करने के लिए स्क्रीन को मजबूर करना
		gl.glFlush();
	}
	
	public void reshape(GLAutoDrawable canvas, int left, int top, int width, int height)
	{
		GL2 gl = canvas.getGL().getGL2();
		
		// Selecting the viewport -- the display area -- to be the entire widget.
		gl.glViewport(0, 0, width, height);
		
		// Determining the width to height ratio of the widget.व्यूपोर्ट का चयन - डीसप्ल क्षेत्र - पूरे विजेट होने के लिए
		gl.glViewport(0, 0, width, height);
		
		// विजेट का चौड़ाई से ऊँचाई अनुपात निर्धारित करना
		double ratio = (double) width / (double) height;
		
		// Selecting the projection matrix.प्रोजेक्शन मैट्रिक्स का चयन करना
		gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
		
		gl.glLoadIdentity();
		
		glu.gluPerspective (38, ratio, 0.1, 100);

		// Selecting the modelview matrix.मॉडलव्यु मैट्रिक्स का चयन करना
		gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);		
	}
	
	public void displayChanged(GLAutoDrawable canvas, boolean modeChanged, boolean deviceChanged)
	{
		return;
	}

	@Override
	public void dispose(GLAutoDrawable arg0) {
		// TODO Auto-generated method stub
		
	}
}
</source>

{{कंप्यूटर ग्राफिक्स -- 2013-2014 -- info.uvt.ro/पेज फ़ुटर}}
		
	}
}
</source>

[[Category:HI]]
[[Category:कंप्यूटर ग्राफिक्स]]
[[Category:प्रोग्रामिंग उदाहरण]]