Tag Info

Hot answers tagged

17

I can't tell if that specific image you linked was painted that way originally or not, but the resulting effect looks similar to an edge detection filter. Edge detection post-processing is often done using a Sobel filter implementation. For example, as seen here (a CPU-side implementation). The effect can be achieved in shaders as well (here is an HLSL ...


10

I've always disliked that way of defining shaders (in a string). I prefer to do mine in a text file and read it in when loading. Defining it in a string is annoying for debugging and it just looks messy to me. It's just so much easier to be able to type it out and see it formatted like it should be, instead of inside a string. I also have a separate class ...


9

Yes, it is possible. However, it isn't particularly worthwhile. First, unless you have access to the NV_draw_buffers extension (as the name implies, it is NVIDIA-only. So unless you're running on Tegra, you don't have it), framebuffer objects under ES 2.0 can only render to one image at a time. So to generate your G-buffers, you will need to render your ...


9

What you'd need to do to "bend" an object is to apply some appropriate combination of translation/rotation/scaling to only some subset of the vertices of the object in question -- probably weighting that transformation accordingly. Doing this is a pleasant-looking fashion will necessitate using more vertices than may be otherwise strictly necessary to ...


7

For the actual math of warping, this can get very complicated, why don't you start here?. I'll now talk about how you can apply this, assuming you've already got the math for how you will do your deformations down. 2 ways: 1) Every frame, visit every vertex in the cylinder model and offset it in some way. 2) Offset the vertices in the vertex shader as ...


7

What you're trying to achieve is basically a subset of the topic of mesh deformation. But since you're a begginer, I'm afraid this type of information might be a bit too strange for now. I'll try to lay down the basic notions though. In order to do this you'll need two things: Your mesh needs to have enough vertices for you to transform. For instance if ...


7

To complete what Josh said, Convolution Matrix is what you want: Convolution in Gimp Another link What you probably are looking for: Convolution Kernels in OpenGL


6

USE GLES2 AndEngine is a little tricky to get configured properly the first time you try. I recommend installing the version stored at RealMayo's github, which is a stable version. That's a version of GLES2 and yes, it's definitely worthwhile to use GLES2 over GLES1. Many new features were added that make life easier, improve performance, and add great ...


5

