Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Transform Feedback

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2012
    Posts
    13

    Transform Feedback

    Hi,

    I am trying to use Transform Feedback with GL_VERSION (3.2.0 NVIDIA 195.36.31). When Im trying to load function pointer for example:
    Code :
    glGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC) glXGetProcAddress ((const GLubyte*)"glGenTransformFeedbacks");
    I have a 0 pointer in glGenTransformFeedbacks variable.
    What Im doing wrong, or what I forgot to do?

  2. #2
    Member Regular Contributor malexander's Avatar
    Join Date
    Aug 2009
    Location
    Ontario
    Posts
    305
    For transform feedback objects, you either need OpenGL 4.0 or GL_ARB_transform_feedback2 support. Driver 195.36.31 is a very old driver that only supports GL3.2 and it predates the transform feedback object specification. Try updating your driver to a more recent version, like the 306 series.

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2012
    Posts
    13
    Okay, another question.
    How can I find out, is my GTS 250 support this feature or not?

  4. #4
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    Only NVIDIA's DX11-class hardware supports ARB_transform_feedback2, so you can't use feedback objects. You can test these sorts of things by using the OpenGL extensions viewer.

  5. #5
    Member Regular Contributor malexander's Avatar
    Join Date
    Aug 2009
    Location
    Ontario
    Posts
    305
    Well, you can install a newer driver and check for the extension, or your can use a utility like the GL extensions viewer ( http://www.realtech-vr.com/glview/download.php) and check your card in the database (spoiler: I checked for the GTS250 and GL_ARB_transform_feedback2 is not there).

  6. #6
    Junior Member Newbie
    Join Date
    Nov 2012
    Posts
    13
    Thanks, Im install new driver and it works, as I can see. But now I have another question.
    Ho to devide the output stream from my shader to multiple buffers. I want the transform feedback feature to write vec3 vVerteces variables to one VBO and vec3 vNormals variables to another.

    I tried to unite my two VBOs in this form: [vertex normal vertex normal ....] but
    Code :
    glVertexPointer (3,GL_FLOAT,3*sizeof(GLfloat),0);
    glDrawArrays(GL_LINE_STRIP, 0,(m_Dimension + 1)*(m_Dimension - 1)*2);
    use normals as verteces too. Is this code wrong, or I don't understand what do 3rd param of glVertexPointer, or I make nistake in other place?

  7. #7
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,126
    Quote Originally Posted by ein_shved View Post
    Thanks, Im install new driver and it works, as I can see. But now I have another question.
    Ho to devide the output stream from my shader to multiple buffers. I want the transform feedback feature to write vec3 vVerteces variables to one VBO and vec3 vNormals variables to another.

    I tried to unite my two VBOs in this form: [vertex normal vertex normal ....] but ... use normals as verteces too. Is this code wrong, or I don't understand what do 3rd param of glVertexPointer...
    Yeah, the 3rd parameter (stride) is for exactly this case. It tells the driver/GPU how much to skip to get to the next vertex. If you provide 0, it assumes there isn't anything else in between values for this vertex attribute, and they're tightly packed one right after another.

    If you're writing vec3 positions and vec3 normals, change it to 6*sizeof(GLfloat).

  8. #8
    Junior Member Newbie
    Join Date
    Nov 2012
    Posts
    13
    Ok I already found out. Thanks)

  9. #9
    Junior Member Newbie
    Join Date
    Nov 2012
    Posts
    13
    Another question. I have 3 2D buffers, put into texture:
    Code :
    vector<GLfloat> vBuffers (m_Dimension * m_Dimension *3, m_Position.z); //m_Position != 0
    m_pPerfectWater->tBindingMutex.lock();
    glBindTexture(GL_TEXTURE_2D, idBuffers);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_Dimension,m_Dimension,
    		      0, GL_RGB,GL_FLOAT, &vBuffers[0]);

    Then Im trying to pass it to my shader programm

    Code :
    lcUniformPvCrNt = glGetUniformLocation(m_ShaderProgramHeights, "bPvCrNt");
    if ( lcUniformPvCrNt == -1 ) {
    	throw runtime_error ("Can not get location of uniform bPvCrNt");
    }
    //.........
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, idBuffers);
    glUniform1i(lcUniformPvCrNt, 0);

    Program is:
    Code :
    #version 330
     
    out vec3 Vertex;
    out vec3 Normal;
     
    layout (location = 0) in vec2 vIndex;
    uniform sampler2D bPvCrNt;
    uniform float xFactor;
    uniform float zFactor;
    uniform float omega;
    uniform vec3 m_Position;
     
    flat out ivec2 index;
     
    /*
     * x,r - next
     * y,g - current
     * z,b - previous
     */
     
    void calcNormal(void);
    void main(void) {
     
    	index = ivec2(vIndex);
    	Vertex.y = texture (bPvCrNt, index).g;
    	Vertex.x = m_Position.x + xFactor*vIndex.x;
    	Vertex.z = m_Position.z + zFactor*vIndex.y;
     
    	gl_Position = vec4(Vertex,1);
    	calcNormal();
    }

    but all Vertex.y coordinate has 0 value. What I'm doing wrong?

  10. #10
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,126
    Try creating your texture with a format of GL_RGB32F, not just GL_RGB. The latter probably defaults the component format to 8-bit unsigned (i.e. GL_RGB8).

Posting Permissions

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