Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Dec 2012
Offline Last Active Feb 15 2016 02:03 AM

Topics I've Started

Need help with basic frustum culling

26 January 2016 - 08:27 AM

I'm making a 3D RTS, and I want to see if a tile is in the window or not. I have been told to multiply the MVP matrix by the vector position (im using the center position) of the tiles, and I am to somehow get some value between -1 and 1 to see if it is in view.


I am confused how I get a value like this from a vec4. Also when I multiply by the position, do I just put 0.0 for the w component?


My view frustum is extremely simple. The tiles will always be within the near and far planes, it's always guaranteed a single tile will not fill the screen etc. I'm looking for fast, but asking people and searching google has not yielded a demonstration of the vec4*mat4 approach.


Help is appreciated/

Issues with comparing depth textures

20 January 2016 - 08:22 AM

I'm following a tutorial, trying to blur the edges of water, but I'm getting weird jaggies which I just can't seem to get rid of:




This is caused by the depth texture ("depthMap") having a lower resolution than the screen, which I want for optimization. Here is the shader: http://pastebin.com/QfZHBttT


Noteable parts:

    float depth = texture2D(depthMap, refractUV).r;
    float floorDistance = 2.0 * near * far / (far + near - (2.0 * depth - 1.0) * (far - near));
    if (depth >= 1.0)
        discard;  // This never works
    depth = gl_FragCoord.z;
    float waterDistance = 2.0 * near * far / (far + near - (2.0 * depth - 1.0) * (far - near));
    float waterDepth = floorDistance - waterDistance;

FragColor.r = waterDepth;  // using this to show what's going on.

I am not sure how to fix this. I just need those edge pixels to be invisible. They appear at any time the resolution of the depth texture is lower than the screen.


Any help is appreciated.

why does visual studio do this?

09 January 2016 - 02:21 AM

In release mode it won't update the file when i clean/rebuild


It hits the first breakpoint, but won't actually enter the function:






Also this problem makes no sense:




it is empty yet it's clearing? i have that if statement specifically to stop it from doing that.

"error LNK2001: unresolved external symbol" for static methods

07 January 2016 - 06:03 AM

Hi I have a weird error.


Here's my code with a bunch of unimportant stuff cut out:

#pragma once

struct PFNode
	int gCost;
	int hCost;
	int fCost;
	int x, z;
	int id;
	PFNode* parent;
	bool blocked;
	bool checked;


static void InitPathFinder(World* world)
	worldW = world->getTilesWide();
	worldL = world->getTilesLong();

	for (int z = 0; z < worldL; ++z)
	for (int x = 0; x < worldW; ++x)
		map[x][z].x = x;
		map[x][z].z = z;
		map[x][z].id = x + z * worldW;
		map[x][z].blocked = world->getTile(x, z)->isBlocked;
		map[x][z].checked = false;

So I get errors saying "1>EM_Component_Mover.obj : error LNK2001: unresolved external symbol "struct PFNode (* map)[256]" (?map@@3PAY0BAA@UPFNode@@A)

1>Game.obj : error LNK2001: unresolved external symbol "struct PFNode (* map)[256]" (?map@@3PAY0BAA@UPFNode@@A)"
I have this file included in 2 other files (one being EM_Component_Mover.h) so I'm guessing structs or static methods don't work how I think they do.
Any help is greatly appreciated.

Visual studio cannot compile 32bit or Release Mode

01 January 2016 - 01:43 AM

When I do 32bit compilation, I get this error - "The application was unable to start correctly (0xc000007b)."


So apparently that means something's wrong with the dlls?


I used dependency checker on the 32bit exe and I get this:




Not sure what it means.




I fixed the release Mode error.