article thumbnail

Does the shader have a built-in function to get the texture size?

Cocos

Assuming you’re using the latest versions of GLSL, you can get texture size with the “textureSize()” Example code here… uniform sampler2D myTexture; // Uniform for the texture void main() { //Note: if you don’t specify a LOD, glsl will default to 0 automatically ivec2 texSize = textureSize(myTexture, 0); // Get size of the texture at LOD 0 int width (..)

Texture 52
article thumbnail

Can't set texture for spriteframe

Cocos

first, I recommend you to follow the TS style when you are coding, that will make your code easy to read. from your code, I guess you want to load some text images and cache them to an array, then you use them to create the spriteFrames when needed. hello ,bro. for example, use let instead of var. the error comes out.

Texture 40
Insiders

Sign Up for our Newsletter

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Trending Sources

article thumbnail

Can't set texture for spriteframe

Cocos

i wrote a little code to load asset texture from resource. i’m using cocos creator 3.7.0 var tex = Array(25).fill(new

Texture 40
article thumbnail

Tutorial: Cocos Shader Series - Use a Noise Map to Make a Dissolve Texture

Cocos

x, I using this code but it not bring Property affect to shader Ok, this work if turn of Packable in main Sprite inspector Blockquote const sprite = this.getComponent(Sprite); const mat = sprite.customMaterial; mat.setProperty(‘dissolveThreshold’, 0.5); Version 3.6.x,

Shaders 98
article thumbnail

Error Code 0xc0000005 Modern Warfare 2: Quick Fixes

Game Errors

And when it comes to an immersive game such as CoD, error code 0xc0000005 Modern Warfare 2 usually means trouble is brewing not just on the battlefield but in the game itself. What is Error Code 0xc0000005 Modern Warfare 2? Error code 0xc0000005 MW 2 is bad news any way you look at it. Here’s why it happens.

Code 52
article thumbnail

Texture flushed when coming back from background

Cocos

The online line of code mentioned is already in the current version of 3.17.2. This is probably what is happening. But I see that the solution they propose is to close the app if the context is lost. But I do not see how they achieve it.

Texture 52
article thumbnail

Project Structure - Guide to Cocos Cyberpunk Source Code

Cocos

5、scene The cube textures produced by the Reflection Probe baking system will be automatically saved in a folder specific to each scene. The texture mapping of the Reflection Probe involves more than a simple environment cubemap mapping, it utilizes Projection Correction to ensure the reflection content matches the original.

Code 52