Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [problem found] gldrawobject question  (Read 490 times)
0 Members and 1 Guest are viewing this topic.
Offline Therion__

Junior Member





« Posted 2008-04-03 18:02:18 »

hello Smiley

i found a simple tutorial


i like to use the  gldrawobject and seach for
the right strategie to use it..
my problem is first when declaring
ov (vertex) and ono(vertex) i can use it with
byte and int but not a float var.

i didnt google/find a simple demo for it..something
like a mini demo using gldrawobject for a quad
without hundrets of confusing things around

vertex     = 0,0,0, 100,0,0, 100,0,100, 0,0,100;
normal    = 0,1,0, 0,1,0, 0,1,0, 0,1,0;
indices   = 0,1,2 ,2,3,0;
color        = 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1; // ARGB(alpha)
textureuv  = 0.0,0.0, 1.0,0.0, 1.0,1.0, 0.0,1.0;
   
  gl.glTexCoordPointer   (2, GL.GL_FLOAT, 0, textureuv);
      gl.glNormalPointer     (GL.GL_FLOAT,0,normal);
      gl.glVertexPointer     (3, GL.GL_FLOAT, 0, vertex);
      gl.glColorPointer      (4, GL.GL_FLOAT, 0, color);
      gl.glDrawElements(GL.GL_QUADS, 4, GL.GL_UNSIGNED_INT, indices);
     ...




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  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
//this are some of my trys

IntBuffer oc = BufferUtil.newIntBuffer(8000);         // color          (ok)
IntBuffer ot = BufferUtil.newIntBuffer(8000);          // texture uv  // FloatBuffer is not working?!
IntBuffer ov = BufferUtil.newIntBuffer(8000);          //vertex         // FloatBuffer is not working?!
IntBuffer ono = BufferUtil.newIntBuffer(8000);       //normals   // FloatBuffer is not working?!
IntBuffer indices = BufferUtil.newIntBuffer(8000); // indices (ok)


//vertex example
float[] varray = new float[(3*3) * 3];
     int k = 0;
     for (int ii=-1;ii<2;ii++)
     {
     for (int i=-1;i<2;i++)
     {
     varray[k++] = i*40;
     varray[k++] = 20;
     varray[k++] = ii*40;
     }
     }

     ov.put(varray);
     ov.rewind();

.. with color..texture and normals the same
and



display...
...
// *** Layer 0
     texture[9].bind();
      gl.glTexCoordPointer   (2, GL.GL_FLOAT, 0, ot);
      gl.glNormalPointer     (GL.GL_FLOAT,0,ono);
      gl.glVertexPointer     (3, GL.GL_FLOAT, 0, ov);
      gl.glColorPointer      (4, GL.GL_FLOAT, 0, oc);
      gl.glDrawElements(GL.GL_QUADS, flachen[0]*4, GL.GL_UNSIGNED_INT, indices);
     
      gl.glDisableClientState (GL.GL_VERTEX_ARRAY);
      gl.glDisableClientState (GL.GL_COLOR_ARRAY);
      gl.glDisableClientState (GL.GL_VERTEX_ARRAY);
     
      gl.glInterleavedArrays( GL.GL_T2F_C4F_N3F_V3F, 0, ov );
      gl.glDisable( GL.GL_BLEND );
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (106 views)
2013-05-17 21:29:12

alaslipknot (114 views)
2013-05-16 21:24:48

gouessej (143 views)
2013-05-16 00:53:38

gouessej (139 views)
2013-05-16 00:17:58

theagentd (151 views)
2013-05-15 15:01:13

theagentd (135 views)
2013-05-15 15:00:54

StreetDoggy (179 views)
2013-05-14 15:56:26

kutucuk (202 views)
2013-05-12 17:10:36

kutucuk (203 views)
2013-05-12 15:36:09

UnluckyDevil (209 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.132 seconds with 21 queries.