• Content count

  • Joined

  • Last visited

Community Reputation

482 Neutral

About shwasasin

  • Rank
  1. OpenGL Is GL_NORMALIZE still slow?

    One thing to note is if you're targeting OpenGL (desktop) that the GL_NORMALIZE target (for glEnable/glDisable) was deprecated in OpenGL 3.2 Core (July 2009). It won't be available any longer in Core profiles in 3.2 or later versions. Just an FYI. :)
  2. Hey Everyone, I've been reading throughout and Google about hardware depth cubes (rendered from an FBO) and how they are both hardware supported (or not) depending on which threads I read, and which GL/Shader/Extensions versions I am targeting. I'm targeting GL2.0 (GLSL 120) at the moment, and wondering if that's too low hardware requirement for them to be typically supported?   I'm trying to gather metrics at the moment to figure out if it's worth switching to GL3 (most likely 3.2), or not. I'm also wondering if it's just the depth texture lookup that's not supported or the sheer rendering to each of the six cube faces that's not supported for depth cubes? This is all leading up to getting omni-directional shadow mapping to work (ideally on an NVidia 8800 min-spec system), so any thoughts or links to papers/examples are appreciated.   Thanks!  
  3. Well after spending all day looking at this issue and drinking wwaayy too much coffee, I solved the issue and wanted to share. As I added FBO CubeMap support to my game, I reduced the number of glBindFramebufferEXT calls by removing the call to 0 after completing each FBO render. So in the case of CubeMaps, I instead attached the CubeMap side, then rendered again. While I admit I haven't read the OGL Spec thoroughly enough with regards to FBO's, this makes a difference and the call to 0 somehow is the sauce making each side render correctly.   I wrote a quick example of my problem and solution in the hopes this helps others. Have a good one!   Bad:   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboID ); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_CUBE_MAP_POSITIVE_X, texDesc.nameID, 0); // Render Scene Here glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, texDesc.nameID, 0); // Render Scene Here glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);   Good: // Face 0 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboID ); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_CUBE_MAP_POSITIVE_X, texDesc.nameID, 0); // Render Scene Here glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);   // Face 1 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboID ); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, texDesc.nameID, 0); // Render Scene Here glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);  
  4. Hey Folks, For the last few weeks I've been working on omni-directional shadow-mapping for my game. I've noticed that gDebugger is showing all six faces of my FBO CubeMap as the exact same texture data, even though I have verified that each camera direction is set up correctly and working normally. I use FBO's (2d) throughout my game for lighting, cartoon edging, as well as post-fx so I'm fairly confident it's implemented okay (though there could be something wrong), no framebuffer status errors have occurred and gDebugger hasn't tripped with any errors so I'm at a loss. I've even tried attaching each face as a separate color attachment then using glDrawBuffer to activate each one as I run through my 6 rendering passes and that has produced the same results.   I am targeting OpenGL 2.0, so I cannot use FBO Layering/GeoShaders, so I was wondering if anyone has any pointers on the subject? Is there any settings that if (not)set will copy/render the scene to all 6 faces? I'm more than happy to post some code (specifics would be appreciated only because the code is scattered through numerous files). I have to admit it's pretty much the same as every post I've seen on about fbo's/cube maps (although I seem to be missing the special sauce and cannot see it). I've tested this with an Intel HD Graphics 4000, NVidia 660M (Optimus technology) both of which produce this issue so it's definitely something I'm (not)doing.   Any suggestions are appreciated. Thanks!
  5. C++ - Strange behavior with static

    Quote:Original post by BitMaster Declaring a global variable static gives each compilation unit its own copy of the variable. You probably want to declare the variable extern in a header and define it in exactly one compilation unit. Rather than externing the variable itself, why not make a function that returns a reference to the data in question. This allows you to hit a breakpoint every time the data is touched and makes debugging far easier. Just my 2c though. Good luck.
  6. 18, out of school, and lost...

    I would recommend getting a Computer Science degree over a focussed education in game development. Typically CS degrees teach you the skills to learn and solve problems, rather some game development degrees that focus their efforts on learning specific API's (i.e. current industry trends) that by the time your finished your education are obsolete. This ofcourse is an over-generalization between the two, but that's the difference I've seen between graduates of both. Another benefit to getting a CS degree is that if you cannot get a job in the industry (it is very competitive afterall), you still have skills that are relevant to work at other companies like Microsoft, Google, Apple, etc. If you're degree is focussed solely on game-dev, then you may not have transferrable skills to other industries. Good luck with your journey.
  7. Encoding a gameplay video?

    You should look at using Fraps. Great little program, fairly inexpensive and produces great video.
  8. Opengl going immediate mode to buffered drawing

    Quote:Original post by PrestoChung I am using SDL_opengl.h header file, and it's telling me that glGenBuffersARB() is not found...does SDL/GL use an old version of opengl? That header file most likely does not contain all the extensions/features currently available in GL. You'll need to load the VBO extensions manually through the use of "wglGetProcAddress" (which time consuming) or use an extension library like GLEW that will automatically load all relevant functions from the GL driver and give you the latest API changes. Good luck with everything.
  9. If an OpenGL application/game is written correctly, there should be little difference in performance between GL and Direct3D. Of course drivers can be a problem, but still the difference between the two shouldn't too noticeable (in most cases at least). Have you used a profiler to see where the bottlenecks are in your game? To extend Simon's recommendations further: - You should sort all items to be rendered by their texture name ID, and only switch textures when needed to reduce the number of calls to "glBindTexture". This GL command can eat a lot of time. - Implement buffered object rendering (if you have not done so already). Ideally Vertex Buffer Objects (VBO)'s, and if not supported on your hardware, Vertex Arrays and do not use Immediate Mode as Simon has said. - Minimize the number of states being changed between rendering of objects (i.e. do not call glEnable/glDisable after the rendering of each item).
  10. Hey Folks, I'm writing a lighting demo right now using OpenGL 3.2 / GLSL 1.5, and ran into a bit of a snag. I'm defining my static light position in object coordinates but for some reason it travels as I move. I've tried multiplying the current modelView against the lightPosition but no deal. To make things slightly more complicated I apply multiple transforms (1 to pos/rot camera, then 1 for each mesh instance) to place in the world. I tried multiplying the light-pos by the modelview (matCamera uniform) before mesh transformations are applied to each mesh, but no deal. Any help would be greatly appreciated. The vertex/fragment shader code is written below. **Vertex Shader*: #version 150 uniform mat4 matModelView; uniform mat4 matProjection; in vec4 position; in vec3 normal; in vec2 texcoord; out vec2 fragTexCoord; out vec3 fragNormal; out vec3 fragEye; uniform mat4 matCamera; uniform vec3 lightPosition; void main(void) { fragTexCoord = texcoord; fragEye = (matModelView * position).xyz; gl_Position = matProjection * matModelView * position; fragNormal = normalize(fragEye - lightPosition); } **Fragment Shader**: #version 150 uniform vec3 lightPosition; uniform vec4 lightColor; uniform sampler2D textureUnit0; uniform sampler2D textureUnit1; uniform int textureUnitsUsed; uniform vec4 tintColor; uniform bool textureEnabled; uniform mat4 matModelView; uniform mat4 matProjection; uniform mat4 matCamera; in vec2 fragTexCoord; in vec3 fragNormal; in vec3 fragEye; out vec4 fragColor; void main(void) { // Get Texture Unit Colors vec4 tu0 = texture(textureUnit0, fragTexCoord); // Apply Tint As Base Color fragColor = tintColor; // If enabled apply texture if ( textureUnitsUsed > 0 ) { // Texture Unit 0 is Base Texture fragColor *= tu0; // If more than 1 Texture Unit is defined, // use color-multiplication for blending. if ( textureUnitsUsed > 1 ) { vec4 tu1 = texture(textureUnit1, fragTexCoord); fragColor *= tu1; } } // Lighting vec4 diffuse = vec4(1.0, 1.0, 1.0, 0.1); float dp = dot(fragEye, fragNormal); float range = clamp(distance(fragEye,lightPosition), 0.0, 10.0) / 10.0; fragColor *= ((1.0-dp) * diffuse * range); }
  11. Quote:Original post by Zahlman Are you perhaps looking for "double dispatch" (Google it)? After performing some google-fu, I believe "double dispatch" or more precisely the Visitor Pattern is what I'm looking for, thanks! ------------ @rip-off: - While VBO's are preferrable for optimal performance, I find it easier to use immediate mode for rapid prototyping of features (i.e. new particle effects, rendering collision volumes, etc..). It's definitely not put into production/ship code. When VBO's aren't supported on the hardware, alternate rendering methods such as vertex arrays, and display lists are used. Thanks for the advice everyone.
  12. Hey Everyone, I was recently writing some code and came across this interesting problem (or at least I think it is). I have 2 mesh classes, one for immediate mode rendering data (base class), the second is for vbo rendering data (derived class). In my graphics manager I have a method called "Draw", which for the life of me I cannot remember if there is a way in C++ (VS2005) to allow for each type (base/derived) to have their own implementations. I'm reluctant to add a virtual "Draw" method to each of my Mesh classes, but any suggestions to solve the problem are welcome. Mesh* pMesh = new MeshVBO(); GM g; g.Draw(pMesh); class GM { public: // This method always get hit. virtual void Draw(Mesh*& m) { // draw immediate } virtual void Draw(MeshVBO*& m) { // draw vbo } };
  13. I can has relocation?

    While I can't speak for all game companies, generally most companies will part or all of your moving expenses, even if you're a junior programmer. When I started working in the industry at EA Canada, they were kind enough to pay my moving expenses (I moved 4500km, 3000 miles from Toronto to Vancouver). I left EA to work at a company closer to Toronto where my family was (moved back 4500km again) and they paid my expenses as well as well as helped arrange moving companies and took care of all the expenses without me having to get reimbursed for anything (they were a fantastic help). What I'm getting at is that its better to get the job first then figure out where you're going to live, because most of these companies will pay these expenses and if they don't have the money, be cautious about them. If you pay out of your own pocket to move without having a secured job, you risk moving to an area only to have to move again once you get something. Good luck with everything.
  14. Taskbar overlapping WS_POPUP?

    Hi guys, Thanks for the replies. Unfortunately I have tried changing the display settings, I even went as far as enumerating the display modes on the card and picking something other than the default windows resolution, and changing the styles to the ones mentioned. Any other ideas? UPDATE: Just a quick update to mention. I tried this exact code on Windows 7 (64-bit) and crazily enough it works fine. Very strange. [Edited by - shwasasin on May 5, 2010 7:25:38 AM]
  15. Hey Everyone, I'm writing an app where I need the main window to be full screen. I've set my window style to be "WS_POPUP|WS_VISIBLE" (as well as tried adding clip sibling/children and maximized) and changed the window dimensions to the size of the resolution of the computer, but when I run the app starts fullscreen then after around 2 seconds the taskbar appears on screen. I am initializing OpenGL after creating this window. I've noticed that if I do not call SwapBuffers(), the taskbar issue does not happen. I have tried using the PFD-composition and it does not seem to resolve the problem. Has anyone else experienced this issue? It's a rather standard setup of OpenGL so I'm not sure what the issue is. Any help would be appreciated. C Info: Visual Studio 2005 Standard Vista, NVidia Geforce 8600M (latest drivers)