Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
chips
Dec 25, 2004
Mein Führer! I can walk!

Vinlaen posted:

So you're saying to destruct the active terrain tile texture (which is on the video card) and then copy it back to system memory?

I'm not quite sure what your idea of how things work is, but you don't need a 1920x1200 "texture", that's the framebuffer. Whenever you play a game at 1920x1200 resolution, the graphics card has allocated one or more framebuffers, with a certain bit depth per pixel (often RGB, plus depth and so on). When you render a triangle with a texture on it, the graphics card transforms the triangle vertices into screen space (your 19200x1200 window) and then converts it to pixels, then the pixels are processed and textured appropriately.

Don't worry about needing one to one correspondence of textures, the video card blends textures when you're too close, and you can apply distance dependant detail textures that givec more detail when you're close up to something. Basically no 3D game has 1:1 texel to pixel relation.

Terrain destruction is something that happens on the CPU-side of things, where you store your grid of vertices that make up your terrain, you can shift these up and down depending on the destroyed terrain - then you transfer the updated terrain across to the card in a vertex buffer or suchlike. You could implement displacement in a vertex shader I suppose - but it's nothing to do with textures (other than maybe adding some texture splats/decals to simulate the damaged terrain surface)

HauntedRobot posted:

Is there an easy way to render the contents of a block of memory to a texture in OpenGL as if it was a traditional framebuffer? This is for a different project, but I have a 256x192 block of memory where each byte is a palette indexed colour, which sadly I can't do anything with the structure of as it's out of my control.

What do you mean "render the contents of a block of memory to a texture"? Do you mean copy the contents into a texture for use on the graphics card? You could just make a single channel texture out of it, opengl doesn't mind that it isn't really a texture - just be careful for interpolation when you're using it on the card. If you want the colours to be correct, I'd assume you'd need to self-process the texture first, or use one of the indexed colour functions in OpenGL (I seem to remember that there are some)

chips fucked around with this message at 21:02 on Mar 6, 2008

Adbot
ADBOT LOVES YOU

chips
Dec 25, 2004
Mein Führer! I can walk!
Oh I see, sorry. I'd still agree that mesh deformation is probably the best route, perhaps even a method similar to Marching Cubes but in 2D. Or you could use alpha-testing to give it pixel-level accuracy by anti-aliasing, similar to the method use in TF2 for high-resolution GUI elements - and it wouldn't have to be full screen resolution.

chips
Dec 25, 2004
Mein Führer! I can walk!

guenter posted:

I was wondering how to deal with ground collision and jumping in a 2d platformer. My first approach, just to get something working, was to set a flag when the character was involved in a collision and the normal was in a vaguely up direction. When you jump, I clear the flag.

It worked alright enough with the exception that both physics and the character were both depending on this flag and, worse, that if you run off the edge of a platform you can jump in midair since you're still considered to be on the ground.

How should this be handled? I was thinking of having physics bodies store a list of contacts they were involved in on the last update and querying that but maybe I'm overlooking a better solution.

Can't you just clear the collision flag every frame? So if, as Steve Montago says, you're continiously colliding with the ground, you can jump only if you're standing on a surface. I don't think there would be a problem with that, since you'll always be stationary and standing on the surface in the very next frame - depends how your collision system works in restoring the object I suppose. Taking the raycasting approach would fix that, though.

chips
Dec 25, 2004
Mein Führer! I can walk!

huge sesh posted:

Can anyone help me with this OpenGL question? I'm trying to render a spherical billboard for characters in a game such that they don't get distorted by the camera angle. The catch is that making the billboards perpendicular to the camera angle makes them clip into objects around them in ways I don't want--I want them to get occluded based on a quad that stands upright in object space. I've attached a scrappy illustration of the problem and what I want. I'm targeting iPhone OpenGL ES 1.1, so I don't have access to shaders.



Could you project the texture onto your upright quad from the camera perspective? The only other way I can think of doing it is to turn off depth testing in OpenGL for that quad, but that will mess up if your scene isn't depth ordered.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply