Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About tieTYT

  • Rank
  1. I'm making a 1v1, turn-based online game. Should I have a timer on every turn so that if you take to long, your turn is skipped?
  2. tieTYT

    What do people see in Tekken?

    This is how you can tell if you're reaaaaaally bad at fighting games: You judge how bad a fighting game is by how easy it is to mash. This is the most irrelevant point on the planet. Being killed by a masher is a personal problem. All it means is you thought you were good and you weren't so you blame the game. Knowing the moves doesn't mean you deserve to win a single round. I consider that the starting point. When you know your moves so well that you can do them instantly without even considering them you are then allowed to call yourself a newbie. After that point, you learn how unsafe your moves are. IE: If you do this move, and he blocks it, what moves can he do that I can't block? After that, you learn what moves you can use to punish your opponent when you block one of his. IE: If you block this move, you can use this move and he can't block. After that, you learn the properties of your moves. That's right, although you kenw how to do this move, did you know that it goes under this move? Or that it goes over that move? Or that it goes sideways so that these moves can't hit you? After that you learn the properties of their moves. This move will beat that move. This move is hella gay and i can't do anything about it but block or step left. After that you develop common strategies. IE: After people block this move, they generally try to do this type of move, if they do that, i'll do this, and it will beat their followup. After you do that, you develop personal strategies. IE: John always steps this way so i'll make sure to do moves that track that way. Jane doesn't like to duck so i'll go low and throw against her whenever I can and that's how i'll win. After that, you develop strategies that do the opposite of your personal strategies because your opponents have experience against it. IE: Since Jane knows that I like to go low and throw against her, she's going to try to duck to counter that, so instead of going low where i normally would, i'm going to juggle her. That may be an unnecessarily long description of the strategy that goes on when people play tekken but it all goes to show that being beaten by a masher means you're around level 1/2 and you have no idea what you're doing (yet).
  3. great! It was actually a combination of those 2 errors. Using RGBA instead of RGB will cause a segmentation fault. I also think it's necessary to use 24bit depth to print out the bmp correctly. Anyway, seriously, thanks a lot for all the help. I didn't expect people to stick with my problem after it didn't get solved immediately, most people don't do that. Thanks again.
  4. I really appreciate the fast replies, thank you. But it's still just displaying a white box. I've changed the file a lot, i'd like to update the new version of it. I rotate this one constantly because it thought maybe the texture would be on the other side of it, but it appears to not be the case: #include <iostream> using namespace std; #include "button.h" Button::Button (int width, int height) { SDL_Surface *image; image = SDL_LoadBMP ("Play.bmp"); this->width = width; this->height = height; glGenTextures( 1, &texid ); glBindTexture (GL_TEXTURE_2D, texid); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, image->w, image->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, (image->pixels)); SDL_FreeSurface(image); } void Button::draw () { static float i = 0; glTranslated(0, 0, -300); glRotatef(++i, 0, 1, 0); glEnable (GL_TEXTURE_2D); glBindTexture (GL_TEXTURE_2D, texid); glBegin (GL_QUADS); glTexCoord2f (0.0f,0.0f); glVertex2i (0, 0); glTexCoord2f (1.0f, 0.0f); glVertex2i (128, 0); glTexCoord2f (1.0f, 1.0f); glVertex2i (128, 64); glTexCoord2f (0.0f, 1.0f); glVertex2i (0, 64); glEnd (); glDisable (GL_TEXTURE_2D); } thanks a lot for sticking with me guys. If it helps i'm on windows XP.
  5. Quote:Original post by Raduprv I notice that you use width and height, but you hardcoded the dimensions to 128x64: glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 128, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels); Can that be the cause? Also, are the dimensions a power of 2? Is it the right format? maybe you should try uncompressed BMPs, different color depths, etc. yes to all. Here are the properties of the file: w = 128 h = 64 hor res = 71 dpi ver res = 71 dpi bit depth = 16 frame count = 1 The SDL_Surface image is not null afterwards. It is filled with these properties. When i cout image->pixels it says this: 008C5078 Also, if i set the color to a different color before glBegin() it draws the box as that color. So it's kinda like it's ignoring the glTexCoord calls.
  6. and just in case, i'll add the main.cpp too. Thanks for any help you can provide :) /***************** Daniel Kaplan ******************/ #include "main.h" int VideoFlags = 0; // Video Flags for the Create Window function SDL_Surface * MainWindow = NULL; // drawing surface on the SDL window void SetupPixelFormat(void) { //////// SURFACE IS THE DRAWABLE PORTION OF AN SDL WINDOW \\\\\\\\* ///////////// we set the common flags here VideoFlags = SDL_OPENGL; // it's an openGL window VideoFlags |= SDL_HWPALETTE; // exclusive access to hardware colour palette VideoFlags |= SDL_RESIZABLE; // the window must be resizeable //VideoFlags |= SDL_FULLSCREEN; /********* <Diablo-D3> if you want to just go back to windowed, call SDL_SetVideoMode again without SDL_FULLSCREEN *******/ const SDL_VideoInfo * VideoInfo = SDL_GetVideoInfo(); // query SDL for information about our video hardware if(VideoInfo == NULL) // if this query fails { cerr << "Failed getting Video Info : " << SDL_GetError() << endl; // report error Quit(0); } ///////////// we set the system dependant flags here if(VideoInfo -> hw_available) // is it a hardware surface VideoFlags |= SDL_HWSURFACE; else VideoFlags |= SDL_SWSURFACE; // Blitting is fast copying / moving /swapping of contiguous sections of memory // for more about blitting check out : if(VideoInfo -> blit_hw) // is hardware blitting available VideoFlags |= SDL_HWACCEL; SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); // tell SDL that the GL drawing is going to be double buffered SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, SCREEN_DEPTH); // size of depth buffer SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0); // we aren't going to use the stencil buffer SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0); // this and the next three lines set the bits allocated per pixel - SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0); // - for the accumulation buffer to 0 SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0); SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0); } void SizeOpenGLScreen(int width, int height) // Initialize The GL Window { if (height==0) // Prevent A Divide By Zero error { height=1; // Make the Height Equal One } glViewport(0,0, SCREEN_WIDTH, SCREEN_HEIGHT); //glViewport(0,0,width,height); // Make our viewport the whole window // We could make the view smaller inside // Our window if we wanted too. // The glViewport takes (x, y, width, height) // This basically means, what our our drawing boundries glMatrixMode(GL_PROJECTION); // Select The Projection Matrix // Reset The Projection Matrix glLoadIdentity(); gluOrtho2D(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity(); // Reset The Modelview Matrix } void CreateMyWindow(const char * strWindowName, int width, int height, int VideoFlags) { MainWindow = SDL_SetVideoMode(width, height, SCREEN_DEPTH, VideoFlags); // SCREEN_DEPTH is macro for bits per pixel if( MainWindow == NULL ) // if window creation failed { cerr << "Failed to Create Window : " << SDL_GetError() << endl; // report error Quit(0); } SDL_WM_SetCaption(strWindowName, strWindowName); // set the window caption (first argument) and icon caption (2nd arg) } void MainLoop(void) { bool done = false; // is our job done ? not yet ! SDL_Event event; while(! done) // as long as our job's not done { while( SDL_PollEvent(& event) ) // look for events (like keystrokes, resizing etc.) { switch ( event.type ) // what kind of event have we got ? { case SDL_QUIT : // if user wishes to quit done = true; // this implies our job is done break; case SDL_KEYDOWN : // if the user has pressed a key keyboard(event.key.keysym.sym, 0, 0 ); // callback for handling keystrokes, arg is key pressed break; case SDL_KEYUP: keyboardUp(event.key.keysym.sym, 0, 0); break; case SDL_VIDEORESIZE : // if there is a resize event // request SDL to resize the window to the size and depth etc. that we specify MainWindow = SDL_SetVideoMode( event.resize.w, event.resize.h, SCREEN_DEPTH, VideoFlags ); //this line needs to be here for MS Windows //without it, the perspective matrix will get erased and //you won't be able to see the scene anymore SizeOpenGLScreen(event.resize.w, event.resize.h); // now resize the OpenGL viewport if(MainWindow == NULL) // if window resize has failed { cerr << " Failed resizing SDL window : " << SDL_GetError() << endl; // report error Quit(0); } break; default: // any other event break; // nothing to do } // switch } // while( SDL_ ... display(); // draw our OpenGL scene } } void Quit(int ret_val) { SDL_Quit(); // shuts down SDL stuff exit(ret_val); // quit the program } void ToggleFullScreen(void) { /*if(SDL_WM_ToggleFullScreen(MainWindow) == 0) // try to toggle fullscreen mode for window 'main_window' { cerr << "Failed to Toggle Fullscreen mode : " << SDL_GetError() << endl; // report error in case toggle fails Quit(0); }*/ } void initFrustum (void) { /* select clearing (background) color */ glClearColor (0.0, 0.0, 0.0, 0.0); /* initialize viewing values */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT); glMatrixMode(GL_MODELVIEW); } Button *b = new Button (128, 64); void display () { glEnable(GL_DEPTH_TEST); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); b->draw(); SDL_GL_SwapBuffers(); } //this checks keyboard presses void keyboard (unsigned char key, int x, int y) { } //this turns off the flags when the key is released void keyboardUp (unsigned char key, int x, int y) { } int main(int argc, char** argv) { if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) // try to initialize SDL video module { cerr << "Failed initializing SDL Video : " << SDL_GetError() << endl; // report error if it fails return 1; // we use this instead of Quit because SDL isn't yet initialized } //Run the GUI //GUI(); // Set up the format for the pixels of the OpenGL drawing surface SetupPixelFormat(); // Create our window, we pass caption for the window, the width, height and video flags required CreateMyWindow("Space Ball", SCREEN_WIDTH, SCREEN_HEIGHT, VideoFlags); //initialize the frustum SizeOpenGLScreen(SCREEN_WIDTH, SCREEN_HEIGHT); //SDL_ShowCursor(SDL_DISABLE); //we don't show the cursor in fullscreen //set the frustum initFrustum(); // Run our message loop MainLoop(); // quit main returning success return 0; }
  7. i've got this problem, my texture is only showing up as a white box, i thought i'd show you the source code maybe you can see the problem Button::Button (int width, int height) { SDL_Surface *image; image = SDL_LoadBMP ("missile.bmp"); this->width = width; this->height = height; glGenTextures( 1, &texid ); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 128, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels); SDL_FreeSurface(image); } void Button::draw () { glEnable (GL_TEXTURE_2D); glBindTexture (GL_TEXTURE_2D, texid); glBegin (GL_QUADS); glTexCoord2f (0.0f,0.0f); glVertex2i (500, 50); glTexCoord2f (1.0f, 0.0f); glVertex2i (628, 50); glTexCoord2f (1.0f, 1.0f); glVertex2i (628, 114); glTexCoord2f (0.0f, 1.0f); glVertex2i (500, 114); glEnd (); glDisable (GL_TEXTURE_2D); }
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!