New answers tagged

0

In glsl, the texture function returns a vec4, thus you provide too much arguments to the vec4. It should be color = texture(sampler, texCoord); To avoid issues like this, always print out what glGetError returns. Second problem: Guess what GL.ShaderSource takes in as arguments. A shader, and you provided a shader program to it.


-2

Line 5 and 6 of LoadShaderProgram() contain a copy/paste error. GL.ShaderSource(program, VSSource); GL.ShaderSource(program, FSSource); Should be instead: GL.ShaderSource(program, VSSource); GL.ShaderSource(program, FSSource);


3

It looks like the issue is that you are doing non uniform scaling (different scale on x and y axis) and using nearest neighbour texture sampling. If you switch to using uniform scaling and/or bilinear texture sampling (or better, like bicubic) the problem should go away.


0

I would do both. I would make separate arms, legs, body, and head classes and keep track of them all within a player class. This way, in your Game1 class and other classes, the player is treated as ine object, but within the class, the body parts are treated separately. Hope this helps!


0

First things first: You are free to call the ContentManager at any point in your game cycle (you're not restricted to the use the LoadContent() method created in the main class). This doesn't solve your memory problem though, so on to part two: If you run into memory issues because you have too much content loaded at the same time, you should only load the ...


0

I wasn't sure if there was a name for the technique, but I was corrected, (Thank you, DMGregory) and a common name for the technique would be having a "specular mask", where a colour channel of a texture "masks" or controls the intensity of the specular reflection. This is demonstrated below in this code which is actually an excerpt from the code of the ...


0

So the answer seems a lot easier than I expected, if I'm doing it right at the moment(?). I simply Load the content needed for all "Worlds" in the beginning of the game (in the Protected Overrides Sub LoadContent()) and then Dispose() and Load.Content() depending on what World is loaded later (in any Sub I choose): TextureName = Content.Load(Of ...


0

Yeah, a simple for loop will suffice for this. for (int i = 0; i > Hearts; i++) { int col = i % 9; int row = Mathf.Floor(i / 9f); GUI.DrawTexture(new Rect(10 + (74*col), 10 + (74*row), 64, 64), heartTexture, ScaleMode.ScaleToFit); } Also, note the names / values may be changed, if your hearts are smaller, or you'd like less space in between ...


3

Release does not return an HRESULT, it returns a ULONG. That ULONG is the new reference count on the object (after the release). hr == S_FALSE in your code because Release is returning 1 (which is what S_FALSE is defined as), which means there's one pending reference count to the object after you release it (that's not necessarily a problem, it could be an ...


0

You don't render a skybox as a "cubemap". You often render objects using a environment cubemap that matches the skybox, but the skybox itself is just rendered with a set of 2D textures. On Direct3D Feature Level 10.0 or later hardware, you can use a Texture2D array with 6 faces as both a cubemap and with another shader as six individual faces. The WIC ...


0

The 5th "stride" argument in all of your 4 glVertexAttribPointer calls is specified as 3 * sizeof(GLfloat), while in your case it should be 0, as you are using separate buffers per vertex attribute (see https://www.opengl.org/sdk/docs/man/html/glVertexAttribPointer.xhtml). That argument is non-zero for cases when you interleave those attributes in a single ...


1

This depends very much on how you are displaying the pin status to the user. If you are using the UI features it could be as easy as setting up a prefab using a game object with an Image Component and a custom script that controls the Image component's image based on the status of an associated pin. In a 2D Game you can create a prefab with a sprite for ...


1

Thanks for your patience, the particle solution below took a bit more fiddling to get working than I'd counted on. ;) Note that in all of these methods (and the one proposed by lvictorino) the texture is shared - what you're asking for doesn't require duplicating the texture in memory. What can pile up are draw calls, so let's look at how we can minimize ...


0

Your quads may be game objects and have a MeshRenderer. MeshRenderer components give you access to the renderer Material. And the Material gives you access to the texture via SetTexture. So once you have Instantiated your new object you can set your Texture doing: MeshRenderer object_renderer = my_new_game_object.GetComponent<MeshRenderer>(); ...


0

Fastest solution is to change your comparison to account for JPG compression artifacts (that slightly alter pixels colors): if (overlay.r <= 0.02 && overlay.g <= 0.02 && overlay.b <= 0.02) Right solution would be to add Alpha to your image and use it for transparency.


1

Take a look on this: https://issuetracker.unity3d.com/issues/tree-creator-bark-material-is-much-lighter-in-deferred-rendering-path-than-in-forward-rendering-path They should fix that issue in few... months? weeks?



Top 50 recent answers are included