Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 23 May 2003
Offline Last Active Mar 23 2015 07:53 AM

Topics I've Started

Good C (not C++) math library?

10 November 2014 - 10:36 AM

There are lots of forum topics about C++ math libraries (like CML, GLM, Eigen, etc.), and I've used many of them in past projects.


However, my next project is going to be C (C11), not C++, so now I'm looking for a good C math library. I'm not having much luck finding one that isn't just someone's pet project.


Anyone have recommendations for good C math libraries that have been battle-tested in real projects?


Trying to project a point onto a cubemap

22 December 2013 - 12:08 PM

I've got a simple test program with a camera within a cubemap (skybox). You can look around, and it feels like you're in a 3D room, but really it's just a cubemap image.


Now I want to draw a point (well, ultimately, a large number of points) on the screen, such that it appears to be anchored at a point on the cubemap. For example, if the cubemap is of a room, then I want to put a point on the "wall", and have it appear to be stationary when you look around.


Given that there is no actual environment, it's just a cubemap, the points I want to project are represented as x/y rotational angles, rather than absolute 3D vertices. I tried calculating the position manually, using the camera x/y angles and interpolating across the screen. However because the cubemap is distorted at the edges due to the camera's projection matrix, my linear calculations don't match up, so the point appears to wobble as you look around.


I know I need to incorporate the camera's projection matrix to get it to appear in the correct position, but I'm not sure how. I'm using the CML math library, and I noticed it has a project_point() function, but it works with absolute 3D coordinates, so I don't know how that helps me when starting with angles instead of coordinates.


If someone could get me pointed in the right direction, I would appreciate it.

Modern shadow rendering techniques?

04 May 2013 - 09:41 AM

What is the state of the art in terms of shadow rendering? My target is OpenGL 3.2, using a deferred rendering pipeline, if that matters.


It's been years since I looked into shadow rendering, and at that time there were numerous techniques available, from stencils to the various shadow mapping methods. At that time, rendering shadows required separate rendering passes, controlled by the CPU. But then recently I saw a demo where a scene was rendered entirely on the GPU, including shadows. I have no idea how that would have been accomplished, or if it is even a reasonable thing to do (beyond a tech demo).


Given the large amount of old info on the internet, I'd like to learn what methods people are using these days, and how much of it can be pushed to the GPU (assuming my target OpenGL version supports it).

Expense of modifying/replacing loaded textures

30 March 2013 - 09:12 AM

How well does OpenGL (3.2, if it matters) handle modifying or replacing textures that have already been uploaded to the GPU?


I always had the impression that messing with textures was always much more expensive than replacing VBO data, even if the texture is far smaller in byte size, but I'm starting to think this might not be the case.


Is there perhaps a list somewhere that shows what sort of operations are most expensive in OpenGL?


For context, I'm working on a terrain system where the terrain colors can change frequently. I figure I can either do texture mapping, and modify the texture pixels, or put the color in the terrain vertices and rebuild the VBO for each change. I'm accustomed to continually rebuilding dynamic VBOs for other tasks, but in this case I am thinking that a texture would be a lot less data to upload than the block of geometry.


Find point on line closest to another point

10 February 2013 - 08:46 AM

Say you have an arbitrary 3D line (not aligned to any axis), and a short distance away, a vertex. Is there a way to calculate what point on the line is closest to the vertex? I've seen posts that demonstrate how to find the shortest distance, but I need to come up with an actual 3D vertex that exists on the line.

For context, I'm trying to move character joints with the mouse. The line is a ray cast into the world from the mouse pointer, from the arbitrary angle of the camera, and the vertex is the character joint that I'm trying to drag around.