Results 1 to 3 of 3

Thread: Drawing Line in color and Mapping Texture in the same scene

  1. #1
    Junior Member
    Join Date
    Sep 2010
    Posts
    21

    Drawing Line in color and Mapping Texture in the same scene

    Hi,

    I encounter some difficulties on drawing in color and mapping texture. If I only draw line in different color or map texture to the rectangle, it is ok. However, when I combine these two into one scene; that's drawing in color and mapping texture in the same scene, it fails.

    I think the problem is in shader script. There is an attribute called "gl_FragColor" and I can set it to gl_FragColor = vec4(vColor.rgb * lightWeighting, vColor.a); to draw in color and set it to gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t)); to map texture.

    However, when I draw in color and map texture in the same scene, I fails to set this gl_FragColor.

    Can anyone help me to solve the problem? How to set the gl_FragColor correctly?

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

    Re: Drawing Line in color and Mapping Texture in the same sc

    You know you need two shaders - right? One for your lines and one for the polygons.

    In some of my applications, I have nearly as many shaders as I do textures! My present WebGL game uses 24 frag shaders and six vert shaders.

  3. #3
    Junior Member
    Join Date
    Sep 2010
    Posts
    21

    Re: Drawing Line in color and Mapping Texture in the same sc

    Yes, I duplicated the original sharder and shader-fs, shader-vs. Also, I have initialized two sharders. However, firefox show me the following message:
    UniformMatrix4fv: location: this uniform location doesn't correspond to the current program
    enable: invalid enum value 0xde1
    Uniformli: location: null object passed as argument
    UniformMatrix4fv: location: null object passed as argument

    I still don't know how to solve it. Do you have any ideas to solve it?

Similar Threads

  1. Scene drawing problems
    By z_z_z_z in forum OpenGL ES general technical discussions
    Replies: 0
    Last Post: 10-27-2010, 05:38 AM

Posting Permissions

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