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

Xenkan

Members
  • Content count

    7
  • Joined

  • Last visited

Community Reputation

100 Neutral

About Xenkan

  • Rank
    Newbie
  1. I guess I feel that using a library to load a library seems superfluous. In retrospect, it obviously would have saved me some headache. I've got it working now, but if I need more than 4 functions in the future, I might use GLEW. Thanks for the tip!
  2. In case anyone searches this later, I finally solved my problem. I'm loading my function pointers using wglGetProcAddress. However, the function pointers were not marked STDCALL. I believe this was causing my local variables, ie. stack-based variables, to become corrupted. In other words, I was doing this: [code]void (*glBindBuffer)(int target, uint buffer); glBindBuffer = (void (*)(int target, uint buffer))wglGetProcAddress("glBindBuffer");[/code] I should've been doing this: [code]STDCALL void (*glBindBuffer)(int target, uint buffer); glBindBuffer = (void (*)(int target, uint buffer))wglGetProcAddress("glBindBuffer");[/code] Thanks Sponji, for tipping me off that Linux doesn't have wglGetProcAddress, and therefore doesn't have this problem!
  3. Hi Sponji, thank you very much for taking the time to test this! I'm glad I used SDL. Well... maybe the problem has something to do with my build environment, or my testing PCs? I'm building on Windows XP using TDM GCC 4.5.1. The two PCs I tested the .exe on were both Windows XP. I tried testing on a third PC, but that PC didn't seem to support the buffer functions, so that was a: FAIL. Some more information to add: I've been playing around with gDEBugger, which seems like a great program so far! Here's what my VBO looks like in gDEBugger: [img]http://www.voidshard.net/Xenkan/VBOProblem-Debug.png[/img] The x coordinate for my first vertex is NOT correct. It is listed as 1.0089349e-043 instead of -10.
  4. I need help from someone smarter than me with OpenGL, before I go crazy(ier)! I'm trying to use VBO's to load my vertices into the graphics card's memory, so that I can call DrawArrays() and the graphics card can draw lots of triangles on its own without much CPU involvement. Note: I am not using shaders, at least not yet. However, when I try to use VBO's, the vertices are displayed in wrong positions, not the positions that I specified. It seems the first vertex is always wrong. When I do this: [code] float Vertices[] = { -10, 0, 10, 10, 0, 10, -10, 0, -10, -10, 0, -10, 10, 0, 10, 10, 0, -10 }; uint VBO; glGenBuffers(1, &VBO); glBindBuffer(GL_ARRAY_BUFFER, VBO); glBufferData(GL_ARRAY_BUFFER, 4*6*3, Vertices, GL_STATIC_DRAW); glVertexPointer(3, GL_FLOAT, 0, 0); // later... glEnableClientState(GL_VERTEX_ARRAY); glDrawArrays(GL_TRIANGLES, 0, 6); [/code] It works, and I see my floating square: [img]http://www.voidshard.net/Xenkan/VBOProblem-NoMap.png[/img] However, when I do this: [code] float Vertices[] = { -10, 0, 10, 10, 0, 10, -10, 0, -10, -10, 0, -10, 10, 0, 10, 10, 0, -10 }; uint VBO; glGenBuffers(1, &VBO); glBindBuffer(GL_ARRAY_BUFFER, VBO); glBufferData(GL_ARRAY_BUFFER, 4*6*3, 0, GL_STATIC_DRAW); void* Map = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); memcpy(Map, Vertices, 4*6*3); glUnmapBuffer(GL_ARRAY_BUFFER); glVertexPointer(3, GL_FLOAT, 0, 0); // later... glEnableClientState(GL_VERTEX_ARRAY); glDrawArrays(GL_TRIANGLES, 0, 6); [/code] I see a misshapen square, with the first vertex in the wrong position: [img]http://www.voidshard.net/Xenkan/VBOProblem-Map.png[/img] It was my understanding that these two methods should be equivalent. I seem to have a similar problem, even when using the first method (passing pointer directly to glBufferData), if I place the buffer loading code into a separate function, and then my "Vertices" variable goes out of scope. But I don't understand why this should matter, I thought the vertex data was being copied to the graphics card? I've tried every which way to make this work, studied documentation, updated my video drivers, tested this code on different PCs, always a problem. [url="http://www.voidshard.net/Xenkan/VBOProblem.cpp"]Here's the full source code[/url], in case I missed mentioning something important. Any help would be greatly appreciated! Thanks!
  5. Hi Stu, When I tested this code, I got slightly different results than you described. The code would segfault after finding a match. This is because the section which recognizes a complete match does not terminate the loop, and continues trying to compare pixels past the end of the smaller otherTexture subbitmap. if(testPosition == otherTexture.textureInfo.biWidth * otherTexture.textureInfo.biHeight) { //found a whole match counter++; std::cout << "found: " << counter << "starting at pixel: " << s << "," << t << std::endl; test = true; //found at least one break; // <-- You should break the comparison loop here } or better yet, return true if you only care about finding one match. Also, the following test is unnecessary and redundant: if(s >= this->textureInfo.biHeight || t >= this->textureInfo.biWidth) break; because your for loop conditions are already testing this. As a minor speed improvement, I suggest that you could move the "source texture not big enough" test up to immediately following the first pixel match. In other words, you could change this test: if(s+ otherPosY >= this->textureInfo.biHeight || t+otherPosX>= this->textureInfo.biWidth) break; change it to: if (s + otherTexture.textureInfo.biHeight > this->textureInfo.biHeight || t + otherTexture.textureInfo.biWidth > this->textureInfo.biWidth) break; And move it to immediately following the first pixel test: if( this->dataVector[s][t].Matches(otherTexture.dataVector[0][0]) ) This way, the code doesn't bother attempting a full comparison if the source texture isn't large enough to find a match at those coordinates. Lastly, it is my understanding that the bitmap spec allows top-to-bottom bitmaps, indicated with a negative biHeight. See http://msdn.microsoft.com/en-us/library/dd183376(v=VS.85).aspx The bottom-to-top bitmaps with a positive biHeight, which you have coded for, are much more common. But you may want to be careful, and check for this in your loading code: GameTexture::textureData = LoadBitmapFile(filename, &(GameTexture::textureInfo)); if (textureInfo.biBitCount != 24 || // not 24 BPP textureInfo.biCompression != BI_RGB || // compressed textureInfo.biHeight < 0) // top-to-bottom return false; Here are the suggested changes all together: GameTexture::Initialize(char * filename) { std::cout << "initializing!" << std::endl; //load up the texture GameTexture::textureData = LoadBitmapFile(filename, &(GameTexture::textureInfo)); if (textureInfo.biBitCount != 24 || // not 24 BPP textureInfo.biCompression != BI_RGB || // compressed textureInfo.biHeight < 0) // top-to-bottom return false; std::cout << "texture width: " << textureInfo.biWidth << std::endl; std::cout << "texture height: " << textureInfo.biHeight << std::endl; if(!textureData) { std::cout << "ERROR! " << std::endl; return false; } //int counter = 0; for(unsigned int s=0; s<this->textureInfo.biHeight;s++) { std::vector<PixelPart> newVec; for(unsigned int t=0; t<this->textureInfo.biWidth; t++) { PixelPart p; p.r = (int)this->textureData[(s*textureInfo.biWidth + t)*3]; p.g = (int)this->textureData[(s*textureInfo.biWidth + t)*3 + 1]; p.b = (int)this->textureData[(s*textureInfo.biWidth + t)*3 + 2]; newVec.push_back(p); } dataVector.push_back(newVec); } //other unnecessary code here } std::cout << "searching for other texture...\n"; if(otherTexture.textureInfo.biHeight > this->textureInfo.biHeight || otherTexture.textureInfo.biWidth > this->textureInfo.biWidth) { std::cout << "impossible to search for a texture that is bigger than this one." << std::endl; return false; } bool test = false; int counter = 0; int highestMatch = 0; for(unsigned int s=0; s< this->textureInfo.biHeight; s++) { for(unsigned int t=0; t< this->textureInfo.biWidth; t++) { if( this->dataVector[s][t].Matches(otherTexture.dataVector[0][0]) ) { if (s + otherTexture.textureInfo.biHeight > this->textureInfo.biHeight || t + otherTexture.textureInfo.biWidth > this->textureInfo.biWidth) break; //std::cout << "found starting match: " << s << ", " << t << std::endl; //loop through the rest of the other texture int testPosition = 1; int otherPosY = testPosition / otherTexture.textureInfo.biWidth; int otherPosX = testPosition % otherTexture.textureInfo.biWidth; if(s+ otherPosY >= this->textureInfo.biHeight || t+otherPosX >= this->textureInfo.biWidth) { break; } int whilecounter = 1; while (this->dataVector[s+otherPosY][t+otherPosX].Matches(otherTexture.dataVector[otherPosY][otherPosX])) { //std::cout << "found next match: " << s+otherPosX << ", " << t+otherPosY << std::endl; whilecounter++; if(whilecounter > highestMatch) { highestMatch = whilecounter; } //std::cout << whilecounter << std::endl; testPosition++; if(testPosition == otherTexture.textureInfo.biWidth * otherTexture.textureInfo.biHeight) { //found a whole match counter++; std::cout << "found: " << counter << "starting at pixel: " << s << "," << t << std::endl; test = true; //found at least one break; // <-- You should break the comparison loop here } otherPosY = testPosition / otherTexture.textureInfo.biWidth; otherPosX = testPosition % otherTexture.textureInfo.biWidth; } } } } if(!test) { std::cout << "Couldnt find a single one. highest match:" << highestMatch << std::endl; } else { std::cout << "done!" <<std::endl; } return test; You can use the [code] tag to preserve indenting in your forum posts :) I hope this helps
  6. It would be helpful if you posted the first line of your functions from your .cpp file. For example: void Render() { void CleanupDevice() { etc... This way we can compare your function definitions, versus what your linker is looking for. This error indicates that they somehow do not match.
  7. Instead of trying to create a static class variable in your shared header, how about creating a class method which returns your image data? Example.h: class YourClass { static char* GetImageData() { return "\x01\x02\x03\x04..."; } }; Because the method is static, you could call GetImageData() with or without using an instance of the class: YourClass a; data = a.GetImageData(); - or - data = YourClass::GetImageData(); I hope this helps