Jump to content

texImage2D BABYLON equivalent


Pryme8
 Share

Recommended Posts

So when I create or bind a texture, how do I ensure it is equivalent to:

  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);

specifically I want to make sure gl.UNSIGNED_BYTE is being used and gl.RGBA.

Is this automatically handled when you create the texture?  What are the defaults if so.
 

 

Link to comment
Share on other sites

gl.RGBA is used when the texture CAN have an alpha channel (for example png of gif). UNSINGNED_BYTE is used automatically (apart from Render Targets, which are a bit different). You can see the code here - https://github.com/BabylonJS/Babylon.js/blob/master/src/Engine/babylon.engine.ts#L2996 to understand how things are being set.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...