• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.


  • Content count

  • Joined

  • Last visited

Community Reputation

708 Good

About Solid_Spy

  • Rank

Personal Information

  • Location
    Laguna Niguel, CA
  1. Hello, I have been trying to render the HUD for my game to a separate FrameBuffer so that I can apply my own shader effects to it that are separated from the 3D scene. So far it works fine with entirely opaque objects.   The problem is that I am having transparency issues. I use glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); with glClearColor(0.0f, 0.0f, 0.0f, 0.0f);, which creates a transparent black background for the HUD FrameBuffer before rendering the HUD.   Whenever I render a transparent HUD element to the FrameBuffer, the black gets mixed in with the original colors of the element, which is not what I want. It ends up making the HUD elements look darker than they are supposed to be.   I can change the color for glClearColor() and get different colored results, so I know that that is the root of the problem. I decided to use the blend function:   glBlendFuncSeparate(/*For color*/ GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,                                     /*For alpha*/ GL_ONE, GL_ONE_MINUS_SRC_ALPHA);   which was requested by someone who had a similar issue. Unfortunately it isn't working for me. I am afraid that I might need to do something involving stencil buffers and rendering the elements twice using two separate blend functions to get it to work, but I want to try to avoid that and find a simpler solution. Can anyone give me any pointers?   Here is the function I use for rendering GUI objects (some irrelevant code emitted): void RenderingEngine::RenderGuiObjects() { GuiRenderTheme* pCurGuiRenderTheme; ComponentMap* currentComponentMap = nullptr; glm::vec4* uvOffsetAndScale; glEnable(GL_DEPTH_TEST); //Prepare the gui drawing frame buffer for gui rendering. glBindFramebuffer(GL_FRAMEBUFFER, mpDrawBufferGui->GetFrameBufferObject()); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); //todo: render by layer. for(unsigned int layer = 0; layer < 8; layer++) { for(unsigned int i = 0; i < mpGuiRenderingComponents->size(); i++) { mpActiveRenObjs->pCurRenComp = mpGuiRenderingComponents->at(i); if(mpActiveRenObjs->pCurRenComp->GetPaintAlgorithmLayer() == layer) { pCurGuiRenderTheme = mpActiveRenObjs->pCurRenComp->GetGuiRenderTheme(); mpActiveRenObjs->pCurRenPosComp = mpActiveRenObjs->pCurRenComp->GetTransformComponent(); mpActiveRenObjs->curShaderProgram = mpShaderManager-> GetShaderObject(pCurGuiRenderTheme->shaderIndex); glUseProgram(mpActiveRenObjs->curShaderProgram); glBindVertexArray( *pCurGuiRenderTheme->pMesh->GetVertexArrayPtr()); uvOffsetAndScale = mpActiveRenObjs->pCurRenComp->GetPointerToUVOffsets(); SendUniform(UNIFORM_MAT4F, "worldMatrix", mpActiveRenObjs->pCurRenPosComp->GetRawPtrWorldMatrix()); SendUniform(UNIFORM_MAT4F, "viewMatrix", &mpImportantMatrices->guiViewMatrix); SendUniform(UNIFORM_MAT4F, "projectionMatrix", &mpImportantMatrices->guiProjectionMatrix); SendUniform(UNIFORM_VEC4F, "uv1OffsetAndScale", uvOffsetAndScale); SendUniform(UNIFORM_1F, "opacity", mpActiveRenObjs->pCurRenComp->GetOpacity()); SendUniform(UNIFORM_1F, "hasTransparencyTexture", 0.0f); SendUniform(UNIFORM_1I, "diffuse", 0); ChangeTextureSlot(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, pCurGuiRenderTheme->pMaterial->GetTextures()->at(0)-> textureObject); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } } } } Also this is made with OpenGL 4.2 with c++ and compiled with MinGW.
  2. "I know it will be more than one language for the different OS's."   In some cases, this is unfortunately true. If you decide to take the c++ route, you may have trouble getting a game made for the Mac, as it does not have very good c++ support (it recommends objective C with Cocoa). If you choose Java, you will have the best multi-platform support, but the language is always changing constantly, and it is very slow compared to c++.   You may not have to use different languages sometimes, but you will have to make separate builds of libraries and your program to work on different operating/game systems.   From the sound of it, it looks like your best option would be Java with LWJGL.   It's up to you. Pick your poison.
  3. "Im loading the U,Vs of the texture in the right way by subtracting one from it. Ive tried all kinds of different settings in blender, like vertex order and stuff with no luck   Is there a way to get the right order of uvs ?"   This is why I prefer to write my own custom 3d model file. If you are using Blender, you can write your own export script in Python, and just export the uv's alongside the vertex positions. That way everything is always in order, and then export the indices separately. You can easily read in all the vertex data via struct arrays, and then the indices via unsigned int arrays. I am personally not a big fan of the .obj file format. Your own custom format will be faster to read and parse (loading times for games are slow enough these days), and you can add/organize the vertex data any way you want.   The only advantage I see to using .obj files is that you can visualize the data, but you can also do that in Python via print(), and artists aren't going to want to open the .obj files and tweak all those numbers anyways :P.
  4. Sometimes the dumb can infect us all at the most inconvenient moments. You are not alone.
  5. To learn OpenGL like a PRO, you have to practice.. a lot. There is no simple answer. Go online and look for tutorials on how to draw a triangle on the screen, and then move on from there. There are a near infinite number of different ways to render things with OpenGL, and different programmers use different techniques. It's best to just experiment and learn as much as you can.
  6. "And should it be an RPG game?"   That is entirely up to you. Just remember that the RPG genre is VERY saturated (almost all game genre's are saturated these days, except for collectathon 3d platformers), however if you can make your game very unique, you may have a chance at standing out. Or if you just want to make it for fun, go for it. Rpg's are also very good practice for beginners, as there aren't as many physics related problems that can get in the way.   However, you may need to do a lot of number crunching, and you have to make sure the game stays fair and keeps a steady challenge.
  7. A lot of std library stuff isn't as slow as people say it is, and neither are smart pointers. I use those things in my game engines all the time and they never slow things down enough, so long as you are smart with them ;). I once believed that I should avoid them at all costs.
  8. I have done it. I have officially done it!   For both static and dynamic libraries: All I had to do was replace '/usr/local/lib' with 'C:\Users\NULL\Downloads\libogg\src\.libs', and '/usr/local/includes/ogg' with 'C:\Users\NULL\Downloads\libogg\include'.   I honestly didn't think it would work, but I was lucky :P.   For anyone who was struggling with this, I will sum it up in this small tutorial :):   Step 1: Make sure you have mingw and msys installed correctly. Bash should have been installed along with msys. It should be in the bin folder. Make sure bash is in your PATH variable as well.   Step 2: Open cmd.exe, and type 'mingw-get install msys-automake'. This will install the mingw safe version of automake, which you will need to use the './configure' command to generate make files from .in files.   Step 3: Download libogg and libvorbis online. It should be easy to find. Start with libogg, and go to their main directory (using cd of course). Type bash to enable the bash UNIX shell, and then type ./configure to create the makefiles for libogg. Then, type make to create the lib files, which should be under ../src/.libs.   Step 4: Do the same for libvorbis, except type './configure --with-ogg-libraries=C:\Users\YourNameHere\Downloads\libogg\src\.libs --with-ogg-includes='C:\Users\YourNameHere\Downloads\libogg\include --disable-oggtest'.   It's a lot to type, but it should get the job done.   Step 5: Lastly, type make, and you should also have the libraries for libvorbis under ../lib/.libs.   For Static libraries only:   Step 1: Make sure you have mingw and msys installed correctly. Bash should have been installed along with msys. It should be in the bin folder. Make sure bash is in your PATH variable as well.   Step 2: Open cmd.exe, and type 'mingw-get install msys-automake'. This will install the mingw safe version of automake, which you will need to use the './configure' command to generate make files from .in files.   Step 3: Download libogg and libvorbis online. It should be easy to find. Start with libogg, and go to their main directory (using cd of course). Type bash to enable the bash UNIX shell, and then type ./configure --prefix=c:/mingw --disable-shared to create the makefiles for libogg. Then, type make, press enter, and then type make install and press enter to create the lib files, which should be under ../src/.libs.   Step 4: Do the same for libvorbis. you should also have the libraries for libvorbis under ../lib/.libs.   ----------------------------   Also, make sure the libraries are in the correct order!   vorbisenc vorbisfile vorbis ogg   Credit: https://www.allegro.cc/forums/thread/555804   Now you can use ogg files in your game for music/sound effects without paying thousands of dollars for visual studio :D!
  9. (SOLVED.) My brain has been melting trying to figure out how to get these two libraries to compile. It is ironic considering these are so incredibly popular in the game industry T_T.   I am trying to compile for windows with MinGW32, so that I can use the static libraries (.a files) for Eclipse (Oh boy, you know where this is going.).   I already have makeconf installed for msys, so that I can get the makefiles for libvorbis, however things aren't going as planned. I tried using bash and managed to successfully create the makefile for libogg, and I generated the .a file. However, when trying to do the same for libvorbis, I get the following error after typing './configure': "Configure: Error: must have ogg installed!"   I'm not sure how I am supposed to get around this. I heard that you are supposed to use ldconfig to fix the issue, but that is a linux program. I am lost here. Does anyone have a build of libvorbis.a? It might be easier to just get the library directly, but I cannot find a download.   I know that there should be hundreds of indie game developers who have used ogg's in their games. Surely someone should know what to do. Please help!   EDIT: This site helped me generate the make file: https://www.daniweb.com/programming/software-development/threads/269305/anyone-have-ever-successful-compiled-libvorbis using ./configure --with-ogg-libraries=/usr/local/lib --with-ogg-includes=/usr/local/includes/ogg --disable-oggtest   However, the makefile gives an error when using make. Fatal error: ogg/ogg.h: No such file or directory.   I even tried adding it to my PATH variables, but that didn't fix it.
  10. Success!   I found the issue. At first I thought that GL_RGBA8 and GL_RGBA32F were equivalent, for some reason :p. I changed my textures to GL_RGBA32F and now it is officially working.
  11. I decided to ditch cubemaps for now and use image2d's instead, and was suprised to see that those don't work either!!   Something is seriously wrong. I am able to get image2d to work in other compute shaders. I think the root of the problem is the SSBO, because all these problems started ever since I started using them. I think that is causing a bug, maybe in the drivers, because I am certain I am implementing them correctly. I looked at various tutorials on how to use SSBOs. However, I don't want to ditch the SSBO for storing 9 vectors, but it looks like I have no choice.   I guess I have no choice but to maybe use another texture that is write only to store the harmonic coefficients somehow.. until anyone can help me find out what the hell is going on here.
  12. Ok, I am starting to believe that the reason this isn't working, is because the cubemap needs to be immutable, which I read in this article: http://malideveloper.arm.com/resources/sample-code/introduction-compute-shaders-2/   "A very important restriction for using shader images is that the underlying texture must have been allocated using “immutable” storage, i.e. via glTexStorage*()-like functions, and not glTexImage2D()."   I have modified my cube map creation code like so, however, I am not sure if I am doing it right. Gdebugger will not display the texture (probably since immutable textures only have support for 4.2 or above, and gdebugger is meant for lower version of OpenGL). EDIT: I changed the texture to be immutable and successfully tested it in a vertex/pixel shader, but in the compute shader, things still arent working. glGenTextures(1, &cubeMapObject); glBindTexture(GL_TEXTURE_CUBE_MAP, cubeMapObject); int levels = floor(log2((16.0)))+1; glTexStorage2D(GL_TEXTURE_CUBE_MAP, levels, GL_RGBA8, 16, 16); glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 16, 16, GL_BGRA, GL_UNSIGNED_BYTE, cubeMapSideDataLeft); glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, 0, 0, 16, 16, GL_BGRA, GL_UNSIGNED_BYTE, cubeMapSideDataRight); glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, 0, 0, 16, 16, GL_BGRA, GL_UNSIGNED_BYTE, cubeMapSideDataUp); glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, 0, 0, 16, 16, GL_BGRA, GL_UNSIGNED_BYTE, cubeMapSideDataDown); glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, 0, 0, 16, 16, GL_BGRA, GL_UNSIGNED_BYTE, cubeMapSideDataFront); glTexSubImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, 0, 0, 16, 16, GL_BGRA, GL_UNSIGNED_BYTE, cubeMapSideDataBack); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
  13. Hello. I am having a bit of trouble trying to get a cubemap sent over to a compute shader I am working on.   -I am using opengl 4.3. -The cube map is loaded from a file, and loaded successfully. I was able to view it in gdebugger. It is 16x16x16. -The compute shader compiles just fine. I am also able to output values I manually type into the compute shader. -I am using Windows 8. -MinGW compiler. -And the GLEW and GLFW libraries. -And yes, my gfx card does support opengl 4.3   For some reason, whenever I sample even just one pixel from the cube map in the compute shader, all I get is zero.   Here is the code on the c++ side: void BaseRenderer::RenderHarmonicCoefficients() { //This is just me getting the shader. mpActiveRenObjs->curShaderProgram = mpShaderManager->GetShaderObject(SHADER_COMPUTE_HARMONIC_COEFFICIENTS); glUseProgram(mpActiveRenObjs->curShaderProgram); GLuint dataBufferHarmonicCoefficients; //The buffers are created just fine. glGenBuffers(1, &dataBufferHarmonicCoefficients); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, dataBufferHarmonicCoefficients); glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(GLfloat) * 9 * 4, harmonicCoefficients, GL_DYNAMIC_DRAW); SendUniform(UNIFORM_1I, "sceneCubeMap", 0); ChangeTextureSlot(GL_TEXTURE0); //Now this is where I am having trouble. I am not sure if I am even //doing this right. glBindImageTexture(0, mCubeMapPreIrradiance, 0, GL_TRUE, 0, GL_READ_ONLY, GL_RGBA32F); //Start the compute. glDispatchCompute(1, 1, 1); //Extract the harmonic coefficients. glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, 0); glBindBuffer(GL_SHADER_STORAGE_BUFFER, dataBufferHarmonicCoefficients); glm::vec4* outCoefficientData = reinterpret_cast<glm::vec4*>(glMapBuffer(GL_SHADER_STORAGE_BUFFER, GL_READ_ONLY)); for(unsigned int i = 0; i < 9; i++) { harmonicCoefficients[i] = outCoefficientData[i]; } glUnmapBuffer(GL_SHADER_STORAGE_BUFFER); //This returns the y value of the second harmonic coefficient, which is zero. //All of the other ones return zero as well. Msg("Coefficient.", boost::lexical_cast<std::string>(harmonicCoefficients[1].y).c_str()); } And the glsl shader: //COMPUTE SHADER #version 430 const uint numOfUVWVecs = 1536; //Computes 9 harmonic coefficients layout(local_size_x = 9, local_size_y = 1, local_size_z = 1)in; layout(rgba32f, binding = 0) readonly uniform imageCube sceneCubeMap; layout(std430, binding = 1) writeonly buffer PrimaryDataChunkHarmonicCoefficients { vec4 harmonicCoefficients[9]; }; void main() { //Trying to get the middle pixel on the positive x face of the cubemap. This doesn't work. currentCoefficient = imageLoad(sceneCubeMap, ivec3(8, 8, 0)).xyz; //return the final coefficient. //Doesn't work! Returns zero. harmonicCoefficients[gl_GlobalInvocationID.x] = vec4(vec3(currentCoefficient), 0.0); //But this works. //harmonicCoefficients[gl_GlobalInvocationID.x] = //    vec4(vec3(1.0, 1.0, 1.0), 0.0); } Edit: I changed the layer parameter to GL_TRUE, as I heard it needs to be enabled for cubeMaps, however it is still not working. The texture is sent over to the cpp function. I'm still not sure if it is being sent to the compute shader properly. I have never had issues with regular 2D textures. I hear you can get cubeMaps to work in compute shaders though, and I have no idea what i am doing wrong T_T.   Edit2: Added uniform location and changed current texture slot to GL_TEXTURE0. Still not working.
  14. Ok, I managed to solve it. I forgot to add falloff to the specular. I swore I already added it, but I didn't for some reason. I added it to the diffuse light but not the specular .