frogtag

Members
  • Content count

    172
  • Joined

  • Last visited

Community Reputation

121 Neutral

About frogtag

  • Rank
    Member
  1. glBindVertexArray structure/protocol

    That answered my question perfectly, Was just looking further into learning the tutorials rather than just cut+paste. Thank you for your reply 
  2. Sorry that this is a basic question, but i've recently come back to programming opengl only to find 2.0 is now obsolete.   I understand that when setting up a VAO, you use this command   glBindVertexArray(array[0])   and the subsequent code is bound to it. but the tutorial i'm following just sets up the next VAO as follows   glBindVertexArray(array[1])   is this how VAOs work? you just use a glBindVertexArray command and what ever follows is bound to it? doesn't this mean the last used VBA is always open? can it (should it) be closed after setting it?   Cheers for any reply
  3. C++ Compiler

    [quote name='moNoKnoT' timestamp='1310386027' post='4833687'] VC++ Express 2010 is still free. You just need to register it and they'll send you a key which removes the time limit. - Kevin. [/quote] Fantastic! Thank you for your help
  4. C++ Compiler

    Hey, Been away from programming for past 6+ months. Was using vc++ 2008 on my old computer, which was completely free. Now I see there is vc++ 2010 express. I had a look at downloading it, but it says its a 30 day trial. Can anyone point me in the right direction for a free vc++ that isn't 30 day trail please.
  5. int pow not float?

    Cheers. Although the while loop was destructive to the div value, with a little alteration I removed the function and achieved the same result keeping div intact. for(int x=div; x > 0; x--) array_max *= 2;
  6. int pow not float?

    honestly I think I have OCD or something like it. I don't like floats because the calculations I'm using are ints and I don't like having to use the .0 But anyhow, cheers for the function.
  7. int pow not float?

    can anyone point me in the right direction for a power of function that uses ints not floats/doubles? eg 2 ^ 3 not 2.0 ^ 3.0 Thanks
  8. streams

    Hi can anyone tell me how I would physically open a text file using istream/ostream etc... I don't me open it to read but open the text file as if i had double clicked on the file icon?
  9. Fractal Landscape

    Can anyone point me to a good tutorial for learning and implementing fractal landscapes? Using C++/OPENGL/VC++ 2008 XP
  10. Elliptical Orbits

    Hi, I'm trying to program a simple solar system simulator (as a learning project). Can anyone direct me towards a good tutorial? Or give me the formula for the 3D co-ordinates for a single planet?
  11. Sand Dunes?

    I've been thinking about whether it would be possible to create a 3D sand dune environment. I'm not just talking about using a sand texture and mapping it to a wavey dune shaped mesh, but also about the possibilities of the sand reacting to movement, ie. sliding & leaving footprints. It's just a theoretical idea, but wondered what anyone thought about it? Does anyone know of someone who done this already?
  12. File Type?

    I've got a skeletal animation bone/joint framework hardwired within my program, but I want to put into a loadable file. Can anyone give me some starter points as to what would be the best way to go?
  13. I've done some preliminary research into AI, specifically ANNs. But I don't really understand the practical uses of ANNs in game programming, in regards to its ability to potentially mimic human thinking. Okay, I get the concept that you can use it in character recognition, but that has utility potential, not say for instance how a NPC will react to a situation. Can anyone give me some more practical usages in terms of NPC AI and/or direct me to some tutorials? At the moment I don't see the point in an ANN unless your interest is purely ANN research!
  14. Assumed SDL Problem?

    SOLVED the problem. Looks like SDL destroys the font class when it creates a new window so had to rebuild my font. If anyone wants to point me in the direction of a GOOD SDL font tutorial. That would be appreciated.
  15. Assumed SDL Problem?

    The only part of my program that is SDL is the open window function. The rest uses OpenGL. The program loop & messaging system was also change to SDL. I've included all the source below. The HUD is an independent OpenGL 2D layer that is displayed over the 3D OpenGL environment. The problem only occurs when I toggle the fullscreen. window.cpp #include "window.h" Window window; void Window::BuildWindow() { ShowCursor(false); if(SDL_Init(SDL_INIT_VIDEO) != 0 ) { MessageBox(NULL,"SDL_Init Failure\nFunction: BuildWindow()\nLocation: window.cpp\n",engine.windowname.c_str(),MB_ICONEXCLAMATION|MB_OK); engine.terminate = true; } 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_ALPHA_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_WM_SetCaption(engine.windowname.c_str(), engine.windowname.c_str()); window.Fullscreen(); } Window::~Window() { ShowCursor(true); SDL_Quit(); } void Window::ReSizeWindow(int width,int height) { if(height <= 0) height = 1; glViewport(0,0,width,height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f,(float)width/(float)height,1.0f,100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } void Window::Fullscreen() { int flags = SDL_OPENGL; if(engine.fullscreen == true) flags |= SDL_FULLSCREEN; SDL_Surface * screen = SDL_SetVideoMode(engine.resolutionwidth, engine.resolutionheight, engine.bits, flags ); if(screen == NULL) { MessageBox(NULL,"Screen Failure\nFunction: BuildWindow()\nLocation: window.cpp\n",engine.windowname.c_str(),MB_ICONEXCLAMATION|MB_OK); engine.terminate = true; } SDL_Event resizeEvent; resizeEvent.type = SDL_VIDEORESIZE; resizeEvent.resize.w = engine.resolutionwidth; resizeEvent.resize.h = engine.resolutionheight; SDL_PushEvent(&resizeEvent); } controls.cpp #include "controls.h" Controls controls; void Controls::ProcessEvents() { SDL_Event event; while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_QUIT: engine.terminate = true; break; case SDL_VIDEORESIZE: window.ReSizeWindow(event.resize.w,event.resize.h); break; } } Uint8 *keystates = SDL_GetKeyState(NULL); if(keystates[SDLK_F1]) { engine.fullscreen =! engine.fullscreen; window.Fullscreen(); } if(keystates[SDLK_END]) engine.terminate = true; if(keystates[SDLK_UP]) camera.Movement(-camera.speed,0); if(keystates[SDLK_DOWN]) camera.Movement(+camera.speed,0); if(keystates[SDLK_LEFT]) camera.Movement(+camera.speed,+90); if(keystates[SDLK_RIGHT]) camera.Movement(+camera.speed,-90); if(keystates[SDLK_q]) camera.yCoord += camera.speed; if(keystates[SDLK_a]) camera.yCoord -= camera.speed; if(keystates[SDLK_z]) camera.Rotate(-1); if(keystates[SDLK_x]) camera.Rotate(+1); if(keystates[SDLK_e]) NPC.eyelineH += 1; if(keystates[SDLK_d]) NPC.eyelineH -= 1; if(keystates[SDLK_r]) NPC.eyelineV += 1; if(keystates[SDLK_f]) NPC.eyelineV -= 1; if(keystates[SDLK_t]) { NPC.eyelineH = 0; NPC.eyelineV = 0; } } font.cpp #include "font.h" Font font("Arial",14); Font::Font(void) { fontface = "Arial"; fontheight = 60; } Font::Font(char* font,int height) { fontface = font; fontheight = height; } void Font::BuildFont(void) { HFONT font,oldfont; base = glGenLists(96); font = CreateFont( fontheight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, FF_DONTCARE|DEFAULT_PITCH, fontface); HDC hDC = wglGetCurrentDC(); oldfont = (HFONT)SelectObject(hDC, font); wglUseFontBitmaps(hDC, 32, 96, base); SelectObject(hDC, oldfont); DeleteObject(font); } void Font::Print(char *format, ...) { if(format == NULL) return; char text[256]; va_list args; va_start(args, format); vsprintf_s(text, 256, format, args); va_end(args); glPushAttrib(GL_LIST_BIT); glListBase(base - 32); glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); glPopAttrib(); } void Font::DeleteFont(void) { glDeleteLists(base, 96); }