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  
  ARB_vertex_buffer_object and Vertex Arrays  (Read 1696 times)
0 Members and 2 Guests are viewing this topic.
Offline Markus_Persson

JGO Kernel
*****

Posts: 2092
Medals: 10


Mojang Specifications


« on: 2003-07-16 20:48:06 »

http://oss.sgi.com/projects/ogl-sample/registry/ARB/vertex_buffer_object.txt

BindBufferARB changes the behavior of the various Vertex Array pointer methods to take an offset inside the current buffer instead of a memory pointer to a buffer as the last argument.
Unfortunately, jogl defines glVertexPointer as glVertexPointer(int, int, int, Buffer), so it's kinda hard for me to send an int there.

Is this a "bug" (or lacking feature, rather) in jogl, or am I doing something wrong?

Play Minecraft!
Offline Markus_Persson

JGO Kernel
*****

Posts: 2092
Medals: 10


Mojang Specifications


« Reply #1 on: 2003-07-16 20:50:27 »

I tried to send in an bytebuffer containing only an 0, by the way, but it still seemed to use the memory address of the buffer as the offset inside the buffer.

Play Minecraft!
Offline DavidYazel

Sr. Member
**

Posts: 265


Java games rock!


« Reply #2 on: 2003-07-16 20:56:57 »

One thing you can try is to use slice() to create a new buffer which is really pointing into the other buffer.  I have not done it, but I think it would work.

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
Games published by our own members! Go get 'em!
Offline Markus_Persson

JGO Kernel
*****

Posts: 2092
Medals: 10


Mojang Specifications


« Reply #3 on: 2003-07-16 21:07:29 »

Oh. No, that's not what I need. Smiley
*tries to be clearer*

When using vertex arrays like normal, that would probably work, but enabling ARB_vertex_buffer_object changes the behavior of the vertex array methods.
Instead of passing a pointer, you pass an offset.
So usually, you'd want to pass 0 to start from the beginning of the buffer.
That offset is used to offset the data of the vertex buffer, which resides on the video card memory.
(not to be confused with a java.nio.Buffer)

See the example way down at the bottom of the specification of ARB_vertex_buffer_object to see what I'm talking about.

Play Minecraft!
Offline DavidYazel

Sr. Member
**

Posts: 265


Java games rock!


« Reply #4 on: 2003-07-16 21:45:54 »

Got it... yep sounds like the API needs to be expanded a bit to cover that call.

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
Offline Ken Russell

JGO Kernel
*****

Posts: 3446
Medals: 3


Java games rock!


« Reply #5 on: 2003-07-18 02:13:07 »

We haven't thought through the ARB_vertex_buffer_object support yet and it will almost certainly not work in its current form. The primary issue is that the allocation of the vertex buffer object is separated from the fetching of its base pointer (unlike NVidia's wgl/glXAllocateMemoryNV call), so in order to figure out the capacity of the returned buffer from glMapBufferARB we need the result from another, earlier API call. This means that some handwritten bookkeeping will be needed. It's definitely on the list of things to do (which I should solidify and put up in HTML form in a shared location) but if you or anyone else wants to work on this please feel free; I'm more than happy to assist.
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.075 seconds with 20 queries.