• Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About Odiee

  • Rank
  1. Projectile theory

    Hello. I I'm at the position in my project where I need to do projectile calculations (bullets, bombs etc.) for a dual stick shooter. (player shoots at the direction of mouse position) Previously I was using the Bresenham's line algorithm for fast calculations of points from A to B. Where a would just draw pixels or some bitmap. But as I'm now working in OpenGL and with floating points this is no longer an option. I figured I would need starting point A(x,y,z) and Direction point B. And I would need to calculate all the points from A through B until timer ends or some other event (collision etc.) And put a bitmap at each point. But this is where I'm stuck. I don't know what to use, or weather I'm even right on the theory part. Is there someplace I could learn about this topic?
  2. RenderManager questions

    As for the first question. The rendering mechanism I use (for now) is a part of my engine and I'm afraid it's just a single function with render list of objects to be rendered. [QUOTE] If you have some asset data, say a mesh. Do you load the file into memory, transfer it to the GPU (VBO) and free the memory or do you have a different approach? [/QUOTE] I built an "assetManager" object that loads all assets at initialization from files on the disk. The assets (depending on the ID) are then placed in model objects along with points and u,v coordinates and texture_id for each point. I can then ask the "assetManager" object to create each of the objects I need (and are already loaded). This way objects are loaded only once for each model and created as a copy of the template model. i.e. I want 10 building objects. I ask "assetManager" for 10 new buildings, set their position on the scene, put them in the render list and viola I have 10 objects at the price of one. That's the theory anyways.
  3. I have trouble with text positioning of FTGL fonts. Text always appears in the bottom left corner of the screen. I tried pretty much every example on the net. (including FTGL search on this forum) but my text still remains on the same place. I set up my projection view like this [code] GLfloat aspectRatio; glViewport(0,0,w,h); // 640 x 480 glMatrixMode(GL_PROJECTION); glLoadIdentity(); aspectRatio = (GLfloat)w / (GLfloat)h; gluPerspective(60,aspectRatio,1.0,400); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); [/code] I tried translating, rotating, push/pop matrix, and also changing to ortho projection. Only when I use glRaster2f(0.0f, 0.0f); text completely disappears from the screen.
  4. Hi. I'm developing some basic top-down twin stick shooter and I need help about some basic theory stuff. What is the best mesh format for loading static geometry (like houses, cars etc.) in opengl? I'm using md2 for the character models. Should just use it for the static models as well? Also, what about level loading/rendering?
  5. I find [url="http://staruml.sourceforge.net/en/"]StarUML[/url] extremly useful but alas as someone already said writing documentation goes against our nature. So I usually just write a few lines before the function like who calls it and stuff. And some code comments on more complicated parts. There were about 10K times I can remember thinking "God wish I wrote comments here!"
  6. [quote name='tom_mai78101' timestamp='1314693989' post='4855356'] It's because Java have its own libraries (packages) bundled together, while C++ requires you to go out and find libraries to work with (requires downloading and linking). Everything is all included with JDK of Java, so it's easier to begin taking the first steps in programming. As for C++, you not only have to learn the syntax and stuffs, but also have to learn your preferred library's API documentation and usage of completely unfamiliar functions, making you a bit busier than Java alone. And I right about this? Correct me, if not. [/quote] May I remind you that you still have to learn the Java syntax and stuffs and still have to download it and still have to learn the net code. Also I find it rather nice to have few net libraries to chose from and not to be stuck with one they tell me I must use. I don't use Java so I don't know if there are more new libs for it out there. I work at the intelligent building industry and we provide communication software we built to control and monitor all of the building devices (independent of the protocol in use). Some mid scale building can have thousands of those devices from IR sensors to large cooling systems. Needles to say communication and stable net code is extremely important. (one false state could evacuate the building or call the cops and stuff). I'm under NDA regarding the tech inside but I can say that we use [url="http://en.wikipedia.org/wiki/Adaptive_Communication_Environment"]ACE[/url] for client/server communication. And this net lib literally enables you to write client/server software in 10 lines of code. We use both, C++ and Java in different aspects of the tech. Hmm I wondered offtopic a bit. Basically there are pros and cons of both languages. Just stick to whichever you like best. Java guys at my company calls us masochists, we call them pussies. Then the workday is over and we all go drink together.
  7. OpenGL Texture doesn't show

    My.God. The.Horror. Thanks. I now See the OGL SuberBible has chapters that go from 8:Texture Mapping Basics to 9: Texture Mapping Beyond the Basics and one of the last thing that ch8 talks about is MipMapping. So when i finished this chapter I restructured my code from the beginning and thus failed to notice the mipmapping bit. I thought nothing would happen. Now I feel like playing the adventure game and I cheated for going to net for solution when it was right at front of me this whole time. Thanks again.
  8. Hi. I am unable to see loaded textures no matter what I try to do. I followed all the steps thoroughly but I'm still unable to see any textures on the object I draw. I'm using SDL and the opengl SuperBible v4 code for practice. Here are some specific code excerpts in order of function call. Init SDL [code] int system_InitSDL(int w, int h) { if (SDL_Init(SDL_INIT_VIDEO) != 0) { gData->AppendLog("I_cEngine::system_InitSDL: SDL_Init(SDL_INIT_VIDEO): -1"); return -1; } const SDL_VideoInfo* info = NULL; info = SDL_GetVideoInfo( ); int bpp = info->vfmt->BitsPerPixel; SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, bpp ); SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); screen_ = SDL_SetVideoMode(w,h, bpp , SDL_HWSURFACE | SDL_OPENGL); if (!screen_) { gData->AppendLog("I_cEngine::system_InitSDL: SDL_SetVideoMode(%d,%d,%d, SDL_HWSURFACE | SDL_OPENGL): NULL",w,h,bpp); return -1; } return 0; } [/code] Init OGL [code] void system_InitGL(int w, int h) { GLfloat aspectRatio; glViewport(0,0,w,h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); aspectRatio = (GLfloat)w / (GLfloat)h; gluPerspective(45,aspectRatio,1.0,400); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glEnable(GL_TEXTURE_2D); system_LoadTextures(); // Enable Texture Mapping ( NEW ) glShadeModel(GL_SMOOTH); // Enable Smooth Shading glClearColor(0.25f, 0.25f, 0.25f, 1.0f ); // grey backsurface glClearDepth(1.0f); // Depth Buffer Setup glEnable(GL_DEPTH_TEST); // Enables Depth Testing glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations } Load textures is called from initOGL function above [code] int system_LoadTextures(void) { GLint nOfColors; GLenum texture_format; gData->AppendLog(" I_cEngine::system_LoadTextures:"); // Load this texture map SDL_Surface *image[1]; image[0] = SDL_LoadBMP("res/nehe.bmp"); // get the number of channels in the SDL surface nOfColors = image[0]->format->BytesPerPixel; if (nOfColors == 4) { if (image[0]->format->Rmask == 0x000000ff) texture_format = GL_RGBA; else texture_format = GL_BGRA; } else if (nOfColors == 3) // no alpha channel { if (image[0]->format->Rmask == 0x000000ff) texture_format = GL_RGB; else texture_format = GL_BGR; } else { printf("warning: the image is not truecolor.. this will probably break\n"); } glGenTextures( 1, &textureObject[0] ); glBindTexture(GL_TEXTURE_2D, textureObject[0]); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); GLint iWidth, iHeight, iComponents; GLenum eFormat; glTexImage2D( GL_TEXTURE_2D, 0, 3,image[0]->w,image[0]->h, 0, texture_format, GL_UNSIGNED_BYTE,image[0]->pixels ); SDL_FreeSurface(image[0]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); return 0; return 0; } [/code] Render function is standard bind tex and draw box stuff [code] glBindTexture(GL_TEXTURE_2D, textureObject[0]); glBegin(GL_QUADS); /* Front Face */ /* Bottom Left Of The Texture and Quad */ glTexCoord2f( 0.0f, 1.0f ); glVertex3f( -1.0f, -1.0f, 1.0f ); /* Bottom Right Of The Texture and Quad */ glTexCoord2f( 1.0f, 1.0f ); glVertex3f( 1.0f, -1.0f, 1.0f ); /* Top Right Of The Texture and Quad */ glTexCoord2f( 1.0f, 0.0f ); glVertex3f( 1.0f, 1.0f, 1.0f ); /* Top Left Of The Texture and Quad */ glTexCoord2f( 0.0f, 0.0f ); glVertex3f( -1.0f, 1.0f, 1.0f ); /* Back Face */ /* Bottom Right Of The Texture and Quad */ glTexCoord2f( 0.0f, 0.0f ); glVertex3f( -1.0f, -1.0f, -1.0f ); /* Top Right Of The Texture and Quad */ glTexCoord2f( 0.0f, 1.0f ); glVertex3f( -1.0f, 1.0f, -1.0f ); /* Top Left Of The Texture and Quad */ ... ... [/code] Now, what did I messed up. Because I really want to know. I've been 5 days on this code restructuring it and rewriting it and stuff. Thanks in advance.
  9. Hi. I'm doing my selection of objects rendered on screen by using glPushName(object[c].name); object[c]->draw(); glPopName(); But this is proving to be very slow. ie I can crash the application by maniacally clicking all over the screen. On slower computers it can wait for a half a second or more just to print the name number. Is this supposed to be so slow or did I do something wrong?
  10. nevermind i figured it out.
  11. Hi. I'm using Glut for window/render... management. I'm building a opengl app where I load textures onto 2d surfaces represented as GL_QUADS. My programming logic is to execute threads called scenes animation. Each scene would have 'n' number of models and it's respected translations/rotations/whatnot, which would make up the scene animation. My problem is how to implement this in the "render" callback function. i.e glutDisplayFunc(render); i.e. I need to call specific "SceneAnimation" after some event occurs. Like user presses mouse button or something else. How do I merge this event into "render" callback function.
  12. Hi. I'm planning on building a city (or at least a few blocks of it) and I'm really falling behind with 3d programming so I have some questions about building large 3d worlds. Specifically, how is it done? Is there any reading materials on that subject? I'm planning on using Ogre3D for rendering, Blender for small/medium/large objects and Ogitor for terrain modeling. And I'm sure that it's slightly more complicated then just-load-the-models. I'm using C++ for programming and I'm pretty good with it.(I work as video surveillance and multimedia developer). But my 3D and gaming skills are still on 2D blitting-and-stuff level. ANY advice would be greatly appreciated.
  13. Beginning Game Programming

    I think what tracer0xa was trying to say is that you don't want to jump into the game programming head first but feel the general logic of programming through other languages and environments. True, he goes a little overboard with vi and emacs and some other things. But People who never programmed in their lives will not benefit if going straith away into some objective high level language such as C++ or C#, Java... I myself was in the dark waters when I first started with Qb but little by little I got it right. Then was Pascal and by the time I got to the C++ I didn't even had to learn it. It was natural extension to C which i was working in at that time. But It is not on us to tell someone which path to take. Some will do it tracer0xa's way, some chillypacman's, and some will take mine path. But what truly matters it that you don't ever lose that thing that motivates you to make games. As long as you have it, you'll make it.
  14. Hello. How do I reduce CPU power on my program? When I use while(quit) { while(SDL_PollEvent(&event) { ... } } CPU on that program goes to 48-50%. How do I achieve 0% while nothing is happening?
  15. I'm reading tutorials about picking and selecting of objects in openGL and it reads that this is done by naming and GL_SELECT rendering of objects. The list of hits is then stored in a buffer with hit's depth. It is also said that the selected object is the one closes to the viewer. (camera) But here's the question. What happens when 2 or more objects are in the same distance from the camera? Also I have 2 glspheres posistioned 5,5,0 and 10,10,0. Initialized like this for (int c=0;c<2;c++) { glPushMatrix(); glPushName(c); glPopName(); glPopMatrix(); } Hit is detected for each object but no data is in buffer. What did I do wrong?