Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
WebGL Beginner's Guide

You're reading from   WebGL Beginner's Guide If you're a JavaScript developer who wants to take the plunge into 3D web development, this is the perfect primer. From a basic understanding of WebGL structure to creating realistic 3D scenes, everything you need is here.

Arrow left icon
Product type Paperback
Published in Jun 2012
Publisher Packt
ISBN-13 9781849691727
Length 376 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (18) Chapters Close

WebGL Beginner's Guide
Credits
About the Authors
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started with WebGL FREE CHAPTER 2. Rendering Geometry 3. Lights! 4. Camera 5. Action 6. Colors, Depth Testing, and Alpha Blending 7. Textures 8. Picking 9. Putting It All Together 10. Advanced Techniques Index

Time for action – trying different wrap modes


  1. Open the file ch7_Texture_Wrapping.html using your HTML5 Internet browser.

  2. The cube shown has texture coordinates that range from -1 to 2, which forces the texture wrapping mode to be used for everything but the center tile of the texture.

  3. Experiment with the controls along the bottom to see the effect that the different wrap modes have on the texture.

What just happened?

Let's look at each of the wrap modes and discuss how they work.

CLAMP_TO_EDGE

This wrap mode rounds any texture coordinates greater than 1 down to 1 and lower than 0 up to 0, "clamping" the values to the 0-1 range. Visually, this has the effect of repeating the border pixels of the texture indefinitely once the coordinates go out of the 0-1 range. Note that this is the only wrapping mode that is compatible with NPOT textures.

REPEAT

This is the default wrap mode, and the one that you'll probably use most often. In mathematical terms this wrap mode simply ignores the integer part...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime