Modify Program 4.1 to replace the cube with some other simple 3D shape of your own design.

Question:

Modify Program 4.1 to replace the cube with some other simple 3D shape of your own design. Be sure to properly specify the number of vertices in the glDrawArrays() command.

Program 4.1Java/JOGL Application import java.nio.*; import javax.swing.*; import java.lang.Math;import static com.jogamp.opengl.GL4.*; import com.jogamp.opengl.*; import com.jogamp.opengl.awt.GLCanvas;// allocate variables used in display() function, so that they won't need to be allocated during renderingpublic void init(GLAutoDrawable drawable) { GL4 gl= (GL4) GLContext.getCurrentGL(); rendering Program =public void display(GLAutoDrawable drawable) { GL4 gl = (GL4) GLContext.getCurrentGL();} // copy perspective and MV matrices to corresponding uniform variables gl.glUniformMatrix4fv(mvLoc, 1,private void setupVertices() { GL4 gl= (GL4) GLContext.getCurrentGL(); // 36 vertices of the 12 triangles} } -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f,

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Computer Graphics Programming In OpenGL With JAVA

ISBN: 9781683922193

2nd Edition

Authors: V. Scott Gordon PhD, John L. Clevenger PhD

Question Posted: