Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 01 Nov 2012
Offline Last Active Sep 04 2013 06:28 AM

Posts I've Made

In Topic: multi image texture scaling problem

26 December 2012 - 12:22 PM

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!

In Topic: multi image texture scaling problem

26 December 2012 - 09:31 AM

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 );
    glViewport( 0, 0, wwidth, wheight );
    glMatrixMode( GL_PROJECTION );
    glOrtho( 0, GAMEWIDTH, GAMEHEIGHT, 0, -1, 1 );
    glMatrixMode( GL_MODELVIEW );
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

In Topic: multi image texture scaling problem

25 December 2012 - 01:08 PM

You are right, the problem seems to show up with GL_LINEAR.. This is my code, pretty simple as you can see.

In Topic: multi image texture scaling problem

22 December 2012 - 06:49 AM

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 }},


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));



In Topic: Need an advice on GUI-HUD for my 2D game

01 November 2012 - 08:00 AM

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..