Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Vincent_M

Member Since 16 Jan 2007
Offline Last Active Mar 03 2015 09:56 PM

Topics I've Started

Transformation Hierarchy

27 January 2015 - 09:41 PM

I've started to work on a transformation hierarchy, but I have found that if I attach a camera to a scene node that doesn't have a uniform scale of 1.0, then it throws off my view matrix when I calculate it. I calculate my view matrix from my camera scene node by taking its final transform matrix in world-space, and creating the inverse-transpose of that whenever something changes.

 

Another issue I keep getting stuck on is how to calculate global position, rotation, and scale. My current Transform class has a pointer to its parent, knows its final transform by the time it has to update, and can get the parent transform's local position, rotation and scale. I thought about just multiplying my Transform's final transform matrix by a vector of zero to get its global position, but any scaling from up the hierarchy would be applied to it too.


Using Ripped Models for Tech Demos

27 January 2015 - 08:44 PM

I've been working on my programming portfolio, but I don't have anything presentable right now. I do have this old Star Fox-like railshooter demo I could show off. I attempted to emulate the gameplay, and I used the actual models from Star Fox Assault since I don't have the 3D modeling talent or the time. They were converted to OBJ files, and loaded by my code. I'd like to make a Windows build of this demo simply to demonstrate basic graphics and gameplay programming skills, but I'm almost certain this is copyright infringement. It's not meant to be used in a commercial project, but it is meant to be used in a portfolio. Since I'm using a commercial game's models, is there any way I can use them, or should I resort to programmer art?

 

If this isn't possible, could I use free models obtained from places like BlendSwap or even TurboSquid as long as I give permission? Also, what are the grounds for font files? Some artists grant personal use. Would a portfolio fall under personal use, and not commercial use?


Ambient Occlusion for Deforming Geometry

19 January 2015 - 05:49 PM

Could ambient occlusion be used correctly on skinned models that are animating? It would seem that it only works on static objects that could be repositioned, rotated and scaled as a whole, but not when its geometry is deforming because the radiance map would have to be re-computed. Is this correct?


Multiplatform API For Webcams

19 January 2015 - 03:19 PM

Does such an API exist in C or C++? I'm looking for something that works on Windows, Linux and Mac. From my own research, it seems like Video4Linux2 is the closest thing to a de-facto standard for Linux webcams. I'm not too sure how supported V4L is though. OS X provides AVFoundation/QTKit (QuickTime) which are nice, but they're not portable and are written in Objective-C making OS X-only wrappers a pain... I know Windows has their own solution that most-likely used to belong to DirectX once upon a time, but I haven't checked them out yet.


Depth Issues with Instanced Rendering

14 January 2015 - 01:42 AM

I'm learning about instanced rendering, and I just rendered 10,000 cubes to the scene with a single call to glDrawElementsInstanced(). All of my cubes rendered with their randomly generated transform matrices and solid colors, however the depth for all of these boxes weren't correct. At first, I thought it was due to instanced rendering. Then, I drew 2 cubes with their own draw call. The cube furthest away was drawn last per frame, and it still drew over the cube in front of it when it was overlapping my front cube in the framebuffer. I made sure GL_DEPTH_TEST was enabled, and glDepthFunc() was set to GL_LEQUAL. I didn't change the defaults for depth writing, masking or range. I'm also using GLFW to generate my windows and context. I even explicitly set GLFW_DEPTH_BITS to 24 using glfwWindowHint() before I called glfwCreateWindow():

int main(int argc, char** argv)
{
	float lastTime = 0.0f;
	GLFWwindow *window = nullptr;

	// setup error callback, and initialize GLFW
	glfwSetErrorCallback(error_callback);
	if (!glfwInit())
	{
		printf("GLFW wasn't initialized");
		exit(EXIT_FAILURE);
	}

	// set the context
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
	glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
	//glfwWindowHint(GLFW_SAMPLES, 4);
	glfwWindowHint(GLFW_DEPTH_BITS, 24);

	// create the window
	window = glfwCreateWindow(800, 600, "GLFW Test", nullptr, nullptr);
	if (!window)
	{
		glfwTerminate();
		exit(EXIT_FAILURE);
	}

	// setup window callbacks
	glfwSetKeyCallback(window, key_callback);
	glfwSetFramebufferSizeCallback(window, resize_callback);

	// set the current context and swap interval
	glfwMakeContextCurrent(window);
	glfwSwapInterval(1);

	// initialize GLEW
	glewExperimental = 1;
	GLenum err = glewInit();
	if (err != GLEW_OK)
	{
		fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
		return -1;
	}
	glGetError(); // flush out possible GL_INVALID_ENUM error that glewExperimental causes upon glewInit()

	// output the OpenGL version, renderer and number of samples
	printf("OpenGL Version: %s\n", glGetString(GL_VERSION));
	printf("OpenGL Renderer: %s\n", glGetString(GL_RENDERER));

	// enable initial states
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_CULL_FACE);
	glEnable(GL_BLEND);

	// configure initial parameters
	glFrontFace(GL_CCW);
	glDepthFunc(GL_LEQUAL);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	glActiveTexture(GL_TEXTURE0);
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
	InitCommon(); // initialize

	// install states
	//states.push_back(new ModelState("Model Processor", window));
	states.push_back(new OculusState("Oculus State", window));
	states.push_back(new IndirectRenderingState("Indirect Rendering State", window));
	states.push_back(new BasicInstancingState("Basic Instancing", window));
	states.push_back(new WireCubeState("Cube State", window));
	states.push_back(new SpritePackerState("Sprite Packer State", window));
	states.push_back(new BinPackerState("Bin Packer State", window));
	states.push_back(new BasicTextureState("Basic Texture State", window));
	states.push_back(new TriangleState("Triangle State", window));
	SetState(0);

	// main window loop
	lastTime = (float)glfwGetTime();
	while(!glfwWindowShouldClose(window))
	{
		GamepadManager::Update();

		// update and render the current state
		if(currentState)
		{
			currentState->Update((float)glfwGetTime() - lastTime);
			currentState->Render();
		} else
			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		// swap buffers and poll for events
		lastTime = (float)glfwGetTime();
		glfwSwapBuffers(window);
		glfwPollEvents();
	}

	// release all states
	for (State *state : states)
	{
		if (state != nullptr)
		{
			state->UnloadContent();
			delete state;
		}
	}

	// cleanup
	states.clear();
	ShutdownCommon();
	glfwTerminate();
	return 0;
}

PARTNERS