Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About ElectroDruid

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. ElectroDruid

    GLSL Vertex shader compile error

    That worked a treat, cherryyosh! The shader file I was loading in was completely fine (no unusual characters , but the ifstream which the tutorial uses to load the shader does weird stuff and seems to store a bunch of garbage at the end. The program tries to NULL terminate the broken string, but adds the terminator one character too late.
  2. Hi, I'm new to GLSL, and I'm trying to get started by getting some of the clockwork coders tutorials to compile and run (the ones here: http://www.clockworkcoders.com/oglsl/tutorials.html ). Specifically, I've jumped in at Tutorial 10 - Simple Toon Shading. The code compiles and runs, but then the call to glGetObjectParameterivARB(ProgramObject, GL_OBJECT_COMPILE_STATUS_ARB, &compiled); when trying to compile the vertex shader fails to set the compiled flag, and the compiler log reports the following errors: Quote:***COMPILER ERROR (Vertex Shader): 0(12) : error C0000: syntax error, unexpected $undefined at token "<undefined>" 0(12) : error C0501: type name expected at token "<undefined>" This is the vertex shader in question: varying vec3 vNormal; varying vec3 vVertex; void main(void) { vVertex = gl_Vertex.xyz; vNormal = gl_Normal; gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; } I don't see how there can be anything wrong with the vertex shader itself, so could it be something wrong with my compiler or hardware setup? I'm using Visual Studio 2008, running Windows Vista on a Dell XPS M1530, with an NVidia GeForce 8600M GT graphics card - the operating system, BIOS and graphics card drivers are all completely up-to-date. What could be going wrong here?
  3. Hi, I'm having some trouble getting the stencil buffer to do what I want it to in the 2D game I'm working on. I'm trying to draw a tiled texture across my level, but only having it appear in places where there is solid level geometry. I'm defining "solid level geometry" as "anywhere I've drawn a sprite into the stencil buffer". My sprites are just textured quads, which are solid white where I want to see the tiled texture, and transparent where I don't. So, my code goes: // (Draw background, game sprites and stuff...) // Enable writing into the stencil buffer glEnable(GL_STENCIL_TEST); glStencilFunc(GL_ALWAYS, 1, 0xffffffff); glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); // (Draw my solid white/transparent stencil sprites) // Set new stencil stuff to use the stencil buffer to decide where to write to the screen glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glStencilFunc(GL_NOTEQUAL, 0, 0xffffffff); // (Draw my tiled, textured quad) This doesn't work, though. Basically, all of my attempts to draw the sprites into the stencil buffer seem to result the whole quad getting written to the buffer, rather than just the solid white texels. What am I doing wrong?
  4. ElectroDruid

    SDL - Recommended GUI library?

    Are there any other suggestions? I should probably have said in my initial post that I'm developing on Windows (with a plan to port to other platforms, but right now Windows is the main platform) - Guichan, although it claims to work on Windows, doesn't actually seem to have any Visual Studio project files, or any documentation to say how to get it to compile on Windows, which is a bit of an obstacle. I have no doubt that I could get it working with enough fiddling about, but given that the aim of using a 3rd party GUI library is to reduce the headache involved in building a level editor so I can focus on the game engine and gameplay content, it seems a bit counter-productive.
  5. ElectroDruid

    Where to get OpenGL 1.4?

    Thanks guys, my bad. I don't know how I managed to read the forum FAQ and not see that question...
  6. This seems like a really newbie-ish question, and I should know the answer, but it's not in the FAQ and it's not obviously findable with Google. Where do I get OpenGL 1.4? I can't seem to find any downloads on opengl.org, and my copy of Visual Studio 2008 only seems to come with the headers and DLLs for version 1.1... So, where does it come from? I just want gl.h, glu.h and the appropriate DLLs. I'm clearly being retarded and I'm sure the answer is embarassingly obvious, but please humour me.
  7. ElectroDruid

    Blending to simulate real-world paint?

    Wow, I've just had an immensely educational couple of hours of Googling based on that post. Thanks, Sneftel! I've found this: http://www.dtc.umn.edu/~gossett/publications/ryb_TR.pdf Which contains source to convert from RYB to RGB via a colour cube. It's not perfect, but it looks easily good enough for my purposes. So, if I've got this right, my process goes something like: 1 - Represent the stuff I want to blend as an RYB tristimulus, which still involves using 3 floats to define the colour, but pretending that the second one means "Yellow" rather than "Green". 2 - Perform a subtractive blend between my shapes with glBlendEquation(GL_FUNC_SUBTRACT) 3 - Grab the resulting image, and apply the code from that white paper to convert the pixels from RYB to RGB. Clear the colour buffer and display this RGB image. Does that sound right? And if it does, is there something I can do to achieve better performance than post-processing every pixel individually in software? A shader, or some kind of clever OpenGL blend filter thing I don't know about?
  8. Forgive me if my colour physics is a bit ropey, but this is how I understand it... With computer graphics, we make colour by mixing light. The primary colours are red, green and blue, and (for instance) you get yellow by mixing red and green. But this isn't how mixing paint works in the "real world". Paint (and other physical objects) appear the colour that they do because of the freqencies of light which they reflect - a blue object appears blue because it absorbs all light except blue. With real-world paint, the primary colours are red, yellow and blue, and you get green by mixing blue and yellow. My question is, is there a cunning way to use OpenGL blending to simulate this? Can I have a yellow shape and a blue shape create green when they mix, along with the variety of other differences (I haven't played with real-world paint for a long time, but I seem to recall that mixing red and blue in equal quantities gives purple, not magenta - similar shades of colour, but not quite the same)? I've been wondering if there's something clever that can be done with subtractive blending, to switch between RGB and CMY, but I can't quite wrap my head around how to use it properly.
  9. Hi, I've just switched my game project over from using GLUT to using SDL, which means as far as I can tell, I'll need to redo the GUI which I'd built using GLUI. It seems that GLUI is dependant on GLUT, so I'm not sure I can get it working under SDL (if anyone knows a way to do it, though, that would be cool). I don't need anything particularly fancy - the GUI I was using was for a level editor, some onscreen debugging options, various developer-type stuff, rather than anything that's likely to appear in the final game. I've looked on the SDL site, and there are a staggering number of GUI libraries, so many that I don't really have time to download or assess them all to know which is the "best", or even which ones are simple/flexible/powerful enough to be usable. So I thought I'd ask here - has anyone used any of the SDL libraries? Which ones are recommended, and which are best avoided?
  10. Hi, I've recently managed to port my work-in-progress OpenGL game from using freeglut to using SDL. Since parts of my physics code are particularly processor intensive and I have to keep an eye on performance, I ran the new SDL code through a performance profiler (LTProf), and found that SDL_GL_SwapBuffers() seems to be taking up a fairly shocking amount of the processor time - about 25%, compared to my old glutSwapBuffers(), which didn't even register as anything more than a fraction of a percent. I've done a bit of Googling, and found a few threads like these: http://forums.indiegamer.com/archive/index.php/t-7385.html http://www.gamedev.net/community/forums/topic.asp?topic_id=224487&whichpage=1� So, to answer some of the questions that came up there (and some others that might get asked): - My old code disabled VSync using wglSwapIntervalEXT(). In the SDL code, I'm still using that to disable VSync, but I've also added SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0) just to make sure. - I'm using double buffering with SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1) - I don't call glFlush() or glFinish() anywhere in my code. - LTProf seems to think that most of SDL_GL_SwapBuffers() is spent calling SDL_FreeWAV(), which is really weird because that's obviously not called from SDL_GL_SwapBuffers(). Just a mistake/red herring on LTProf's part? - I don't yet have timers back in and working in order to display how long is actually getting spent in SDL_GL_SwapBuffers() in milliseconds, or to display my current framerate in actual FPS, but I plan to. - I'm using Visual Studio 2008. I built the SDL library myself, from source. The only change I made was to switch the SDL runtime from using msvcrt.lib (/MD) to libcmt.lib (/MT) because I couldn't get the game to link otherwise. Anyone encountered anything like this before? Does anyone know what I could try next to track down the source of the problem?
  11. ElectroDruid

    Linker Errors

    Those instructions don't seem to come from the IDE I'm using (Visual Studio 2008, for what it's worth). I don't have a Settings option in my Project menu, for instance. I ended up grabbing the full SDL source code (rather than just a precompiled DLL and headers, which I had been using), and ignoring the instructions to build using /MD, choosing /MT instead. I didn't think it would work, but it has. I still don't really understand the difference between the different runtimes, and I'd like to, but everything is working for me at least. Of course I've got other problems now, but that's a different story :)
  12. ElectroDruid

    Linker Errors

    That explained some of it, and I've looked up what Microsoft has to say about it here: http://msdn.microsoft.com/en-us/library/abx4dbyh.aspx , but I still don't quite know what's going on or what to do about it. My "Runtime Library" option is set in the project properties as "Multi-Threaded (/MT)" (or /MTd for debug builds), so I guess my project uses libcmt.lib (or libcmtd.lib). I don't do any multithreading in my code, but perhaps it happens in some of the libraries - either way, it's what the default setting was when I started the project, and it's not proved to be a problem up until now. So... This linker error is telling me that "something" is using /MD, msvcrt.lib, and that it shouldn't be - is that right? If so, how do I tell what that "something" is? I'm guessing that SDL is the culprit because that's what I'm putting into the project, but I'd rather have a way to know these things than to just guess. Assuming it is SDL, what can I do? Download the source code and try to compile an SDL DLL using /MT instead of /MD? Will that even work?
  13. ElectroDruid

    Linker Errors

    I suck at knowing how linkers work. I gather that this problem, or variants of it, are relatively common, but I don't know how to deal with it. I'm working on a game which makes use of several external libraries (OpenGL, GLUI, jpeg, audiere, and Box2D), and I've been trying to switch the base code to manage the window and input from freeglut to SDL. I've got everything compiling properly after the switch to SDL, but I've got the following linker errors and I don't know how to fix them: 1&gt;msvcrt.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj) 1&gt;msvcrt.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj) 1&gt;msvcrt.lib(MSVCR90.dll) : error LNK2005: _exit already defined in LIBCMTD.lib(crt0dat.obj) 1&gt;msvcrt.lib(MSVCR90.dll) : error LNK2005: _strrchr already defined in LIBCMTD.lib(strrchr.obj) 1&gt;msvcrt.lib(MSVCR90.dll) : error LNK2005: _fprintf already defined in LIBCMTD.lib(fprintf.obj) 1&gt;msvcrt.lib(MSVCR90.dll) : error LNK2005: _fclose already defined in LIBCMTD.lib(fclose.obj) 1&gt;msvcrt.lib(MSVCR90.dll) : error LNK2005: __isctype already defined in LIBCMTD.lib(isctype.obj) 1&gt;LIBCMTD.lib(crt0init.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library Any ideas?
  14. ElectroDruid

    freeglut and GLUT_ALPHA

    Okay, the best way I can explain it is by showing the code I'm trying to do under freeglut. Basically, take this (quite small and simple) code for rendering 2D metaballs: http://electrod.ifreepages.com/MetaballsSrc.zip (if the link doesn't work, copy and paste it into your browser address bar, seems to work that way). If this code is run under freeglut instead of GLUT, when the metaball particles are rendered to the texture (RenderTex), the texture ends up with an alpha of 1.0f all over, which means that the alpha test when rendering the texture to the screen doesn't work properly, and the particles appear with fuzzy edges instead of clean solid ones. You get exactly the same results by removing the GLUT_ALPHA from the glutInitDisplayMode when running under GLUT. I've Googled this a bit, and it seems like it's a know issue with freeGlut, but one which nobody is apparently motivated to fix. So my question is whether there are any known workarounds, and failing that, what the best choice of a GLUT/freeglut replacement is.
  15. I don't hold out much hope with this, having looked into a bit, but it doesn't hurt to ask, I suppose. I'm working on a game that uses freeglut, and I've just run into what appears to be one of those known-bugs-that-nobody-intends-to-fix problems, in that if you try to do something like: glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA); freeglut just ignores the GLUT_ALPHA part, so when I do a render-to-texture, it gives me a texture where all the alpha values are 1.0, even though that's not what it should do. (For those wondering why I'd want such a thing, I'm trying to port this technique for 2D metaballs - http://www.gamedev.net/community/forums/topic.asp?topic_id=484576 - into a new project). So, does anyone know any workarounds? I'd go back to the original GLUT, except that freeglut does some stuff (like glutMouseWheelFunc, which I'm using) which the original one doesn't. Is there a way to get GLUT_ALPHA working in freeglut (or, I suppose, a way to get glutMouseWheelFunc working in GLUT), or am I just going to have to abandon the whole endeavour and use another GL-friendly framework which allows me to do both things? If I have to use another framework, what would you recommend? And how would I go about setting up that framework to include alpha in the colour buffers?
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!