Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: VBOs without the V.

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2008
    Location
    Sweden
    Posts
    4

    VBOs without the V.

    Hi,

    I've been playing around with VBOs a bit, and I've got a Cg vertex shader positioning the vertex based on other information than the vertex position (e.g. texture reads). However, it doesn't like it that I don't specify a glVertexPointer (it doesn't draw anything). I couldn't find any information about this, but I guess I must've overlooked something, do I have to specify a glVertexPointer?

    Thanks.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,052

    Re: VBOs without the V.

    Yes, without it the setup is incomplete and it won't work.

    Jan.
    GLIM - Immediate Mode Emulation for GL3

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2008
    Location
    Sweden
    Posts
    4

    Re: VBOs without the V.

    Interesting.. Why is that? When I read documentation for a bunch of stuff, there are usually defaults given for everything , I guess I just assumed x, y, z and w had the defaults 0, 0, 0 and 1 (just like s, t, r and q for texcoord), now that I look again, it appears only z and w have defaults (0 and 1).

    For now, I'm using the same buffer for texcoords and vertices could that pose a problem on some architectures? Of course, I could just scrap the texcoords and use the position in this case, but I mean generally.

    Thanks!

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Feb 2006
    Location
    Sweden
    Posts
    748

    Re: VBOs without the V.

    no, vertex data has no defaults, and if it did it would only be in immediate mode, but even then you actually have to pass vertex coordinates to render things, rendering the whole question about vertex position defaults moot.
    (z and w only have defaults if you use vec2 or vec3 data)

    Vertex position is by definition the very least thing you need to pass to the vertex shader, even if that data is just garbage or taken from another unrelated source.
    I suggest you use it if you can.

  5. #5
    Advanced Member Frequent Contributor
    Join Date
    May 2005
    Location
    Prague, Czech Republic
    Posts
    924

    Re: VBOs without the V.

    You do not need to use glVertexPointer provided that you have generic vertex attribute array (glVertexAttrib) bound (and enabled) to generic attribute 0. Those two things are required to be equivalent by the specification.

  6. #6
    Advanced Member Frequent Contributor _NK47's Avatar
    Join Date
    Mar 2008
    Posts
    574

    Re: VBOs without the V.

    also if you call glVertexPointer just once with valid data then this data will be used the whole time unless told otherwise. you simly specify the vertex stream here because different geometry has obviously different vertices.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •