glm::mat4 projection(0);
glm::mat4 projectionInv(0);
//the frustum in normalized coordinates
vector<glm::vec4> NDCCube;
NDCCube.push_back(glm::vec4(-1.0f, -1.0f, -1.0f, 1.0f));
NDCCube.push_back(glm::vec4(1.0f, -1.0f, -1.0f, 1.0f));
NDCCube.push_back(glm::vec4(1.0f, -1.0f, 1.0f, -0.0f));
NDCCube.push_back(glm::vec4(-1.0f, -1.0f, 1.0f, -0.0f));
NDCCube.push_back(glm::vec4(-1.0f, 1.0f, -1.0f, 1.0f));
NDCCube.push_back(glm::vec4(1.0f, 1.0f, -1.0f, 1.0f));
NDCCube.push_back(glm::vec4(1.0f, 1.0f, 1.0f, -0.0f));
NDCCube.push_back(glm::vec4(-1.0f, 1.0f, 1.0f, -0.0f));
/* Get the current PROJECTION from OpenGL */
glGetFloatv(GL_PROJECTION_MATRIX, (GLfloat*)(glm::value_ptr(projection)));
//calculate the inverse of projection matrix. Hopefully, this'll get us the frustum when multiplied
//by coords of a cube.
projectionInv = glm::inverse(projection);
//push back vertices
for(int i = 0; i < 8; i++)
{
glm::vec4 tempvec;
tempvec = projectionInv * NDCCube.at(i); //multiply by projection matrix inverse to obtain frustum vertex
frustumVertices.push_back(Vector3(tempvec.x, tempvec.y, tempvec.z));
}
- Viewing Profile: Topics: Naked Shooter
Community Stats
- Group Members
- Active Posts 14
- Profile Views 1,005
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
User Tools
Contacts
Naked Shooter hasn't added any contacts yet.
Topics I've Started
Need to obtain frustum corners coordinates
21 October 2012 - 03:39 PM
Render Monkey download
20 September 2012 - 10:58 AM
is bugging out when I go, and I can't for the life of me find any legitimate mirrors. Does anyone know where I can get this tool or an alternative?
Problem initializing object
15 September 2012 - 10:54 PM
class GameOS
{
private:
bool fullScreen;
public:
virtual void showWindow() = 0;
virtual void resize(U32 width, U32 height) = 0;
virtual void initialize() = 0;
virtual void processOSMessages()=0;
virtual void shutdown()=0;
virtual void setFullScreen(bool value) = 0;
};
I also have a platform detection class, where I try to allocate an OS object. For each platform, the platform detection class would use different cpp files. I was playing around with a custom stack allocator, trying to allocate the OS from a big stack that's passed in:
class PlatformDetection
{
private:
public:
PlatformDetection();
~PlatformDetection(void);
static GameOS* initAndReturnOS(StackAllocator& subsystemStack);
};
The windows implementation of the the initAndReturn function looks like this:
GameOS* PlatformDetection::initAndReturnOS(StackAllocator& subsystemStack)
{
WindowsOS* ret = (WindowsOS*)subsystemStack.allocateAligned(sizeof(WindowsOS), __alignof(WindowsOS));
memset(ret, 0, sizeof(WindowsOS));
ret->initialize();
return (GameOS*)ret;
}
The program crashes on ret->initialize(). The thing is, when I comment out "virtual void initialize() = 0;" in GameOS.h, it behaves normally, so it looks like it's trying to call an undefined function of GameOS rather than WindowsOS's function, even though the point is of type WindowsOS*...
Does anyone know why this is?
NeHe samples building, but no exe found.
16 August 2012 - 08:43 AM
I'm using VS. I tried to create a new solution, import the vc++ projects and build them. The build works, but the apps cannot run because there is no .exe generated in the Debug folder. Does anyone know what might be causing this problem?
Edit: Sorry, never mind, I should have looked at build output more carefully. It gave me the following warning:
warning MSB8012: TargetPath(C:\Users\...\Visual Studio 2010\Projects\OpenGLSampleApp\Debug\simple.exe) does not match the Linker's OutputFile property value (D:\Tutorials\Beginning OpenGL Game Programming code\OpenGL 3.0\chapter_1\simple\simple.exe). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
Setting the Output File value in Linker settings to:
Seems to work. I wonder if this solution is ok/good practice?$(SolutionDir)$(Configuration)\$(ProjectName)$(TargetExt)
Can't have function prototype with 4 __m128 parameters?
22 July 2012 - 03:59 PM
I have a .h file, SSEMatrixMultiplier, where I tried to put a function prototype:
__m128 mulVectorMatrixAttempt2(__m128 v, __m128 Mrow1, __m128 Mrow2, __m128 Mrow3, __m128 Mrow4);
and a .cpp file, where I try to implement the function:
__m128 mulVectorMatrixAttempt2(__m128 v, __m128 Mrow1, __m128 Mrow2, __m128 Mrow3, __m128 Mrow4)
{
__m128 xMrow1 = _mm_mul_ps(_mm_replicate_x_ps(v), Mrow1);
__m128 yMrow2 = _mm_mul_ps(_mm_replicate_y_ps(v), Mrow2);
__m128 zMrow3 = _mm_mul_ps(_mm_replicate_z_ps(v), Mrow3);
__m128 wMrow4 = _mm_mul_ps(_mm_replicate_w_ps(v), Mrow4);
__m128 result = _mm_add_ps(xMrow1, yMrow2);
result = _mm_add_ps(result, zMrow3);
result = _mm_add_ps(result, wMrow4);
return result;
}
But the compiler gives me the following errors:
Error 1 error C2719: 'Mrow3': formal parameter with __declspec(align('16')) won't be aligned c:\...simd sse math test\simd sse math test\ssematrixmultiplier.h 20
Error 3 error C2719: 'Mrow3': formal parameter with __declspec(align('16')) won't be aligned c:\...simd sse math test\simd sse math test\ssematrixmultiplier.cpp 4
Error 2 error C2719: 'Mrow4': formal parameter with __declspec(align('16')) won't be aligned c:\...simd sse math test\simd sse math test\ssematrixmultiplier.h 20
Error 4 error C2719: 'Mrow4': formal parameter with __declspec(align('16')) won't be aligned c:\...simd sse math test\simd sse math test\ssematrixmultiplier.cpp 4
Anyone know what's up?
- Home
- » Viewing Profile: Topics: Naked Shooter

Find content