Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About Electron

  • Rank

Recent Profile Visitors

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

  1. Why is GameDev doing this to me?! Well, the upper post was, naturally, from me.. And here is the missing links Image 1 Image 2
  2. Eric, The problem is that i do not want to remove ALL depth buffer data, only reset it in the door. And Orangytang: This is not doable either. It is true that i must use the stencil buffer to only write in the doorway, but i still want the room behind the doorway to have proper depth culling. This is not doable unless i reset the depth buffer in the doorway to ZFar. And i cannot clear the ENTIRE depth buffer either, since i need the depth information of the whole scene in order to render it correct.
  3. This is just an update, in case other need to use this as well... do NOT use glDepthRange(1.0,1.0) !! I did so, and it worked fine on my stationary computer (Radeon 9000), but on my laptop (Mobility radeon 9000), all hell broke loose! What i eventually found out is that glDepthRange(1.0,1.0) probably makes some divide-by-zero in SOME graphics drivers. to avoid this entirelly, use glDepthRange(0.9999999,1.0) instead. You will not reset the depth buffer entirelly, but at least it doesn't try to divide by zero. Anyway, thanks for the quick responces!
  4. Guess the subject says it all. I want to render a polygon (or polygons =), and wherever it is drawn, it will set the depth buffer to ZFar. (How) can i do this using native OpenGL? (I.E, NOT using vertex shaders) I tried using glPolygonOffset, but it is mainly used as, well, offset - and i cannot set a value that will guaranteed set the depth buffer to zfar, since it works on a metric relative to the distance to the screen. Thanks in advance.
  5. Electron

    C++ / Win32 and Mem. Usage

    Check what .lib files you include into your project. visual studio loads a whole bunch by default.
  6. Electron

    C++ / Win32 and Mem. Usage

    If you use Visual Studio, try and turn of debug mode. That probably removes a significant amount of that memory.
  7. Electron

    cunfusion with classes

    Make a definition (or whatever it's called) a.h: #include "b.h" class B; //B definition class A { public: B *b; //pointer to a B-class }; b.h #include "a.h" class A; class B { public: A *a; //pointer to a A-class }; Note that you cannot make a real instance of A in B and vice-versa at the same time. Think about it if you would. You declare a class A which declares a class B which declares a class A which declares... no memory in the world would be enough =) So if you want both to know eachother, use pointers.
  8. Electron

    Singleton Confussion

    I see no problem with Forty_Two's example code. Of course it will work. Well, depending on the definition of CSomeSingleTonClass of course. class CSomeSingletonClass { public: static int iValue; }; int CSomeSingletonClass::iValue; This would make your code run just fine, and iValue is the same on both instances. This example is pretty unusefull, but it doesn't take much more code to MAKE it usefull! Take a look at this version: template <class T> class Singleton { public: static T instance; }; template <class T> T Singleton<T>::instance; This very small class can do wonders! Singleton<Logger> logger; Singleton<Logger> alsoTheLogger; &logger.instance == &alsoTheLogger.instance //Hell yeah! (always true) logger.instance.report("General failure trying to read from file"); ..Or why not: class Logger : public Singleton<Logger> { public: void report(char *str); }; int main() { //Even no need to create an instance of the object. Logger::instance.report("Starting up"); };
  9. Electron

    Damn Coordinate Systems ...

    I guess that maya uses carthesian coordinates (X,Y,Z), so the only thing that would differ would be scaling factors (Maybe negative, to reverse Z direction, for instance) and perhaps flipping the Y coordinate with Z coordinate. Other than that, I don't really know what you mean by "world coordinates"? Does it appear in the center of the world all the time? Then it's not an error. Just use glTranslate() to move it to the right location.
  10. Electron

    threads and stuff

    Quote:Original post by Prozak Quote:Original post by Wickeeed I dun read book's, but thx anyway ^^ You don't read books? I have a feeling you're not going very far in the game industry... That's a very bold sentence. There are many ways in learing and the single best is just try it out. I can't say i'm in the industry, but i do have knowledge in it, and the only book i owned and read about the topic is the OpenGL Reference manual.
  11. If it is a string, the the problem is (probably) not the receiever, but the sender who forgets to end the string with a NULL character. If you copy the string with strlen or something, notice that the string actually must be strlen()+1 in size, in order to include the NULL character. Or just put the NULL character in manually. void setMsg(CMessage* pMsg, unsinged char str) { pMsg->m_szData = new unsigned char[4096]; for (int i = 0; i < strlen(str); i++) pMsg->m_szData = str; pMsg->m_szData[strlen(str)] = 0; //Add the NULL character };
  12. Electron

    Floating point consistency?

    I have no idea, but i find it hard to believe that the floating point internal representation may differ on the same computer architecture. (You both are using PC's?) What you can do is to create a static point class and use that instead. Works slower, of cource, but at least you know the internal representation. Are you using random numbers? Make sure you set a seed number (a constant number in your case).
  13. Thanks Fruny. I guess that i have to live with that solution. As i see it, ther is no workaround, especially after what Neophyte mentioned. And to Anonymous poster: I know it might look weird, but believe me it's fully legit. To easen you grief, i'm gonna explain what i'm trying to do: I am building a singleton system, but a slight more advanced singleton than the usual type singleton template <class T> class singleton { private: static T instance; public: T &operator() () {return(instance);}; } What i am aiming for is a singleton system that creates a singleton for a specific class AND a specific parameter! My goal is to be able to use the system like this: singleton<int> a; singleton<int> b; //same as a singleton<int,OneParameter<int,int,5> > c; //unique singleton<int,OneParameter<int,int,6> > d; //unique singleton<int,OneParameter<int,int,5> > e; //same as c cout << a() << endl; //No idea what it will print. (Probably a compiler error =) cout << b() << endl; //No idea, but the same as a. cout << c() << endl; //5 cout << d() << endl; //6 cout << e() << endl; //5 c() = 99; cout << e() << endl; //Note that i call e, not c. But it will still print 99. where OneParameter = template <class T, class PT, PT parameter> class OneParameter { public: static T *instanciate() { return(new T(parameter)); } }; Of course, there are also classes like NoParameter (which is defult if no creator class is defined) and TwoParameters, etc ...and The MAIN goal is (well was) to use it like void createAsteroid() { Entity *newentity; //The ONE and ONLY instance of the asteroid model! //It's there for availability during the entire execution, //and it's ONLY LOADED ONCE! singleton<MD2_Model, OneParameter<MD2_Model,char*,"data/asteroid.md2"> > asteroid; newentity = new Entity(); //Set some properties newentity.position.set(0,0,0); newentity.model = &asteroid(); //point to the asteroid model //..and this is the world handler sigleton. Only one, and //VERY easy to reach. singleton<WorldHandler> worldhandler; worldhandler().addUnit(newentity); };
  14. No, at this moment it doesn't matter wether i put char* or const char* Of course i should use const char* for better usage span, but right now it doesn't work in any way. And using a string class is not good either. First of all, a template class cannot handle a struct or union as parameter, so if i want to use string, i am forced to use a *pointer* to a string.
  15. Hi! This is what i want to do: //The class... template <char *parameter> class Test { public: void print() {cout << parameter << endl;}; }; ...And in the main file: Test<"GET THIS!"> instance; instance.print(); //Should print "GET THIS!" ..But the stupid compiler just says: "Invalid expression as template parameter". I can imagine why. I guess that a hard-coded string may not have it's type as a char*, ut it's absolutelly castable! What can i do to pass a string to a template parameter WITHOUT having to create a global variable with the suitable type to make it work? Basically, what i want to do is: AnyClass<"MyString"> anyInstance;
  • 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!