Learn the basics of how to use Blender to create a 3D object of your own. To

Question:

Learn the basics of how to use Blender to create a 3D object of your own. To make full use of Blender with your OpenGL applications, you’ll want to learn how to use Blender’s UV-unwrapping tools to generate texture coordinates and an associated texture image. You can then export your object as an OBJ file and load it using the code from Program 6.3.

Program 6.3ImportedModel class public class ImportedModel { private Vector3f[] vertices; private Vector2f[] texCoords;for(int i=0; iModellmporter nested class private class Modellmporter { // values as read in from OBJ file private ArrayList// values stored for later use as vertex attributes private ArrayList triangle Verts = new ArrayList ();{ for(Strings: (line.substring(3)).split("")) } } else if(line.startsWith("f"))} normals.add(normVals.get(normRef)); normals.add(normVals.get(normRef+1));// accessors for retrieving the number of vertices, the vertices themselves, // and the corresponding textureUsing the Model Importer myModel = new Imported Model("shuttle.obj"); private void setupVertices() { GL4 gl=for (int i=0; i} // VBO for vertex locations gl.glBindBuffer(GL_ARRAY_BUFFER, vbo[0]); FloatBuffer vertBuf =in display(): gl.glDrawArrays(GL_TRIANGLES, 0, myModel.getNumVertices());

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: