Tag Info

Hot answers tagged

5

You can create two shaders and set the correct one from the application. Use a define to turn on/off features. GLSL both sides of the if-clause is executed Partially true. One core execute a lot of (64) with SIMD paradigms. Think about them as a vector of data and one instruction pointer (IP). In program with a branch the core can't use two IP for ...


4

The return value is computed as x*(1−a)+y*a. in other words if a is -1 then the result will be 2*x-y


4

Your graphic tool probably adds dithering (both Gimp and Photoshop does by default) which causes some pixels to be below or above the exact color value or you are using a compressed texture format which causes some pixels to have the wrong color value. There might be an option in your graphic tool or texture importer to disable dithering or compression. ...


3

Tearing is caused by the nature of step function. It outputs 0 or 1, causing pixel either to be rendered or not. If you try it with smoothstep function you will get smeared edge instead. You can fix tearing artifact by rendering a line on top of the gauge (shown in green). Render the line with the same texture attached, just without the step( code - only ...


2

In the OpenGL 3+ Core profile, the fixed function pipeline is deprecated or removed. However, all drivers by default give compatibility profiles which still have glVertex, glBegin and friends. You won't get as much performance out of these old functions (which is why they were removed), but they still work. You may use "OpenGL 3" with these old ways, but ...


2

Set the filterMode of your textures to FilterMode.Point. This will use nearest-neighbor interpolation, which will result in blocky rendering.


2

You can use a Transform Feedback Buffer to output from your vertex shader, your question is not very specific though so I can't be sure if this is truly what you want to do.


2

It's hard to make out exactly what you mean, but it sounds like you are dividing the vertex position by w as part of your computation in your vertex shader. This is incorrect, the division by w is actually done for you by the graphics processor. Consider the standard transformations here: (Original image from: ...


1

I think it's bad idea pass tile map to shader. Match better will be just create bitmap and initialize colors pixel-by-pixel. Create bitmap with same size as your tilemap has and then draw part of them. Create minimap bitmap: Bitmap miniMapBitmap = new Bitmap(worldWidth, worldHeight); for (int x = 0; x < worldWidth; x++) { for (int y = ...


1

Rendering is a very generic term which is basically can be defined as "creating an image", which can be, obviously, created in many ways. For example if you fill memory with color values (software rendering) it is also a "rendering". Shaders are completely other thing. They are related to how modern GPUs work. Say you want to render a triangle. You supply ...


1

Yes, you can configure your Lights to affect only certain objects, by using Layers. Assign your objects to a specific Layer (you can use an existing layer or define your custom one). Then, in Inspector pane, use Light's Culling Mask setting to set which Layers you want it to affect.


1

If I have understood your approach, instead of drawing let's say a grid on nxn quads, you are building a mesh from all that quads and trying to render it with a single draw call, right? Storing sprite colors into vertex color attributes it's fine, and that's a rather common approach. For what concern blending (and not considering gl_LastFragData), you ...


1

Re-psuedo-coded: //draw pillar LightMapTexture.Clear(0,0,0,0); //Transparent everywhere spriteBatch.Begin(Immediate, Alpha); spriteBatch.Draw(Texture, new Rectangle(PillarX, PillarY, Width, Height), Color.White); //Still transparent everywhere except texture; texture may be partially transparent also customBlendState = new BlendState(); ...


1

I solved the problem by binding the atomic counter to the GL_COPY_READ_BUFFER and using glCopyBufferSubData to copy the counter to a buffer bound to the GL_COPY_WRITE_BUFFER. Then I mapped the buffer with glMapBufferRange and set Gl_MAP_READ_BIT. This seemed to sync much better and for now it is sufficient for my use. I did not test glGetBufferSubdata, but ...



Only top voted, non community-wiki answers of a minimum length are eligible