Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7746923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:24:13+00:00 2026-06-01T10:24:13+00:00

check out the following test: http://binks.knobbits.org/webgl/texture3.html It’s a simple test of cube textures. It

  • 0

check out the following test:

http://binks.knobbits.org/webgl/texture3.html

It’s a simple test of cube textures. It also has a 2D texture in there for good measure.

I discovered that in some browsers (so far, chrome) The image is not displayed properly if I re-use the same texture unit for drawing the cube texture as for the 2D texture.

There is a checkbox at the bottom marked “Use separate texture units for the cube texture on the sphere and the 2D texture on the floor” that shows this.

Is this a bug in chrome or in my code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:24:14+00:00Added an answer on June 1, 2026 at 10:24 am

    I have ordered a bit the code of the drawing functions and now are working.

    Square:

    TexturedSquare.prototype.draw = function() {
        gl.bindBuffer(gl.ARRAY_BUFFER,this.v);
        gl.enableVertexAttribArray(gl.va_vertex);
        gl.enableVertexAttribArray(gl.va_normal);
        gl.enableVertexAttribArray(gl.va_tex1pos);
        gl.vertexAttribPointer(gl.va_vertex,4,gl.FLOAT,false,10*4,0);
        gl.vertexAttribPointer(gl.va_normal,4,gl.FLOAT,false,10*4,4*4);
        gl.vertexAttribPointer(gl.va_tex1pos,2,gl.FLOAT,false,10*4,4*8);
    
        gl.activeTexture(gl.TEXTURE0);
        gl.bindTexture(gl.TEXTURE_2D,this.texture);
        gl.bindTexture(gl.TEXTURE_CUBE_MAP,null);
    
        gl.uniform1i(shader.textures,1);
        gl.uniform1i(shader.texture1,0);
        gl.uniform1i(shader.cube_textures,0);
        gl.uniform1i(shader.cubeTexture0,1);
    
        gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,this.e);
        gl.drawElements(gl.TRIANGLES,this.l,gl.UNSIGNED_SHORT,0);
    
        gl.disableVertexAttribArray(gl.va_tex1pos);
    }
    

    Sphere:

    GLHTexturedSphere.prototype.draw = function() {
        gl.bindBuffer(gl.ARRAY_BUFFER,this.vbuf);
        gl.enableVertexAttribArray(gl.va_vertex);
        gl.enableVertexAttribArray(gl.va_normal);
        gl.enableVertexAttribArray(this.va_cubetex0pos);
        gl.vertexAttribPointer(gl.va_vertex,4,gl.FLOAT,false,8*4,0);
        gl.vertexAttribPointer(gl.va_normal,4,gl.FLOAT,false,8*4,4*4);
        gl.vertexAttribPointer(this.va_cubetex0pos,4,gl.FLOAT,false,8*4,4*4);
    
        gl.activeTexture(gl.TEXTURE0);
        gl.bindTexture(gl.TEXTURE_2D,null);
        gl.bindTexture(gl.TEXTURE_CUBE_MAP,this.texture);
    
        gl.uniform1i(shader.textures,0);
        gl.uniform1i(shader.texture1,1);
        gl.uniform1i(shader.cube_textures,1);
        gl.uniform1i(shader.cubeTexture0,0);
    
        gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,this.ebuf);
        gl.drawElements(gl.TRIANGLES,this.l,gl.UNSIGNED_SHORT,0);
    
        gl.disableVertexAttribArray(gl.va_cubetex0pos);
    }
    

    Both of them are using now TEXTURE0. Please check WebGL states and uniform values.

    Original code is a bit hard for me, sorry. But I think the problem is that texture1 and cubeTexture0 uniforms are been setted with the same value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please check out the following func and its output void main() { Distance d1;
Please check out my following code... public enum LogType { Debug, Info, Warn, Error,
Check out this test: [TestFixture] public class Quick_test { [Test] public void Test() {
Check out http://fube.ca in any browser but Firefox and you'll see that the cloud
Check out the following example. It shows that searching within a unicode string (nvarchar)
I just tried the following HTML : <input type='radio' checked='checked' name='test' id='r1' /> <input
I'm trying to download the following page: http://structureddata.wikispaces.com/Test wget without any option fails: wget
I am using 'git' to checkout chromium code by following this document: http://code.google.com/p/chromium/wiki/UsingGit And
Check out this jsbin . I have a form with a custom button that
Check out this demo by FaTaL. It is explained in his blog that he

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.