• Content count

  • Joined

  • Last visited

Community Reputation

160 Neutral

About sjeps

  • Rank
  1. I'm trying to do 2d sprite animations.. And sometimes i need zooms.. Having separate images would probably be unpratical.. I''look into the transparent border (i don't need pixel precise zooms.. They are zooms after all :-) )thanks for your advices!
  2. Thanks for your answers!   I just pass integer values to my clips->x clips->y clips->w clips->h (despite their being GLfloats). As for matrices tranformation nothing more than a simple glScalef with arbitrary float arguments   The enviroment is set up just like this           glClearColor( 0, 0, 0, 0 );         glEnable( GL_TEXTURE_2D ); // Need this to display a texture       glEnable( GL_BLEND );     glDisable( GL_DEPTH_TEST );     glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );       glViewport( 0, 0, wwidth, wheight );       glMatrixMode( GL_PROJECTION );     glLoadIdentity();     glOrtho( 0, GAMEWIDTH, GAMEHEIGHT, 0, -1, 1 );          glMatrixMode( GL_MODELVIEW );     glLoadIdentity();   If as you said transformations and sub-imaging does't go along very well, wich is the right way of doing this?   By now i just tought about leaving a transparent pixels line between each image to circumvent the problem
  3. You are right, the problem seems to show up with GL_LINEAR.. This is my code, pretty simple as you can see.
  4. This is my rendering function of the specified clip: GLfloat s0,s1,t0,t1,w,h; s0 = (GLfloat) (clip->x) /texw ; s1 = (GLfloat) (clip->x+clip->w) /texw ; t0 = (GLfloat) (clip->y) /texh ; t1 = (GLfloat) (clip->y+clip->h) /texh ; w = (GLfloat) (clip->w) ; h = (GLfloat) (clip->h) ; OglVertex vertex[4]={ {{ s0, t0 }, { -w/2.f, -h/2.f }}, {{ s1, t0 }, { w/2.f, -h/2.f }}, {{ s1, t1 }, { w/2.f, h/2.f }}, {{ s0, t1 }, { -w/2.f, h/2.f }}, }; glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glBindTexture(GL_TEXTURE_2D, texture); glBindBuffer(GL_ARRAY_BUFFER, dvbo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, dibo); glBufferSubData(GL_ARRAY_BUFFER, 0, 4*sizeof(OglVertex), vertex); glTexCoordPointer(2, GL_FLOAT, sizeof(OglVertex), (GLvoid*)offsetof(OglVertex,texSyst)); glVertexPointer(2, GL_FLOAT, sizeof(OglVertex), (GLvoid*)offsetof(OglVertex, pos)); glDrawElements(GL_QUADS, 4, GL_UNSIGNED_INT, NULL); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
  5. Hi everybody. I have some images stored one near each other in a single texture. I'm 2d drawing each of them specifing their positions in the texture's coordinate system (0.f-1.f). Everything works fine like that. Anyway, when i try to zoom (glscalef) one of these images (portion of the whole texture) strange behaviors might occour. Depending on the zoom size, in addition to the image i'm displaying, also a single line of one of the surronding images in the texture could be displayed. I'm using mag filter NEAREST and no texture wrappings. Using mag filter LINEAR the problem doesn't show up. Is this some intended behavior? Or maybe a floating point number/rounding problem? Thx for help
  6. If you like to drop me some code, i'll surely dig in it! Anyway i was looking for a more hud focused library, and simpler to make small menus..
  7. Hi everybody! I'm developing a small (for now) 2d game with sdl and opengl. I've reached the point i need to make a main menu, some options menus, a character-weapon selection screen, and some in-game hud (healt, ammos, modifiers, event texts like "you picked a treasure!"...). So i need to render some text and images. I've already tried successfully font libraries and so on. Anyway i'm wondering: is there a simpler and more flexible approach to making all these things. Like some easy to implement menus, counters, different size-color texts, etc.. I've looked in some GUI libraries, like CEGUI, but i'm wondering if it's the right approach.. I mean, i'm lookin for just some simple selection menus, nothing like draggable windows or resizable widgets. Also my game is using joypads, while i found most of these libraries mouse oriented.. And are they capable of rendering texts in a flexible or nice looking way? I'm just looking for some advices