• What Do You Need Help With? V6
    7,544 replies, posted
[QUOTE=Chris220;41529142]I know it sounds obvious, but is your problematic code [I]definitely[/I] running after glewInit has been called? Put a breakpoint on both and see which one is hit first.[/QUOTE] Well in terms of the code file, yes it is but I shall double check to make sure the compiler isnt doing something weird. Could it also be the version of OpenGL I am running?
[QUOTE=thf;41529118]Does that still hold if I say this: I always want to specify all of the type parameters explicitly, except for Out which I never want to specify explicitly? If it still holds, is there some way that I can get it to still work elegantly? Because putting it at the start of the list will make things ugly because it will force me to specify it explicitly if I want to specify any other parameters.[/QUOTE] My mistake, in my code I tried to specify the list explicitly. When infering the Out type via parameter like you did it works. Clarification: [code]template<typename... Stuff, typename Param> void f(Param){} template<typename... Stuff, typename Param> void f(){} int main() { f<int, int, long>(); //error f<int, int, long>(1); //ok }[/code] It seems your code is okay then. You can try with a newer version of the MSVS compiler or perhaps get gcc for Windows. I'm not sure if clang works on Windows yet.
[QUOTE=ZeekyHBomb;41529172]My mistake, in my code I tried to specify the list explicitly. When infering the Out type via parameter like you did it works. Clarification: [code]template<typename... Stuff, typename Param> void f(Param){} template<typename... Stuff, typename Param> void f(){} int main() { f<int, int, long>(); //error f<int, int, long>(1); //ok }[/code] It seems your code is okay then. You can try with a newer version of the MSVS compiler or perhaps get gcc for Windows. I'm not sure if clang works on Windows yet.[/QUOTE] I downloaded a VS2013 preview now and I am going to try it. If it doesn't work then maybe I will try gcc. Or maybe I will just avoid C++11 features for the moment.
[QUOTE=Richy19;41529159]Well in terms of the code file, yes it is but I shall double check to make sure the compiler isnt doing something weird. Could it also be the version of OpenGL I am running?[/QUOTE] You can use [url=http://glew.sourceforge.net/basic.html]glewinfo[/url] (bottom of the page) to see what OpenGL functionality is available.
[QUOTE=Richy19;41529159]Well in terms of the code file, yes it is but I shall double check to make sure the compiler isnt doing something weird. Could it also be the version of OpenGL I am running?[/QUOTE] Nothing wrong with the sequence of execution [QUOTE=ZeekyHBomb;41529176]You can use [url=http://glew.sourceforge.net/basic.html]glewinfo[/url] (bottom of the page) to see what OpenGL functionality is available.[/QUOTE] OpenGL extensions (GL_): GL_EXT_blend_minmax, GL_EXT_blend_subtract, GL_EXT_blend_color, GL_EXT_abgr, GL_EXT_texture3D, GL_EXT_clip_volume_hint, GL_EXT_compiled_vertex_array, GL_SGIS_texture_edge_clamp, GL_SGIS_generate_mipmap, That would suggest I do have access to it right?
All this work makes me question whether I even want to use C++ as a game dev language. I don't know if this might sound stupid, but is it viable to make a 3d accelerated game with physics and everything in a language like Ruby? Just wondering, I might just continue to use C++ anyway.
[QUOTE=Richy19;41528874]Can anyone see whats wrong here? [cpp]bool Texture::LoadFromFile(const std::string &pFileName) { mWidth = 0; mHeight = 0; if(mTextureID == 0){ glDeleteTextures( 1, &mTextureID ); } glGenTextures( 1, &mTextureID ); glBindTexture( GL_TEXTURE_2D, mTextureID ); unsigned char* image = SOIL_load_image( pFileName.c_str(), &mWidth, &mHeight, 0, SOIL_LOAD_RGBA ); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, mWidth, mHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, image ); SOIL_free_image_data( image ); glGenerateMipmap( GL_TEXTURE_2D ); Texture::Unbind(); return true; } [/cpp] I am getting On the glGenerateMipmap( GL_TEXTURE_2D );[/QUOTE] Have you tried commenting that line? Maybe moving it up (until it works)? (dumb but) glEnable(GL_TEXTURE_2D); is set? What about [cpp]glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );[/cpp] Have you checked if glGetError() returns GL_NO_ERROR or GL_INVALID_ENUM or GL_INVALID_OPERATION?
Ruby has OpenGL bindings I think, so assuming they're usable then there's no reason why you can't make a game in Ruby. I don't know about the speed side of things, if anything that would be the problem you'd have to deal with.
[QUOTE=Chris220;41529284]Ruby has OpenGL bindings I think, so assuming they're usable then there's no reason why you can't make a game in Ruby. I don't know about the speed side of things, if anything that would be the problem you'd have to deal with.[/QUOTE] That is the thing I'm worried about. I know that the OpenGL side will be as fast, but the thing I do not know is how much time a game spends in "CPU code". I do not know if speed is an issue at this scale.
[QUOTE=Richy19;41529247]Nothing wrong with the sequence of execution OpenGL extensions (GL_): GL_EXT_blend_minmax, GL_EXT_blend_subtract, GL_EXT_blend_color, GL_EXT_abgr, GL_EXT_texture3D, GL_EXT_clip_volume_hint, GL_EXT_compiled_vertex_array, GL_SGIS_texture_edge_clamp, GL_SGIS_generate_mipmap, That would suggest I do have access to it right?[/QUOTE] [url]https://www.opengl.org/registry/specs/SGIS/generate_mipmap.txt[/url] This defines an additional parameter for *TexParameter* for doing automatic mipmap generation. I didn't do much OpenGL, so I don't know about the naming conventions, but there's glGenerateMipmap and glGenerateMipmapEXT. glGenerateMipmap might be for the core profile (got in OpenGL 3.0 apparently). Try using glGenerateMipmapEXT.
[QUOTE=thf;41529299]That is the thing I'm worried about. I know that the OpenGL side will be as fast, but the thing I do not know is how much time a game spends in "CPU code". I do not know if speed is an issue at this scale.[/QUOTE] Well, the worst you can do is try and see how it goes!
[QUOTE=thf;41529299]That is the thing I'm worried about. I know that the OpenGL side will be as fast, but the thing I do not know is how much time a game spends in "CPU code". I do not know if speed is an issue at this scale.[/QUOTE] I've heard that Ruby is rather slow, but I haven't actually informed myself about it. Python might be a better option, also with projects like PyPy. Then again, there might be equivalents for Ruby. It'll also depend on the hardware you're targeting and the specific game mechanics. You should probably just give it a try if C++ gives you a headache. If it turns out to be too slow you can try to write C or C++ modules for the specific functionality that turns out to be too slow in Ruby/Python (I think this is common practice), if it's not an inherent problem with the complexity of the algorithms used.
[QUOTE=ZeekyHBomb;41529323][url]https://www.opengl.org/registry/specs/SGIS/generate_mipmap.txt[/url] This defines an additional parameter for *TexParameter* for doing automatic mipmap generation. I didn't do much OpenGL, so I don't know about the naming conventions, but there's glGenerateMipmap and glGenerateMipmapEXT. glGenerateMipmap might be for the core profile (got in OpenGL 3.0 apparently). Try using glGenerateMipmapEXT.[/QUOTE] That did it, it woerked fine on my old computer so I never gave it thought. Another issue, tho this one is minor, is that in codeblocks I need to mark my application as a GUI application or else i get lots of undefined reference issues from glfw, is there anyway to get rid of these and have it as a console app?
What does Code::Blocks do differently with GUI applications? WinMain? Might be required to do some OpenGL initialization on Windows.
Well I will probably continue with C++ for the moment actually. [cpp] template <typename First, typename Second, typename... Rest, typename Out> void getEntities(Out result) { std::vector<Entity> entities; getEntities<Second, Rest>(std::back_inserter(entities)); for (auto entity : entities) { if (entity.hasComponent<First>()) { *result++ = entity; } } } template <typename First, typename Out> void getEntities(Out result) { auto& componentMap = getComponentMap<First>(); for (auto iter : componentMap) { *result++ = Entity(iter.first, *this); } } [/cpp] Is there any other code to unambiguate the two function templates than having a "Second"-parameter? I'm thinking of something like enable_if (which I've heard of, but I don't know exactly how it works).
I think just removing it and doing getEntities<Rest...>(blah) would work.
[QUOTE=ZeekyHBomb;41529426]What does Code::Blocks do differently with GUI applications? WinMain? Might be required to do some OpenGL initialization on Windows.[/QUOTE] As far as i can tell it passes -mwindow to the linker, but i use premake and cant find out what that flag is to be able to set it up with premake
[QUOTE=ZeekyHBomb;41529487]I think just removing it and doing getEntities<Rest...>(blah) would work.[/QUOTE] Nope :( "EntityManager::getEntities: ambigous call to overloaded function" [cpp]template <typename First, typename... Rest, typename Out> void getEntities(Out result) { std::vector<Entity> entities; getEntities<Rest...>(std::back_inserter(entities)); for (auto entity : entities) { if (entity.hasComponent<First>()) { *result++ = entity; } } } template <typename First, typename Out> void getEntities(Out result) { auto& componentMap = getComponentMap<First>(); for (auto iter : componentMap) { *result++ = Entity(iter.first, *this); } }[/cpp]
[QUOTE=thf;41529524]Nope :( "EntityManager::getEntities: ambigous call to overloaded function" [cpp]template <typename First, typename... Rest, typename Out> void getEntities(Out result) { std::vector<Entity> entities; getEntities<Rest...>(std::back_inserter(entities)); for (auto entity : entities) { if (entity.hasComponent<First>()) { *result++ = entity; } } } template <typename First, typename Out> void getEntities(Out result) { auto& componentMap = getComponentMap<First>(); for (auto iter : componentMap) { *result++ = Entity(iter.first, *this); } }[/cpp][/QUOTE] I see the predicament... now both functions can match. [code]template<typename First, typename... Rest, typename Out, typename = typename std::enable_if<sizeof...(Rest) != 0>::type> void getEntities(Out result) { ... } template<> template<typename First, typename... Rest, typename Out, typename = typename std::enable_if<sizeof...(Rest) == 0>::type> void getEntities(Out result) { ... }[/code] That should work. I'm not sure if it can be done without repeating the enable_if condition; haven't used it much myself.
[QUOTE=ZeekyHBomb;41529549]I see the predicament... now both functions can match. [code]template<typename First, typename... Rest, typename Out, typename = typename std::enable_if<sizeof...(Rest) != 0>::type> void getEntities(Out result) { ... } template<> template<typename First, typename... Rest, typename Out, typename = typename std::enable_if<sizeof...(Rest) == 0>::type> void getEntities(Out result) { ... }[/code] That should work. I'm not sure if it can be done without repeating the enable_if condition; haven't used it much myself.[/QUOTE] It works, I love you! [cpp]template <typename First, typename... Rest, typename Out, typename = typename std::enable_if<sizeof...(Rest) != 0>::type> void getEntities(Out result) { std::vector<Entity> entities; getEntities<Rest...>(std::back_inserter(entities)); for (auto entity : entities) { if (entity.hasComponent<First>()) { *result++ = entity; } } } template <typename First, typename Out> void getEntities(Out result) { auto& componentMap = getComponentMap<First>(); for (auto iter : componentMap) { *result++ = Entity(iter.first, *this); } }[/cpp] edit: Now to figure out what happened to my renderer... edit: Nevermind I fixed it.
[QUOTE=Richy19;41529496]As far as i can tell it passes -mwindow to the linker, but i use premake and cant find out what that flag is to be able to set it up with premake[/QUOTE] Apparently you can set it via [url=http://industriousone.com/linkoptions]linkoptions[/url]? What it does, see [url=http://stackoverflow.com/a/2022130/1874964]here[/url]. [editline]20th July 2013[/editline] [QUOTE=thf;41529568]It works, I love you! [cpp]template <typename First, typename... Rest, typename Out, typename = typename std::enable_if<sizeof...(Rest) != 0>::type> void getEntities(Out result) { std::vector<Entity> entities; getEntities<Rest...>(std::back_inserter(entities)); for (auto entity : entities) { if (entity.hasComponent<First>()) { *result++ = entity; } } } template <typename First, typename Out> void getEntities(Out result) { auto& componentMap = getComponentMap<First>(); for (auto iter : componentMap) { *result++ = Entity(iter.first, *this); } }[/cpp] edit: Now to figure out what happened to my renderer... edit: Nevermind I fixed it.[/QUOTE] Oh, yeah in this case you can indeed just leave it out for the second overload. Btw, you might want auto& in these range-based for loops. And personally I'm also a fan on slapping const on anything that looks like it might stay const.
[QUOTE=ZeekyHBomb;41529592]Apparently you can set it via [url=http://industriousone.com/linkoptions]linkoptions[/url]? What it does, see [url=http://stackoverflow.com/a/2022130/1874964]here[/url]. [editline]20th July 2013[/editline] Oh, yeah in this case you can indeed just leave it out for the second overload. Btw, you might want auto& in these range-based for loops. And personally I'm also a fan on slapping const on anything that looks like it might stay const.[/QUOTE] Reference? It's just an iterator, is it really still faster to store a reference to it? edit: No wait, it is indeed what the iterator is pointing to, isn't it?
Yes. The variable in the range-based for loop is the actual content, not an iterator (unless the content happens to be iterators :v:).
Quick question regarding PHP, might sound a bit dumb. Is "Public Function Test()" exactly the same as "public function Test()"? I've been doing the former but Sublime Text doesn't highlight the function name like it does with the latter.
In PHP keywords are case insensitive ([url=http://the-echoplex.net/log/php-case-sensitivity]source[/url]). It's a bug in Sublime Texts syntax highlighting.
- snip -
What's a decent method of repeatedly sending information from an executable to another? In a way so I can use something in the style of: [quote]SendText ("informative shit goes here");[/quote] And my receiving program would be able to process that. I was able to find two different methods but none of them really cut it for me. - Having a file open in both programs and reading/writing from them;[I] flooding reads/writes 60 times a second would probably be bad for the hard-drive.[/I] - Direct memory manipulation; [I]I'm a beginner and this seems like quite the hacky way to do things and it can go horribly wrong so I'm not gonna do that.[/I] Doing this in C++/SDL and cross-platform, any appropriate method would be appreciated.
[QUOTE=AntonFTW;41537220]What's a decent method of repeatedly sending information from an executable to another? In a way so I can use something in the style of: And my receiving program would be able to process that. I was able to find two different methods but none of them really cut it for me. - Having a file open in both programs and reading/writing from them;[I] flooding reads/writes 60 times a second would probably be bad for the hard-drive.[/I] - Direct memory manipulation; [I]I'm a beginner and this seems like quite the hacky way to do things and it can go horribly wrong so I'm not gonna do that.[/I] Doing this in C++/SDL and cross-platform, any appropriate method would be appreciated.[/QUOTE] If you're on Linux, use popen(). On Windows, [URL=http://msdn.microsoft.com/en-us/library/ms682499%28VS.85%29.aspx]this[/URL] link explains it. The alternative, which might be a bit overkill but simpler to implement, is to use sockets, and have the server program listen on some port and the client program connect to 127.0.0.1 on that port.
I'd suggest sockets as well. BSD sockets are ubiquitous and for that reason often used for interprocess communication. One method that hasn't been mentioned yet is using a shared library (that allocates shared memory). All platforms probably have equivalent functions, but on Windows you'd create a DLL which allocates memory with CreateFileMapping() inside the paging file, and then maps it into process memory with MapViewOfFile(). In practice, the OS is probably going to keep the dummy file mostly in memory instead of writing it into the paging file, though I haven't benchmarked its performance.
If you want to do your own research, the technical term is "interprocess communication", or short IPC. You can also look at [url=http://www.boost.org/doc/libs/1_54_0/doc/html/interprocess.html]Boost.Interprocess[/url] for a high-level library. [QUOTE=Elecbullet;41536604]Hey, I'm the admin of [url=http://wolfenstein.wikia.com]the Wolfenstein wiki[/url]. My favorite game in the series by far is Wolfenstein 3D. Wolf3D, a DOS program, is open source, and there are numerous pages across the Web describing how to compile it, [url=http://www.brlowe.co.uk/index.html]like this one[/url], but they all seem to be written from the perspective of someone working entirely from DOS, whereas it's far more likely that the user will be using DOSBox, editing files via Notepad or Notepad++, et cetera. I'm interested in writing a guide for how to compile the source code in 2013 - except I can't figure out how to do it myself at all! I've started a page at [url]http://wolfenstein.wikia.com/wiki/Wolfenstein_3D_source_code[/url] . If anyone would be willing to help me out with this, it'd be so great! BTW, if you hate Wikia's shitty skin, create an account (just doing that cuts out 90% of the ads!) then go to [url]http://wolfenstein.wikia.com/wiki/Special:Preferences[/url] and switch the skin to "Monobook", and it'll look just like Wikipedia.[/QUOTE] Wolf3D was probably written with a C-dialect that is not well supported anymore, requiring you to use such an old compiler. However, compilers being command-line based is not unusual, even in 2013. You can use graphical programs that wrap the functionality (but internally use the command-line compiler) though. Get something like Code::Blocks, CodeLite, Geany or something. They provide a simple text-editor (usually augmented with stuff like syntax highlighting like Notepad++) and the ability to to build some form of project. You'll either have to setup a project in these programs, that is selecting all the code-files and then specifying the compiler, linker and their flags. Some might have support for Makefile-Generators like CMake (you'd have to look, I don't know on top of my head). You'd still have to write these specifications, but then you are not bound to the editor you liked the best at that time. You can also look at source-ports like Wolf4SDL, many of which probably work with more modern compilers and thus are easier to build.
Sorry, you need to Log In to post a reply to this thread.