Tag Info

New answers tagged

3

Your premise is incorrect. If you send a bunch of transparent polygons (or anything else) to the GPU to be rendered, the GPU will draw them in precisely the order you defined them -- it will not sort them at all. The way you control which polygons get rendered first is to send them to the GPU first; either by putting them first in the index buffer (if ...


1

The order in which they are drawn is deterministic. The GPU will not randomly decide which polygon to draw. The order is controlled by the order you supply the draw calls in and the order of the indices in the index buffer. Often you will want to manually sort your polygons and then send them as a batch to the GPU. I do not know which framework you're using ...


2

Yes it seems you do want a post processing effect. First Render your scene normally. Then sample this texture in your next Render technique but use a set alpha. something along the lines of: in vec2 Texcoord; out vec4 outColour; uniform sampler2D tex; void main() { outColour = texture( tex, Texcoord ); outColour += vec4( outcolour.rgb, 0.5f ); } ...


1

This is possible using GL 1.x and here's how. So as you've found using vertex colors, a smooth transition is where it blends the two colors. This is a called a linear interpolation, or a "lerp" for short. It can be generalized to any dimension by operating on the elements of the vector individually and indeed colors are treated like a lerp in 3D -- blend R1 ...


4

JPG is lossy. Don't use that for sprites -- you will end up with nasty artifacts that will look bad. There's a couple reasons you might want to use colur-keying, but they're a bit lost in todays hardware. Taking a quick look at color key advantages: Pros They use up less disk space -- there is no alpha channel to store By consequence, their memory foot ...


1

OpenGL provides blending function. glEnable(GL_BLEND);// you enable blending function glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // then you will set flags to achieve desired blending effect. For further different usage, read http://www.opengl.org/sdk/docs/man/html/glBlendFunc.xhtml However for your particular case, the desired effect, ...


1

I do not believe that this is directly possible using OpenGL 1.x. If you're using OpenGL 1.3, you can use Texture Combiners to merge two textures together in various ways, and you can even specify different sets of texture coordinates for the two textures, but I do not believe it's possible to set different opacities for the different textures per vertex ...


0

The code you are using to switch between 2D and 3D seems OK. Your problem should be on the GL states. Usually, when rendering sprites and 2D GUI, I use the following states: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); Then when switching back to 3D, I normally set: ...



Top 50 recent answers are included