OpenGL and OpenGL ES, despite the similar names, are two different specifications. They may have similarly named functions, but there will be semantic differences between what these functions do. And of course, there will be differences in what features they support. PBOs are not supported on ES (except for ES 3.0, which recently came out but isn't widely ...


5

If all you need to transform is the vertex positions, then I agree that there's no reason not to precompute the entire MVP matrix. If you need to transform things like normal vectors and tangent vectors as well, you'll need more matrices. Probably your normals and tangents should end up in world space, or perhaps view space, so you'll want to transform ...


5

See the paper in the GPU Gems series treating this subject: http://http.developer.nvidia.com/GPUGems/gpugems_ch01.html What you can do is to adapt that idea (Gerstner waves) and compute the normals for each of your rendered fragment. The way to do that would be to assign a water texture (without too much light information in it, since you're gonna compute ...


5

You are taking a 512x512 image and smooshing it into an area approximately 120x120 pixels. Thus, you should expect that each pixel is about the average of a 5x5 block. You're using linear texture filtering so that would be expected. It might be better to use unscaled images if you're going to reduce the resolution by such a large amount. You can control the ...


5

Shader (and thus material) management is a rather tricky problem you run into when your graphics system gets more complex and you notice hard coding every shader would lead into massive code duplication. Here's a few alternative ways to solve it: Small examples where there are only a couple of shaders tend to hard-code them as strings to avoid file ...


4

The book "Guide to Graphics Software Tools" uses JOGL to his examples. There are examples for shaders in GLSL, HLSL and Cg. Edited In http://www.davidcornette.com/glsl/download.html there are examples with source code. http://www.guyford.co.uk/index.php/forum/14-java-jogl/15-jogl-example-glsl-shader-setup has a bit of code.


4

Here are a few thoughts : for your "invisible" background, make sure that your texture has a power of two resolution, and lies in a "drawable-nodpi" resource folder the strange artifact may be caused by dithering (you can use glDisable(GL_DITHER) to prevent this) for your character, it's most likely a problem in your large texture where the pixels around ...


4

You need to normalise all base vectors. The purpose of the cross products is to get a direction, so there is no need to normalise before the cross product, but you need to do it afterwards. You can skip the step if you know the arguments were normalised and orthogonal to each other. The following: const vec_t f((centre-eye).normalised()), ...


4

Calling game and update logic when CADisplayLink fires is the correct way of doing things on iOS. Have you profiled your game to see what is taking a long time and interfering with a smooth frame rate? A nice way of keeping logic updates smooth and decoupled from rendering on iOS is to handle updates when CADisplayLink is called then signal another thread ...


4

The main problem is Fillrate. On mobile GPUs, your fill rate is low that you can't do Deferred shading in realtime at native resolution. On iPhone 4 & iPad 1, fillrate is just ridiculous. The only device IOS with good fillrate is iPad 2, but i doubt there is enough... On android, only Tegra devices have the GL_NV_draw_buffers to use MRT but fillrate is ...


4

It all starts here: thick enough to stun an ox and to steal a meme: "If you don't like a wall of text, you're gonna have a bad time." Then since you're concerned with OpenGL, a side trip down Route 666 one of the classic OpenGL books But if you want to short circuit understanding of a complete graphics pipeline and just want to focus on some math for the ...


4

There was a nice talk at GDC 2012 on GPU distance field ray-marching (and other topics): http://directtovideo.wordpress.com/2012/03/15/get-my-slides-from-gdc2012/ As far as performance goes, the latest (DX11-class) graphics cards execute shaders on SIMD units that run 32 (NVIDIA) or 64 (AMD) "threads" in lockstep. These groups are variously known as warps ...


4

There are the fixed function and programmable shader pipelines. This is much bigger than just lighting, chances are your learning a whole bunch of other outdated stuff. The following are some common functions that are now deprecated: glBegin(...) glEnd() glVertex* glNormal* glColor* glTextCoord* glMultiTexCoord* glLoadIdentity* ...


4

In general, you should not be using glDrawArrays at all. If your model has repeated vertices, you'll get a lot more bang for your buck performance-wise from an index list. There, optimized strips or even triangles will be able to use the pre and post-T&L vertex caches. This means less memory fetching and less vertex shader execution.


4

As user827992 said you'll probably need to create a particle system. This does not mean you need a physics library in any way, however. Spawn sparkles over the water of random size and placement between whatever specified thresholds you desire(just tinker with it till it looks purtty). Have them fade in and back out. You'll also need to control the rate at ...


4

Yeah, I would say go with a 4-vertex triangle stripped quad. If you are drawing large numbers of these triangle strips using the same color, and the same set of texture coordinates, you could do 1 of 2 things: 1) Send the 4 vertices for each object and store the color and texcoords in uniforms 2) "Hardware instancing"


4

Yes, it's typical to convert into triangles. When reading the mesh in, it's simple to convert a quad into a triangle. It will depend on the format you're exporting to. For example, the format I use, Blender will export all the vertices, then it will export index information for triangles and quads. So it's a simple matter of arranging the indices to take a ...


4

The Solution Hell yeah!!! I'm one happy chap now! :D OK, I finally manage to get Stencil working with texture :) (also learned a number of things along the way, e.g. we can check color.alpha and use discard as a way to remove transparent pixel and the glBlend(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) trick becomes obsolete) So the first thing I noticed I ...


4

If it's worth it or not depends entirely on your needs, the goal of the project and the resources available for the project vs what resources it will take to upgrade. However, simply based on what you've described, I would see no reason to upgrade. You've said the game you wrote still runs fine, so it sounds like there's nothing to fix. If there's no ...


4

It's not going to be easy. I don't know much about AndEngine, but I've developed some GLES 2 apps, and it is possible to run and test them inside an AVD (in the Android world, "Virtual Device", or AVD is the correct term, not "emulator"). Looking at the logcat, I can see that there is a first exception: 02-23 15:18:50.983: D/AndEngine(636): ...


4

Here's some guesses for you to experiment with: Batch count is mainly a CPU load optimization, and not a GPU one. Try measuring CPU performance instead, for example by adjusting the positions so everything get clipped off screen. I wouldn't be surprised if the driver realizes that each batch is actually pointing into a contiguous array and merges them all ...


3

I'm not a professional and my answer is not OpenGL-specific, so take things with a grain of salt, please. That said, what I did in my own little rendering framework was this: Everything that would qualify as a "GameObject" (in a strict OOP perception model) is called an entity. Entities are represented by just integer keys retrieved from an entity store. ...



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