New Apple Render to Vertex Buffer Sample

Luminary
Posts: 5,143
Joined: 2002.04
Post: #1
For generating those *really* high-poly meshes efficiently Smile

http://developer.apple.com/samplecode/PB...index.html
Quote this message in a reply
Jones
Unregistered
 
Post: #2
How in the name of all that is beautiful (like this demo) did they manage to get that plane of vertices to modulate so smoothly on my iBooks little 9550. Blink
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #3
Jones Wrote:How in the name of all that is beautiful (like this demo) did they manage to get that plane of vertices to modulate so smoothly on my iBooks little 9550. Blink

Same here. Except it worked smoothly on my 5200!
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #4
I am annoyed

Code:
NVIDIA GeForce2 MX OpenGL Engine 1.1 NVIDIA-1.4.18
----------------------------------
GL_EXT_framebuffer_object        0
GL_ARB_pixel_buffer_object       1
GL_ARB_vertex_buffer_object      1
GL_ARB_shader_objects            1
GL_ARB_shading_language_100      1
GL_ARB_vertex_shader             1
GL_ARB_fragment_shader           0
GL_ARB_texture_rectangle         1
GL_APPLE_float_pixels            0
----------------------------------
Required functionality not available on this renderer.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #5
Aww rats! Don't feel bad unknown, you aren't the only one left out in the cold:

Code:
Intel GMA 950 OpenGL Engine 1.2 APPLE-1.4.32
----------------------------------
GL_EXT_framebuffer_object        1
GL_ARB_pixel_buffer_object       1
GL_ARB_vertex_buffer_object      1
GL_ARB_shader_objects            1
GL_ARB_shading_language_100      1
GL_ARB_vertex_shader             1
GL_ARB_fragment_shader           1
GL_ARB_texture_rectangle         1
GL_APPLE_float_pixels            0
----------------------------------
Required functionality not available on this renderer.
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #6
The posted sample has a bug, it should run without APPLE_float_pixels.

Make this change:
Code:
// extension index
enum {
    EXT_framebuffer_object,
    ARB_pixel_buffer_object,
    ARB_vertex_buffer_object,
    ARB_shader_objects,
    ARB_shading_language_100,
    ARB_vertex_shader,            /* ADD THIS */
    ARB_fragment_shader,
    ARB_texture_rectangle,
    APPLE_float_pixels,
};

An updated sample will be posted soon.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #7
Yeah, that fixed it. Runs pretty smooth for all those polys, even on the GMA 950.
Quote this message in a reply
Member
Posts: 79
Joined: 2002.08
Post: #8
I'll admit I'm not up to speed on this extension. What can it be used for in real life games? What is the advantage over older methods?
If I understand it correctly the texture acts as a height map, sort of, but it contains the actual vertex data. Right?

I'm simply curious about the possibilities with this method.

KenD

CodeBlender Software - http://www.codeblender.com
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #9
This technique is good for generating geometry entirely on the GPU. The sample is showing the vertex array connected as tristrips (essentially a heightfield) but there is no constraint on the geometry you generate.

In particular, people have found this method useful for animating particle systems. See Building a Million Particle System and Nvidia's related example.

This also allows a hybrid of 2D image processing and 3D geometry, since any image filter you apply to the texture will affect the vertex array. For example, you can take live video feed and treat the luminance as height.
Quote this message in a reply
Member
Posts: 79
Joined: 2002.08
Post: #10
Interesting. I need to take a closer look at the particle stuff.

KenD

CodeBlender Software - http://www.codeblender.com
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #11
arekkusu Wrote:An updated sample will be posted soon.

Update is posted. Should work out-of-the-box now on everything that supports FBO.
Quote this message in a reply
Member
Posts: 86
Joined: 2005.01
Post: #12
Whoa, this looks really useful. I'll have to look at the code for it.

Newest game: Glow, a sci-fi RPG with lots of zombie bashing. Get it: OS X
Quote this message in a reply
Member
Posts: 320
Joined: 2003.06
Post: #13
Can I ask for a simple explanation of what is going on in this demo?

I can look at the GLSL and FBO setup stuff and other function calls etc. etc.... and given 30 minutes or so I can probably figure out why this is cool, and how I can use it.

However if anyone feels they already understand what is going on and could take the time to explain it, that would save me time and no doubt make this code more interesting and available to a wider audience.

I'm thankful for the post, and the code. It is useful to some, but a little explanation would make it more useful to more people.

Chopper, iSight Screensavers, DuckDuckDuck: http://majicjungle.com
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #14
In essence, what you do is use the fragment processor to generate lots of vertices, given a few -- for example, you could use it to heavily tessellate a bezier patch. The issue then is, how to use those generated vertices. This sample addresses that issue, keeping the generated vertices in VRAM all the way.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Render video (e.g. QuickTime) to buffer or texture? Ingemar 14 13,269 Jun 8, 2011 04:09 PM
Last Post: mdejong1024
  Sample Code Apple removed? SaxMan 12 6,583 Jan 17, 2009 05:26 PM
Last Post: AnotherJake
  Vertex buffer generation and rendering iphone eliscool 2 2,737 Dec 17, 2008 05:57 PM
Last Post: ThemsAllTook
  FBO sample code posted arekkusu 5 4,632 Sep 20, 2006 09:23 PM
Last Post: Frank C.
  stack overflow creating a vertex buffer? LongJumper 6 4,944 Jul 5, 2005 10:39 PM
Last Post: PowerMacX