• 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.

The Magical Pot

Members
  • Content count

    39
  • Joined

  • Last visited

Community Reputation

178 Neutral

About The Magical Pot

  • Rank
    Member
  1. I managed to fix this at last. The call stack said that the error occurred after main was called and I realized that I used an incorrect method at first to check where the application crashed. When the application was to delete an object of type VBOQuad, I checked if the object existed in memory by comparing it to NULL, but I tried to print out the value of an uninitialized pointer of this type and I realized that such a pointer is not necessarily equal to NULL. In the end, an uninitialized pointer was seen as an initialized one, thus the application would try to delete an object that didn't exist in memory.   Thanks for your help! :)
  2. Hi!   I'm working with VBOs and I suddenly sumbled across a very weird error. My compiler is giving me a run-time error saying that this statement can't be executed: if ( glIsBuffer( VertexBuffer ) ) This statement can be found in this destructor: VBOQuad::~VBOQuad() { //Clear vertex buffer if ( glIsBuffer( VertexBuffer ) ) glDeleteBuffers( 1, &VertexBuffer ); //Clear index buffer if ( glIsBuffer( IndexBuffer ) ) glDeleteBuffers( 1, &IndexBuffer ); VertexBuffer = NULL; IndexBuffer = NULL; } I've tried to track this error down to find some sort of context, but I've found that the run-time error emerges before the first line of the main function is executed. The description of glIsBuffer says that the function will return true if the argument is the name of an existing buffer, and it will return false if the argument is zero or a non-zero value. The debugger says:   VertexBuffer CXX0030: Error: expression cannot be evaluated IndexBuffer CXX0030: Error: expression cannot be evaluated     This would, to me, indicate that VertexBuffer doesn't exist in memory, which in turn would mean that VertexBuffer is basically NULL, which is defined as zero, so there souldn't be a problem. That's probably not right since it's crashing at that statement.   The main problem I'm having is that the application crashes before the main function is executed, so for all I know, the destructor hasn't even been called yet, but it's trying to execute it, by the looks of it. My question is what the problem usually is in a situation like this where the application crashes before the main function is executed.   Thanks!   EDIT: I have added a screen dump of the Stack Trace.
  3.   I feel like GLSL is a little too much for me at this point. Would you say that it's better to replace both the vertex data and the texture coordinates rather than partially update in this case when it comes to performance?
  4. Thank you both! I solved the problem by splitting the VBO into 2 parts, one for vertecies and one for texture coordinates. I didn't really know you could do that.   Cheers!
  5. Hi!   I'm currently trying to set up a function that renders a textured 2D quad using VBOs. The function changes the vertex data of the VBO every time it's called so that you can stretch it, but the texture data of the VBO doesn't change. In other words I want to be able to change the vertex data without having to change the texture data of the VBO.   When I store my VBO I have a struct that contains 4 GLfloats (VertexData2D), the first two GLfloats represent the vertex data and the last two GLfloats represent the texture data. My problem is that I can't find a way to only change the vertex data without having to change the texture data, since the entire VBO contains both vertex data and texture data.   This the rendering part in the function: glBindTexture( GL_TEXTURE_2D, get_texture_id() ); //Set texture //Enable vertex and texture coordinate arrays glEnableClientState( GL_VERTEX_ARRAY ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glBindBuffer( GL_ARRAY_BUFFER, VertexDataBuffer ); //Bind vertex data //Update vertex buffer data glBufferSubData( GL_ARRAY_BUFFER, 0, 4 * 4 * sizeof(GLfloat), VData ); //Set texture coordinate data glTexCoordPointer( 2, GL_FLOAT, 4 * sizeof(GLfloat), (GLvoid*)offsetof( VertexData2D, TexCoord ) ); //Set vertex data glVertexPointer( 2, GL_FLOAT, 4 * sizeof(GLfloat), (GLvoid*)offsetof( VertexData2D, Position ) ); //Draw quad using vertex data and index data glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, IndexBuffer ); glDrawElements( GL_QUADS, 4, GL_UNSIGNED_INT, NULL ); //Disable vertex and texture coordinate arrays glDisableClientState( GL_TEXTURE_COORD_ARRAY ); glDisableClientState( GL_VERTEX_ARRAY ); I first bind the correct texture and VBO, then update the VBO using glBufferSubData()   (the VBO is set with GL_DYNAMIC_DRAW). I update the VBO starting at index 0, VData is the VBO that's going to replace the current one. Each vertex has the size  4 * sizeof(GLfloat) and since I'm rendering a quad, the stride results in 4 * 4 * sizeof(GLfloat) It's in glBufferSubData() that the problem is, my VBO contains both the vertex data and texture data, but I only want to change the vertex data. glBufferSubData() overwrites the current VBO, but I only want it to overwrite parts of it. This is essentially how I want it to work:   Update memory equal to: 2 * sizeof(GLfloat) Skip memory equal to: 2 * sizeof(GLfloat) Repeat 3 more times   What should I do? Is there another function that can do this?   Thank you!
  6. I asked a very simple question and I got the answer that I needed 5 minutes after posting. I know that you shouldn't ask stuff that you can easily find on google or whatever, but for some reason i did and someone was nice enough to answer my question. I'll gladly take delete this post if anyone says that I have to because I already got my answer. This conversation is pointless.
  7.   Everyone doesn't study math in english, I didn't know that "cos-1" was "arc cosine" in english.
  8. Hi!   I don't need to go into detail of what I'm doing to get an answer on this question. All I'm wondering is what function in the cmath.h header that corresponds to cos-1, sin-1, tan-1 on a calculator. For example: if I want to calculate cos-1(200/100) to get the degree of an angle, which function do I use since functions cos(), sin(), tan() in C++ corresponds to cos, sin, tan on a calculator and not cos-1, sin-1, tan-1.   Hopefully, that was not a load of incohesive dribble, but let me know if you want me to explain some more if it was :)
  9. When you want to start programming games you don't start off with games like Starcraft or Age of Empires 2 etc. those games are actually quite coplex. You'll want to start with something simple like pong, tetris and things like that. If you doubt me, I've actually have learned the hard way why you should start off simple: The first game I made was a 2D RPG and that dragged on for about 2 years, the engine I wrote for that was a mess and complete crap; I didn't know what I was doing. So basically, start off with smaller projects that don't take a whole lot of time to make, maybe a few months at most.   When it comes to languages and engines, it depends. If you want to create games as a hobby, using an existing engine might be a thing, but I'm not sure if I would recommend it. If you want to work towards a goal, like becomming a professional programmer, I would definately not recommend using an existing engine. I personally started with C++ (with SDL for 2D rendering), but that's not something I would neccessarily recommend to everyone since it does take a lot of effort to learn that. You could perhaps try something like Java or C.
  10. It might actually be the case that SDL only supports colorkeying and not blending, that might explain it since I've successfully used SDL for colorkeying while blending didn't work.
  11. Ok, I gave up on SDL's image loading thingy and switched over to DevIL and it worked perfectly. For me I just added this piece of code right after I initialized OpenGL: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable( GL_BLEND ); This will basically enable blending (check out http://www.opengl.org/sdk/docs/man/xhtml/glBlendFunc.xml for more information about glBlendFunc).   To find out how to install and load images with DevIL into OpenGL textures, I'd recommend this link: http://lazyfoo.net/tutorials/OpenGL/06_loading_a_texture/index.php   Note: for Visual Studio users, you have to open up 'ilu.h' and replace the line: #include <IL/il.h> With: #include <il.h> Since Visual Studio don't include certain files in the same way that other IDEs do.   That worked for me, I hope it works for anyone else who's having the same problem :)
  12. I still don't know how to check such information, but it seems like there shouldn't be anything wrong with the pixels since the textures work fine when blending isn't enabled. It however seems like this problem isn't really going anywhere, so I could try with the DevIL image loading library instead of SDL's one.
  13. The values for image->w and image->h are correct, I have no idea about how to check image->pixel which is a pointer of type void, but when I write image->pixels as an integer, the output for a 32x32 texture is "86048840" if that says anything.   I searched a bit more about other people who have the same problem, but the only solution I've found was to switch over to the DevIL which takes care of image loading.
  14. It didn't solve the problem. I forgot to add a piece of code, I bind the texture right before I render it: glBindTexture( GL_TEXTURE_2D, ThemeTemplate->TemplateSheet->get_data() ); //Set texture ID I really don't know what the problem is, but maybe it has something to do with the arguments passed when I enable blending?
  15. Yes, there's a line in the last code snippet 'bool Texture::load_texture( SDL_Surface *image )' where I call that function // Bind the texture object glBindTexture( GL_TEXTURE_2D, data ); This line is executed before I draw anything.   I also forgot to show the picture, so here it is: https://twitter.com/TheMagicalPot/status/359349302939754496   "The Image in this post shows what the application renders without the enabling of blending on the left side, the right side is what it renders when I enable blending. The blue window within the application is made out of pieces of textures for the frame and the center is a colored quad, so when I render textures, they're not shown, but when I render geometrical shapes without textures, they're shown."