Naked Shooter

Members
  • Content count

    14
  • Joined

  • Last visited

Community Reputation

152 Neutral

About Naked Shooter

  • Rank
    Member
  1. OpenGL Need to obtain frustum corners coordinates

    Yes, that works! I knew it had something to do with w.. Thank you Ohforf!!
  2. Hi. I'm trying to get the frustum vertices by using the perspective projection matrix's inverse. I'm trying to take a cube with the vertices { (-1,-1,-1), (1,-1,-1) ... } and multiply each vertex by the inverse of the perspective matrix, hoping to get the frustum. This isn't working, however. I am aware that there's a lighthouse3d tutorial, and I just might bite the bullet and go through it, but I'm just curious why this isn't working. [CODE] 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)); } [/CODE]
  3. Render Monkey download

    Hey guys! I'm looking for a GLSL authoring tool, and I heard people recommend Render Monkey. Unfortunately, the website http://developer.amd.com/archive/gpu/rendermonkey/pages/default.aspx 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?
  4. Problem initializing object

    [quote name='RulerOfNothing' timestamp='1347777762' post='4980565'] When you call memset(ret,0,sizeof(WindowsOS)); you might be trashing the vtable. If initialize is not a virtual function, then ret->initialize() doesn't need the vtable to be called, so it doesn't crash. I am curious as to why you used memset to clear that object. [/quote] The memset was basically there for no reason, I thought it might help but it didn't.. The solution was to use a 'placement new' like this: [CODE] WindowsOS* ret = (WindowsOS*)subsystemStack.allocateAligned(sizeof(WindowsOS), __alignof(WindowsOS)); ret = new (ret) WindowsOS; [/CODE] This way, we can properly construct an object wile using a pre-allocated chunk of memory to store it.
  5. Hi! I have an abstract GameOS object, and a windows implementation in WindowsOS. [CODE] 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; }; [/CODE] 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: [CODE] class PlatformDetection { private: public: PlatformDetection(); ~PlatformDetection(void); static GameOS* initAndReturnOS(StackAllocator& subsystemStack); }; [/CODE] The windows implementation of the the initAndReturn function looks like this: [CODE] GameOS* PlatformDetection::initAndReturnOS(StackAllocator& subsystemStack) { WindowsOS* ret = (WindowsOS*)subsystemStack.allocateAligned(sizeof(WindowsOS), __alignof(WindowsOS)); memset(ret, 0, sizeof(WindowsOS)); ret->initialize(); return (GameOS*)ret; } [/CODE] 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?
  6. I'm going through the Beginning OpenGL Game Programming book, and I downloaded the samples from the NeHe website because I'm missing the CD. 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: [quote]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).[/quote] Setting the Output File value in Linker settings to: [quote]$(SolutionDir)$(Configuration)\$(ProjectName)$(TargetExt)[/quote] Seems to work. I wonder if this solution is ok/good practice?
  7. Trying to copy code from Game Engine Architecture by Jason Gregory.. I have a .h file, SSEMatrixMultiplier, where I tried to put a function prototype: [CODE] __m128 mulVectorMatrixAttempt2(__m128 v, __m128 Mrow1, __m128 Mrow2, __m128 Mrow3, __m128 Mrow4);[/CODE] and a .cpp file, where I try to implement the function: [CODE] __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; } [/CODE] But the compiler gives me the following errors: [quote]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[/quote] Anyone know what's up?
  8. Hi. I'm reading about GJK, and GJK-based methods, and I'm having some trouble understanding Johnson's algorithm, mainly because it is described in totally different ways in the two places I've seen it ([url="http://www.continuousphysics.com/ftp/pub/test/physics/papers/jgt04raycast.pdf"]http://www.continuou...gt04raycast.pdf[/url] pages 8-10 and the orange Real Time Collision Detection book). The algorithm is supposed to find the closest point on a simplex to the origin. Could someone explain how the algorithm works? Also, Bergen's paper talks about caching the vertices yk-yi for future iterations (page 10). I'm not sure I understand that part. Thanks, naked
  9. is learning c++ as first and only language a bad way to go?

    I would agree that C++ is a more treacherous language than modern languages like C#, but don't let that discourage you from trying. You can do a lot of things in C++ that C# would try to limit, which is why it's dangerous. Also, once you have an understanding of C++, you can easily switch to Java or C#. You'll have to learn some new concepts maybe, but you'll have a pretty good idea how everything works on the low level. I started with C, then went on to C++, and then Java. My first game was in C++, and I can say that going from C++ to C# (which I've never touched before this semester) was a breeze.
  10. [quote name='TehOwn' timestamp='1329241923' post='4913049'] I'm working on a 2D game on the same vein as Tower Defense games but with a large world, seemless world. The player(s) will have to react to attacks from different areas of the world and sometimes defend multiple fronts at once. The problem I have is the idea of hundreds (potentially thousands) of "towers" trying to acquire targets. Also to avoid unnecessary checks when there are no targets within the maximum range. Line-of-Sight is NOT an issue, only whether the target fits within it's range. (some shoot directly forward, some can aim in a cone, etc) I have been told that Quadtrees might allow me to optimize this system of target acquisition. Is this true? Are there any articles I should read? Any pitfalls or alternatives? Additionally, to prevent unnecessary checks, I had the idea that when a hostile unit enters the world, it "activates" all the defenses within a certain radius. And when there are no enemy units around, the defenses shut-down and go into a kind of "sleep" mode. Any thoughts on this? [/quote] You can combine both of your above ideas. In a quad tree, you'd often implement a function that takes a volume (usually a rectangle, but you could concievably have a circle or some swept shape), and returns all of the objects that are around that volume by returning the contents of all the nodes with which the circle intersects. So, an enemy can have its own volume (probably a circle with some detection radius), and it might query the tree with that circle to get the list of nearby towers. Then, you can tell those towers to do their thing (is the enemy within range? can we shoot it?...). This would probably give you the efficiency you need. If you have a dynamic, node-based implementation of the tree, the recursive query function is very simple. Check this out: [url="http://www.kyleschouviller.com/wsuxna/quadtree-source-included/"]http://www.kyleschou...ource-included/[/url]
  11. D3DXVec3Normalize link error

    I'm not sure how to do that =[. I'll try poking around.. Thanks for the reply =)
  12. D3DXVec3Normalize link error

    Hi. I'm a beginner to both Visual Studio, and DX programming, so excuse me if this is obvious. I tried compiling the following code: #include <stdio.h> #include <iostream> #include <d3dx10.h> using namespace std; ostream& operator<<(ostream& os, D3DXVECTOR3& v) { os<<"("<<v.x<<", "<<v.y<<", "<<v.z<<")"; return os; } int main(void) { //Using constructor, D3DXVECTOR3(FLOAT x, FLOAY y, FLOAT z); D3DXVECTOR3 u(1.0f, 2.0f, 3.0f); //Using constructor D3DXVECTOR3(CONST FLOAT*); float x[3] = { -2.0f, 1.0f, -3.0f }; D3DXVECTOR3 v(x); //USING DEFAULT D3DXVECTOR3 CONSTRUCTOR D3DXVECTOR3 a,b,c,d,e; ... //d = u\||u|| - normalization D3DXVec3Normalize(&d, &u); ... cout<<"u ="<<u<<endl; cout<<"v ="<<v<<endl; cout<<"a = u+v ="<<a<<endl; cout<<"b = u-b ="<<b<<endl; cout<<"c = u*10 ="<<c<<endl; cout<<"d=u/||u||="<<d<<endl; cout<<"e = uxv ="<<e<<endl; cout<<"L=||u|| ="<<L<<endl; cout<<"s = u.v ="<<u<<endl; getchar(); return 0; } and I'm receiving the following link error: 1>Hello World.obj : error LNK2019: unresolved external symbol _D3DXVec3Normalize@8 referenced in function _main This is a little strange, considering that all the other D3DXVec3 functions are working. As I said, I'm new to VS (I'm using 2010), but I'm pretty sure I included both the .h files and lib files ( Project Manager -> Microsoft.Cpp.Win32.user -> VC++ Directories and place "Include" from the DX SDK into "Include Directories", and "lib" into "Library Directories"). Can anyone tell what I'm doing wrong?
  13. Vantage - IGF Game Nearly Complete - Try it out

    Awsome! But omg, in order to make something like this I have to learn all the stuff that I need to learn, and then work for YEARS? Jebus... I'm scared.