• Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About drarem

  • Rank
    Advanced Member
  1. what game? game design

    btw, I wasn't bragging, I was trying to be funny. Back then if you said basic was a valid programming language you would have been laughed out of the conference room.
  2. what game? game design

    Quote:Think about the very core of game. You can make a game based around moving a dot on the screen and have a good chance no one's ever done it! I'm serious, why don't you make a game where you move a dot around the screen. Maybe dodge things, enemies, stuff. Err... sorry to say, I've done that already in the early 90's on my bro-in laws brand-new back then Tandy 1000 computer, using Tandy basic. At least I think that was the model. Feel free to improve on my dot and dodge game idea though ;)
  3. I set up aliases and iterate thru them, thanks.
  4. I'm using opengl and mciSendString(). I've managed to play a sound effect (MP3) - every time I hit or hold the mouse button down, it plays through one channel or track, so when I hit the mouse button before the sound ends, the sound effect is cut off and starts from the beginning. It's like someone hitting the same piano key over and over. I want to hit the same piano key on several different pianos, if that makes sense. How can I keep the sound effects from stepping on itself or other sound effects? Thanks.
  5. it runs slower on the laptop compared to my pc, i almost wonder if it is worth it. note: gl_texture_exts = GL_TEXTURE_2D
  6. I'm trying to gluscaleimage, it looks like it will be satisfactory. Here is the code, thanks for all the help. unsigned char *pImage_RGBA = NULL; unsigned char *pImage_RGBA_temp = NULL; if( pImage_RGB != NULL ) { SPRITES[id].x = 0.0; SPRITES[id].y = 0.0; SPRITES[id].txwid = ((float)(xsiz/framesx)/(float)xsiz); SPRITES[id].tywid = ((float)(ysiz/framesy)/(float)ysiz); SPRITES[id].xscale = (xsiz/framesx)/xscale; SPRITES[id].yscale = (ysiz/framesy)/yscale; for (dy=0; dy < framesy; dy++) { for (dx=0; dx< framesx; dx++) { SPRITES[id].prex[nptr] = SPRITES[id].txwid*dx; SPRITES[id].prey[nptr] = SPRITES[id].tywid*dy; SPRITES[id].prexa[nptr] = SPRITES[id].prex[nptr] + SPRITES[id].txwid; SPRITES[id].preya[nptr] = SPRITES[id].prey[nptr] + SPRITES[id].tywid; nptr = nptr + 1; } } int imageSize_RGB = xsiz * ysiz * 3; int imageSize_RGBA = powx * powy * 4; //store as power of 2 plus alpha int imageSize_RGBA_temp = powx * powy * 3; // allocate buffer for a RGBA image pImage_RGBA = new unsigned char[imageSize_RGBA]; pImage_RGBA_temp = new unsigned char[imageSize_RGBA]; int i, j; gluScaleImage(GL_RGB, xsiz,ysiz, GL_UNSIGNED_BYTE, pImage_RGB, powx,powy, GL_UNSIGNED_BYTE, pImage_RGBA_temp); for( i = 0, j = 0; i < imageSize_RGBA_temp; i += 3, j += 4 ) { // Does the current pixel match the selected color key? if( pImage_RGBA_temp[i] == g_keyColor[0] && pImage_RGBA_temp[i+1] == g_keyColor[1] && pImage_RGBA_temp[i+2] == g_keyColor[2] ) { pImage_RGBA[j+3] = 0; // If so, set alpha to fully transparent. } else { pImage_RGBA[j+3] = 255; // If not, set alpha to fully opaque. } pImage_RGBA[j] = pImage_RGBA_temp[i]; pImage_RGBA[j+1] = pImage_RGBA_temp[i+1]; pImage_RGBA[j+2] = pImage_RGBA_temp[i+2]; } glGenTextures( id, &g_Textureid ); glBindTexture( gl_texture_exts, id ); glTexParameteri(gl_texture_exts,GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(gl_texture_exts,GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexImage2D( gl_texture_exts, 0, GL_RGBA, powx,powy, 0, GL_RGBA, GL_UNSIGNED_BYTE, pImage_RGBA );
  7. Quote:Original post by JohnBSmall Quote:Original post by drarem 3) Here's where my math fails.. (512 - 384) = extra pixels not used = 128 64/384 isn't right, the uv coords would be off 64/512 isn't right either, uv coords would exceed the actual 384x256 image Is it how many 64 will go into 384, will go into 512? Maybe I'm being stupid, but why would 64/512 be wrong? (assuming this is to calculate the UV texture coordinate from the pixel coordinates, and not to adjust an existing UV coordinate, in which case you want what haegarr said: u *= w/w', v *= h/h') John B I don't know - I am confused. The tiles are 64x64 and stretch out to 384x256 (that is 6 rows x 4 columns). UVs for that is easy to calculate. 512/64 = 8 rows across but the tiles are 6x4. I thought it would be cutting them off. I'm researching the gl_texture_ext_arb stuff at the moment, trying to figure out how to calculate the 0...w out. Would that be 64/w or w/64 for each tile? EDIT: By the way, in the new texture I am padding the excess with white values - I have seen none crop up but the texture looks weird still.
  8. So I've created a small demo and noticed - the textures don't work on my two laptops. They have have the same integrated graphics driver - 852/855 GM intel. Not unless I use powers of two textures. What would be the math to convert a 384x256 texture to a 512x256 sized texture during runtime (tile size is 64x64)? Or is that possible, I was thinking if I modify the texture coordinates alone, it should only display that - right? Right? Here is my work so far: 1) Load bitmap 2) Find the next highest power of two and create the RGBA image 3) Here's where my math fails.. (512 - 384) = extra pixels not used = 128 64/384 isn't right, the uv coords would be off 64/512 isn't right either, uv coords would exceed the actual 384x256 image Is it how many 64 will go into 384, will go into 512? Please help, thanks.
  9. glDrawElements?

    Thanks, that was it - added unsigned to mesh and passing values - plus it was too big to show in my window. I scaled the scene out. How would I create a wireframe view of it? The view looks a little sloppy, but the unnormalized mesh as a solid looks ok. I can't tell much about the faces yet. I'm passing it as this: DrawMesh(&mesh01_indices[0], &mesh01_coords[0]); DrawMesh(unsigned int *, float *);
  10. Here is some code I found on the web, along with my code: What gets displayed is a single point with lines, like rays, extending from the point outwards. I think it is going from center to the vertex of each face. BTW this mesh is a sphere. What am I doing wrong? I've researched this vertex array thingy for about four hours collectively, only barely able to piece together examples here. // mesh01 static float mesh01_coords[] = { 0, -42.31, 0, 8.25427, -41.497, 0, ... static int mesh01_indices[] = { 0, 2, 1, 3, 5, 4, 6, 8, 7, ... draw_mesh() { glEnableClientState( GL_VERTEX_ARRAY ); glVertexPointer(3, GL_FLOAT, 5*sizeof(float), meshvrtx); glDrawElements(GL_LINE_LOOP, 96, GL_UNSIGNED_BYTE, meshindc); glDisableClientState( GL_VERTEX_ARRAY ); }
  11. how should I organize my classes?

    alright, many thanks :)
  12. how should I organize my classes?

    you're right, my heirarchy and thinking in general is flawed. obj should be more of an object class, i'm trying to do some data hiding to simplify my calling procedures, so that: *BASE.CreateWindow(); - creates default window, global hdc hinstance hwnd values and msgproc - creates base of primitives for use in opengl I probably want to have the createwindow start an instance of the Obj class, which is what I was trying to figure out how to organize it. I could create two separate classes, but for what purpose? I don't see the Object class using much if any of the window class; however, it would be great if the window class when initialized via constructor, initialize the Object class too. How could I get the main class to see the child class? Include it first? Or is that flawed also? Thanks.
  13. how should I organize my classes?

    ok then, I'm confused.. why is this giving me an error (see first post)? Here is the 'base' class. class base { private: WNDCLASS wc; HINSTANCE hInstance; HWND hWnd; HDC hDC; HGLRC hRC; int fs; //fullscreen flag - 0=windowed, 1=no window public: base(HINSTANCE hInst, char * title, int xw, int yh, int bp,int val) { //constructor // init stuff } ~base(){} public: void SetFullScreen(int); void EnableOpenGL(); void DisableOpenGL(); void flip(); void End(); void CreateSphere(int, int, int, int); };
  14. how should I organize my classes?

    Thanks CTar, I was approaching it wrong. I don't want to create alot of parents from 3 kids ;) The kids should have the attributes of the parents, however. Just not the exact DNA. Hope that is correct, and ++rating for you.
  15. I have a window init class and an object class. Should the window initialize the object class, or should the object class inherit from the window class? Apparently, dev-cpp doesn't like the code below, it gives me this error: no matching function call to 'base:base' Now the base itself contains window type stuff, like hWNd, hdc, etc.. if I initialize a base within the inheritance as I think it is asking me to, does that mean i will have multiple copies of hwnd, hdc, etc that i don't want? please help.. thanks. //OPENGL obj class class objs:public base { private: protected: GLUquadricObj *quadratic; public: objs() { quadratic = gluNewQuadric(); } ~objs() { gluDeleteQuadric(quadratic); } void create(int type) { type=0; }; };