Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Vertex array Help  (Read 755 times)
0 Members and 2 Guests are viewing this topic.
Offline shadejmg

JGO n00b
*

Posts: 28


Java Rocks!


« on: 2003-08-03 16:18:09 »

Hi all,

Ive been working through a copy of the "red book" trying to update my code... and i come to the topic of using arrays.. great they seem like a really good idea.. problem is the commands dont seem to map perfectly from the gl spec to jogl..  

Has anyone got a jogl example of defining a shape using an array  ?


Thanks,
J.

A thousand monkeys on a thousand computers .. typing away randomly .. eventually one will create a great java game! Smiley
Offline DavidYazel

Sr. Member
**

Posts: 265


Java games rock!


« Reply #1 on: 2003-08-03 19:42:57 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
            if (colors3f != null) {
                gl.glEnableClientState(gl.GL_COLOR_ARRAY);
                gl.glColorPointer(3, gl.GL_FLOAT, 0, colors3f);
            } else if (colors4f != null) {
                gl.glEnableClientState(gl.GL_COLOR_ARRAY);
                gl.glColorPointer(4, gl.GL_FLOAT, 0, colors4f);
            } else {
                gl.glDisableClientState(gl.GL_COLOR_ARRAY);
                gl.glColor3f(1,1,1);
            }

            if (normals != null) {
                gl.glEnableClientState(gl.GL_NORMAL_ARRAY);
                gl.glNormalPointer(gl.GL_FLOAT, 0, normals);
            } else {
                gl.glDisableClientState(gl.GL_NORMAL_ARRAY);
            }

            if (vectors != null) {
                gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
                gl.glVertexPointer(3, gl.GL_FLOAT, 0, vectors);
            }

            if (texCoords2D != null) {
                gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY);
                gl.glTexCoordPointer(2, gl.GL_FLOAT, 0, texCoords2D);
            } else {
                gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY);
            }

            if (texCoords3D != null) {
                gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY);
//                gl.glTexCoordPointer(3, gl.GL_FLOAT, 0, texCoords3D);
           }

            gl.glDrawArrays(mode, 0, numVertices);

David Yazel
Xith3D Project Founder
http://xith3d.dev.java.net

It may look complicated, but in the end it is just a bunch of triangles
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.053 seconds with 18 queries.