Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

246 Neutral

About Kalasjniekof

  • Rank
  1. Kalasjniekof

    OpenGL Better 3D Feeling

    Try casting a shadow(volume) from the icons to the back of the screen, so it is more obvious at what depth the icons 'float'.
  2. Kalasjniekof

    Rotation from 0 to 360 Degree

    The following code is untested and probably not the best possible sollution for you problem. On the positive side: it should work! int c = int(counter) + 65536; int angle = c %360;
  3. Kalasjniekof

    SDL and GL in VC6

    Quote: **EDIT** okay, I have to include the <windows.h> also. Why can I use DevC++ without including windows? No you don't, including windows.h will make it impossible for your app to run in other os's than windows (the reason you want to use SDL to begin with...). In your SDL include directory is SDL's version of the gl header: sdl_opengl.h. Use that one instead, as it doesn't require platform-specific headers (like windows.h) EDIT: you'll still have to link to opengl32.lib, as usual.
  4. Kalasjniekof

    inheritance + operator overloading?

    Wow, that was fast... Thanks for the help guys! Every time I think I'm starting to know c++ something like this pops up :S
  5. Hello everyone, for a math library I'm writing for my personal projects, I'd like to overload some operators. I'm familiar with the syntax, but the compiler outputs an error I can't understand. Below is a (contrived) snippet to illustrate what's wrong. I'm working in Visual C++ 2005 Express, if it matters. //main.cpp #include <iostream> #include <string> #include <boost/lexical_cast.hpp> class Works { public: std::string operator *(const std::string& str) { return str; } std::string operator *(int i) { return boost::lexical_cast<std::string>(i); } }; class Base { public: std::string operator *(const std::string& str) { return str; } }; class Der1: public Base { }; class Der2: public Base { public: std::string operator *(int i) { return boost::lexical_cast<std::string>(i); } }; int main() { Works w; std::cout << w * "Test" << std::endl; //works fine. std::cout << w * 315 << std::endl; //works fine.. Base b; std::cout << b * "Test" << std::endl; //works fine... Der1 d1; std::cout << d1 * "Test" << std::endl; //works fine.... Der2 d2; std::cout << d2 * "Test" << std::endl; //BOOM! ERROR! std::cout << d2 * 315 << std::endl; return 0; } I try to overload the * operator in class Der2 while I allready overloaded it in it's base class (Base). Quote:error C2679: binary '*' : no operator found which takes a right-hand operand of type 'const char [5]' (or there is no acceptable conversion) .\main.cpp(42): could be 'std::string Der2::operator *(int)' while trying to match the argument list '(Der2, const char [5])' The strange thing is, when I overload the operators both in the same class this error doesn't show up. Can anyone point out what I'm doing wrong? Thanks in advance!
  6. Kalasjniekof

    Manipulating a specific pixel

    Quote:Original post by baykalsa Well, I don't why it is sooooo important for you, but I will make a pattern recognition program(neural nets). I need to know how to change a pixel. It's sooooo important for me because having a context for your problem can help us a lot in finding a solution for you, or for providing alternate approaches as I will do. I take it that you will use this pixel changing to draw connections between the nodes? This is a wild guess as you still did not provide a lot of information. Anyway, if the above scenario is correct a better option would be to use glLines to draw them (obviously). Another guess would be that you want to use the technique to render some sort of 'action-potential' effect. In that case your initial approach (ps) should be the best option. As you can see from the above, more information is absolutely a good thing if you want us to help you. Reread your first post. It doesn't give us much of a context, does it?
  7. Kalasjniekof

    Manipulating a specific pixel

    If you care to answer: why do you WANT to change a single pixel? At a resolution of 1024x768 you have 786,432 pixels. Do you think changing a single pixel will make a significant addition to the graphical quality of your scene?
  8. This could be done using member-function-pointers, but they are a bit crippled to say the least. Use boost::function instead.
  9. Kalasjniekof

    A relatively new C++ Coder looking for a lot of help!

    Original post by Captain P #include <conio.h> #include <windows.h> void level::gotoxy(int x, int y) { HANDLE hConsoleOutput; COORD dwCursorPosition; dwCursorPosition.X = x; dwCursorPosition.Y = y; hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorPosition(hConsoleOutput,dwCursorPosition); } [/quote] I'm not sure what the overhead of GetStdHandle() is, but wouldn't this run way faster? #include <conio.h> #include <windows.h> void level::gotoxy(int x, int y) { static HANDLE hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); COORD dwCursorPosition; dwCursorPosition.X = x; dwCursorPosition.Y = y; SetConsoleCursorPosition(hConsoleOutput,dwCursorPosition); }
  10. Kalasjniekof

    how to render model on control ?

    Please elaborate :D What kind of model? Which language? Which GUI-API? Which 3D-API?
  11. Kalasjniekof

    Has Nintendo taken 2 steps back for 1 fore?

    Quote:Original post by capn_midnight What is unique about the Wii that such an input device couldn't be made for any other existing console? Are you seriously suggesting that Nintendo has packaged an entire console just to make sure a peripheral sells properly (historically, niche peripherals do not sell well. Look at light-guns and flight yokes). And the PS3 is getting a motion sensing controller. Sure, it's copy-catism, but it shows that the Wiimote isn't *that* revolutionary if another company has pretty much the same product at the same time. Great point! I'm getting the idea the entire reason that Nintendo is focussing on input devices is that they just don't have the money to compete in graphics. Think about it; The PS3 and 360 were developed by companies that have substantially more resources than Nintendo. I've heard rumors that both Sony and Microsoft are creating Wii-like controllers. Do you agree with me that Wii is doomed when these come out?
  12. Kalasjniekof

    inheritance.. cant access private members

    Can you please tell us what kind of errors you are getting? Anyway, I'd like to point out that engine v8 = new engine(2,3); won't work. You are trying to allocate memory on the heap while v8 is allocated on the stack. Either choose engine v8 = engine(2,3); or go for engine* v8 = new engine(2,3);
  13. This is really as simple as: int first = 0x2; int second = 0x6; int result = first * second; which will result in 0xC. If you want to DISPLAY these nummers in hex in the console though, you can try this: std::cout << std::hex << result << std::endl; Pass std::hex to std::cout to make it display numbers in hexadecimal form. Similarly there is a std::dec to return to decimal display mode.
  14. Kalasjniekof

    NeHe tutorial 10

    OpenGL is essentially a state-machine so setting the "polygonmodestate" somewhere in your code will keep it that way untill you change it again. Therefore it doesn't matter where you set the state, just make sure it happens before rendering and after the context has been created. EDIT: in taby's code GL_SOLID should be GL_FILL (GL_SOLID doesn't exist)
  15. Please specify the language you're using. Seeing you've used the 'new' keyword and C syntax I'm guessing it's C++. Anyway, a major improvement would be to use std::vector<classModel or classModel*>. This will give you an array that can resize itself automatically as needed. On top of that, it would be a good idea to encapsulate the array and methods to manage it in a 'classModelCollection' or something.
  • 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!