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
zzz
May 10, 2008

shodanjr_gr posted:

I dont want to mute certain channels, i want to mute whole buffers against clearing (for instance my FBO has 4 color buffers + a depth buffer, i only want to clear the first color buffer). How does glColorMask help me with that?

You need glDrawBuffer or glDrawBuffers to set up which ones to write to, I guess

Adbot
ADBOT LOVES YOU

zzz
May 10, 2008
Try an extension library like glew, it makes accessing all of OpenGL's functionality painlessly transparent

Not sure if it differentiates between hardware support and emulation, but it's worth a try

zzz
May 10, 2008

MasterSlowPoke posted:

The bounding box is already computed per-frame and is interpolated inbetween. I'm simply performing a rotation about the Y axis on the model's world matrix. In fact, this method does in fact work when I transform the bounding box's physical geometry, but I need to get the actual values for my collision testing.

edit: I suppose I might as well provide some code. This is the code that sets the position of each of the drawn bounding box's positions:
code:
            bounds = animationController.GetMaximumBounds();

            //bounds.Minimum = Vector3.Transform(bounds.Minimum, Matrix.CreateRotationY(rotation));
            //bounds.Maximum = Vector3.Transform(bounds.Maximum, Matrix.CreateRotationY(rotation));

            boundingBoxVertices[0].Position = bounds.Maximum;
            boundingBoxVertices[1].Position = new Vector3(bounds.Maximum.X, bounds.Maximum.Y, bounds.Minimum.Z);
            boundingBoxVertices[2].Position = new Vector3(bounds.Minimum.X, bounds.Maximum.Y, bounds.Minimum.Z);
            boundingBoxVertices[3].Position = new Vector3(bounds.Minimum.X, bounds.Maximum.Y, bounds.Maximum.Z);

            boundingBoxVertices[4].Position = new Vector3(bounds.Maximum.X, bounds.Minimum.Y, bounds.Maximum.Z);
            boundingBoxVertices[5].Position = new Vector3(bounds.Maximum.X, bounds.Minimum.Y, bounds.Minimum.Z);
            boundingBoxVertices[6].Position = bounds.Minimum;
            boundingBoxVertices[7].Position = new Vector3(bounds.Minimum.X, bounds.Minimum.Y, bounds.Maximum.Z);

            boundingBoxVertexBuffer.SetData<VertexPositionColor>(boundingBoxVertices);
And the code where I set the world transform in the draw stage:
code:
boundingBoxEffect.Parameters["World"].SetValue(Matrix.CreateRotationY(rotation)*Matrix.CreateTranslation(worldPosition));
//boundingBoxEffect.Parameters["World"].SetValue(Matrix.CreateTranslation(worldPosition));
bounds is just a struct that contains two 3D vectors. The way the code is written now, the bounding box looks fine. Uncommenting the commented out code in both sections gives me the problem. Normally it would be silly to transform it part way like that, but I need to do this in another section where I determine the collision boundaries. The collision boundries have to be a box in object space.

Well once you rotate the AA bounding box it's obviously not going to be axis-aligned anymore, so you can't really use it for collisions like that.
I guess one cheapo solution would be to take the maximum and minimum of the new and old corner coordinates, per axis, to get a slightly larger AABB of both the original and the rotated BB. Or switch over to something rotation-invariant like bounding spheres...

If you actually need the rotated positions of the BB vertices, like what you're calculating in that source snippet, you need to work out the coordinates from min/max first and then transform each one separately. Of course the result is not an AABB so it's useless for cheap collision detection.

zzz
May 10, 2008

Scarboy posted:

I have a camera in OpenGL using the gluLookAt function that is working correctly. The camera rotates around a fixed point at the center of the screen. Is there any way i can lower the center point of the camera on the screen/viewport/window?

I don't want to put the center of the camera a few units further on the z-axis because then my object moves when the camera rotates around it. I want the object to always be in the same place, have the camera rotating around it, and to not be at the center of the screen (somewhere in the lower 1/3 of the screen).

Any way to do this?

Not sure what it is that you want (why not just mve the camera slightly up?), but it sounds like an off-center projection matrix.

Something like calling glFrustum by hand (or D3DXMatrixPerspectiveOffCenterLH, both the GL and DX references have matrices describing what's going on) with the vertical bounds of the viewing frustum skewed as much as you like.

zzz
May 10, 2008
Plus, you need to call glEnable(GL_TEXTURE_2D) separately for each texture unit you want to use (after glActiveTexture)

zzz
May 10, 2008

Whilst farting I posted:

Yes! This was it, thank you.

So if tangents are explicitly defined, then how exactly is the curve drawn? Because I'm still not quite understanding the math. Since S can also be anything from 0 to 1, what if we just want to draw a curve given those 4 points? A set of 4 points are defined, and you've got C. h is already given (as per this site again http://www.cubic.org/docs/hermite.htm). So then just go through that pseudocode loop? I'm still not sure what steps is which seems crucial to drawing the curve, and also if vector p is one set of points, 4 sets of points, or just a number.

Thanks!

steps is the number of line segments you use to approximate the curve - more steps means a smoother curve but more processing to calculate it.

Vector p is just that - a vector. In this case, it's the next point to draw a line to (the pseudocode uses moveto and lineto but this can easily be replaced with GL_LINES or something if you just want a curve on the screen)

zzz
May 10, 2008

Mata posted:

Can triangle strips only ever be 1 triangle "tall"? For example this image I would describe as 1x4 triangles. What's the simplest way to instead draw 4x4 triangles? Should I use multiple index buffers on one vertex buffer?

You can use degenerate triangles: by repeating vertices, you create invisible triangles that you can use to include a discontinuity in a single triangle strip (like a jump to a second layer)

If it's supported, you can also use an index of -1 (0xffff or 0xffffffff) to do the same. This is called strip-cut index in D3D and the Primitive Restart extension in OGL.

zzz
May 10, 2008
I haven't touched GPU stuff in a while, but I was under the impression that static branches based on global uniform variables will be optimized away by all modern compilers/drivers and never get executed on the GPU, so it wouldn't make a significant difference either way...?

Best way to find out is benchmark both, I guess :)

zzz
May 10, 2008

floor is lava posted:

Playing around with pure opengl to do some 2d stuff coming from sdl. I'm using textured quads in an ortho view with the top left being 0,0. I'm having problems with clipping on the x and y axis. If a quad goes to the left or above the drawing area the image disappears. How do I deal with something like a sprites on the edges of the drawing area? How do I go about adding a buffer area so that the quads won't be considered invalid?

I'm guessing I'm misunderstanding the different views.

That shouldn't happen unless you're using unsigned integers for the coordinates. Normally, negative coordinates and clipping "just work".

Adbot
ADBOT LOVES YOU

zzz
May 10, 2008
It works in OpenGL ES with GL_EXT_shader_framebuffer_fetch, not sure about desktop OpenGL.

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