Results 1 to 1 of 1

Thread: QGLShaderprogram, multiple textures

  1. #1
    Join Date
    Apr 2011
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default QGLShaderprogram, multiple textures

    Hello, I would like to hand in two textures to the QGLSP.

    Qt Code:
    1. glBindTexture(GL_TEXTURE_2D,fbo_render->texture() );
    2. edgeShader->setUniformValue("color_texture",0);
    3. glBindTexture(GL_TEXTURE_2D, fbo_pick->texture());
    4. edgeShader->setUniformValue("pick_texture",0);
    To copy to clipboard, switch view to plain text mode 

    Both textures are fine and can displayed seperately without problems.

    My Fragmentshader:

    Qt Code:
    1. uniform sampler2D color_texture;
    2. uniform sampler2D pick_texture;
    3.  
    4. void main() {
    5. // Set the output color of our current pixel
    6. gl_FragColor = texture2D(color_texture, gl_TexCoord[0].st);
    7. }
    To copy to clipboard, switch view to plain text mode 

    For a start I would like to access the textures in the shader seperately.

    Unfortunately I can only access the last bound texture.

    glActiveTexture wont work, due to some issues with glew. Unfortunately again, I dont have time to fix my glew problems.


    My question is: how can I use the qt stuff to sucessfully adress both bound textures simultaneously.


    I will be very gratefull for hints leading to the solution of my predicament.
    Last edited by high_flyer; 23rd May 2011 at 10:36. Reason: code tags

Similar Threads

  1. Replies: 3
    Last Post: 28th April 2011, 14:34
  2. Multiple glWidgets with Lists and Textures.
    By Gadaviel in forum Qt Programming
    Replies: 1
    Last Post: 12th May 2010, 19:23
  3. QGraphicsScene and GL textures
    By bence.frenyo in forum Qt Programming
    Replies: 2
    Last Post: 22nd July 2008, 13:26
  4. Textures + Multiple QGLWidgets
    By KShots in forum Qt Programming
    Replies: 8
    Last Post: 19th October 2007, 21:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.