Results 1 to 5 of 5

Thread: Is texture2D allowed in a *vertex* shader?

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    3

    Is texture2D allowed in a *vertex* shader?

    Are WebGL vertex shaders allowed to read textures?

  2. #2
    Senior Member
    Join Date
    May 2010
    Posts
    207

    Re: Is texture2D allowed in a *vertex* shader?

    Yes and no.

    I have certainly gotten vertex shader textures to work just fine on many different driver/browser/hardware/OS combinations.

    ...but...

    The WebGL specification says that you can query WebGL to see how many vertex textures are supported - and the answer can legally be (and often is) zero...in which case you don't have vertex textures and you have to figure another way around the problem.

    MUCH worse than that is that I have an older WinXP laptop with an nVidia 6100 GO chip in it which reports that one vertex texture is available...but when I use it, the driver seems to fall back to running the vertex shader in the CPU - which takes my frame rate down from 20Hz to about 1Hz!

    So if you want both portability and speed - you're kinda screwed right now.

    I wound up rewriting my code to avoid vertex textures altogether...but YMMV.

    -- Steve

  3. #3
    Junior Member
    Join Date
    Dec 2010
    Posts
    3

    Re: Is texture2D allowed in a *vertex* shader?

    Thanks for the response!

    The same shader worked on a desktop application (same hw/driver/os), so I knew that it was either a webgl or browser limitation. It turned out to be a bug with Chrome, as Firefox 4 worked perfectly. Filed a bug here: http://code.google.com/p/chromium/is...etail?id=65340

    Do you, by chance, know what gl call will return the number of vertex textures supported?

  4. #4
    Senior Member
    Join Date
    May 2010
    Posts
    207

    Re: Is texture2D allowed in a *vertex* shader?

    Code :
      n = gl.getParameter(MAX_VERTEX_TEXTURE_IMAGE_UNITS);

  5. #5
    Junior Member
    Join Date
    Dec 2010
    Posts
    3

    Re: Is texture2D allowed in a *vertex* shader?

    Thanks!

Similar Threads

  1. Passing a mat3 attribute to a Vertex Shader
    By Sergejack in forum Developers Coding:Beginner
    Replies: 5
    Last Post: 05-23-2012, 03:05 AM
  2. A Question about Vertex shader
    By Choisy in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 05-29-2005, 07:12 PM

Posting Permissions

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