Skip to main content
deleted 366 characters in body
Source Link
tigrou
  • 3.3k
  • 1
  • 28
  • 44

I'm having a problem for displaying a single quad, here is how i do :

enter image description hereenter image description here

//note: this code is only for 2 triangles, while on picture there is 4 triangles
float tex_coord[] =
{
   0.0, 0.0, //3
   0.0, 1.0, //2
   1.0, 1.0, //0
   1.0, 1.0, //0
   1.0, 0.0, //1
   0.0, 0.0
};  //how many coords should i give3
}; ?

int indexes[] = 
{
    3, 2, 0, 0, 1, 3
}

float vertexes[] = 
{
   -37, 0, 30,
   -38, 0, 29,
   -41, 0, 32,
   -42, 0, 31
}

 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, vertexes);
   glTexCoordPointer(2, GL_FLOAT, 0, tex_coord);
   glDrawElements(GL_TRIANGLES, 2, GL_UNSIGNED_INT, indices);
 glDisableClientState(GL_VERTEX_ARRAY);
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);

The result :

enter image description here

enter image description here

I try to put 4x4 pairs of (u,v) coords (thus 16 in total), hoping it will work like in first situation (only one "row" of triangles) :

Here is what i give :

(0,0)
(0,1)   (x 4)
(1,1)
(1,0)  

But it didn't worked.

I'm having a problem for displaying a single quad, here is how i do :

enter image description here

float tex_coord[] =
{
   0.0, 0.0,
   0.0, 1.0,
   1.0, 1.0,
   1.0, 1.0,
   1.0, 0.0,
   0.0, 0.0
};  //how many coords should i give ?

int indexes[] = 
{
    3, 2, 0, 0, 1, 3
}

float vertexes[] = 
{
   -37, 0, 30,
   -38, 0, 29,
   -41, 0, 32,
   -42, 0, 31
}

 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, vertexes);
   glTexCoordPointer(2, GL_FLOAT, 0, tex_coord);
   glDrawElements(GL_TRIANGLES, 2, GL_UNSIGNED_INT, indices);
 glDisableClientState(GL_VERTEX_ARRAY);
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);

The result :

enter image description here

enter image description here

I try to put 4x4 pairs of (u,v) coords (thus 16 in total), hoping it will work like in first situation (only one "row" of triangles) :

Here is what i give :

(0,0)
(0,1)   (x 4)
(1,1)
(1,0)  

But it didn't worked.

I'm having a problem for displaying a single quad, here is how i do :

enter image description here

//note: this code is only for 2 triangles, while on picture there is 4 triangles
float tex_coord[] =
{
   0.0, 0.0, //3
   0.0, 1.0, //2
   1.0, 1.0, //0
   1.0, 1.0, //0
   1.0, 0.0, //1
   0.0, 0.0  //3
}; 

int indexes[] = 
{
    3, 2, 0, 0, 1, 3
}

 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, vertexes);
   glTexCoordPointer(2, GL_FLOAT, 0, tex_coord);
   glDrawElements(GL_TRIANGLES, 2, GL_UNSIGNED_INT, indices);
 glDisableClientState(GL_VERTEX_ARRAY);
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);

The result :

enter image description here

added 139 characters in body
Source Link
tigrou
  • 3.3k
  • 1
  • 28
  • 44

I'm having a problem for displaying a single quad, here is how i do :

enter image description here

float tex_coord[] =
{
   0.0, 0.0,
   0.0, 1.0,
   1.0, 1.0,
   1.0, 1.0,
   1.0, 0.0,
   0.0, 0.0
};  //how many coords should i give ?

int indexes[] = 
{
    3, 2, 0, 0, 1, 3
}

float vertexes[] = 
{
   -37, 0, 30,
   -38, 0, 29,
   -41, 0, 32,
   -42, 0, 31
}

 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, vertexes);
   glTexCoordPointer(2, GL_FLOAT, 0, tex_coord);
   glDrawElements(GL_TRIANGLES, 2, GL_UNSIGNED_INT, indices);
 glDisableClientState(GL_VERTEX_ARRAY);
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);

The result :

enter image description here

enter image description hereenter image description here

butI try to put 4x4 pairs of (u,v) coords (thus 16 in total), hoping it didn'twill work like in first situation (only one "row" of triangles) :

Here is what i give :

(0,0)
(0,1)   (x 4)
(1,1)
(1,0)  

But it didn't worked.

I'm having a problem for displaying a single quad, here is how i do :

enter image description here

float tex_coord[] =
{
   0.0, 0.0,
   0.0, 1.0,
   1.0, 1.0,
   1.0, 1.0,
   1.0, 0.0,
   0.0, 0.0
};  //how many coords should i give ?

int indexes[] = 
{
    3, 2, 0, 0, 1, 3
}

float vertexes[] = 
{
   -37, 0, 30,
   -38, 0, 29,
   -41, 0, 32,
   -42, 0, 31
}

 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, vertexes);
   glTexCoordPointer(2, GL_FLOAT, 0, tex_coord);
   glDrawElements(GL_TRIANGLES, 2, GL_UNSIGNED_INT, indices);
 glDisableClientState(GL_VERTEX_ARRAY);
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);

The result :

enter image description here

enter image description here

but it didn't work.

I'm having a problem for displaying a single quad, here is how i do :

enter image description here

float tex_coord[] =
{
   0.0, 0.0,
   0.0, 1.0,
   1.0, 1.0,
   1.0, 1.0,
   1.0, 0.0,
   0.0, 0.0
};  //how many coords should i give ?

int indexes[] = 
{
    3, 2, 0, 0, 1, 3
}

float vertexes[] = 
{
   -37, 0, 30,
   -38, 0, 29,
   -41, 0, 32,
   -42, 0, 31
}

 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, vertexes);
   glTexCoordPointer(2, GL_FLOAT, 0, tex_coord);
   glDrawElements(GL_TRIANGLES, 2, GL_UNSIGNED_INT, indices);
 glDisableClientState(GL_VERTEX_ARRAY);
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);

The result :

enter image description here

enter image description here

I try to put 4x4 pairs of (u,v) coords (thus 16 in total), hoping it will work like in first situation (only one "row" of triangles) :

Here is what i give :

(0,0)
(0,1)   (x 4)
(1,1)
(1,0)  

But it didn't worked.

deleted 20 characters in body
Source Link
tigrou
  • 3.3k
  • 1
  • 28
  • 44

I'm having a problem for displaying a single quad, here is how i do :

enter image description here

float tex_coord[] =
{
   0.0, 0.0,
   0.0, 1.0,
   1.0, 1.0,
   1.0, 1.0,
   1.0, 0.0,
   0.0, 0.0
};  //how many coords should i give ?

int indexes[] = 
{
    3, 2, 0, 0, 1, 3
}

float vertexes[] = 
{
   -37, 0, 30,
   -38, 0, 29,
   -41, 0, 32,
   -42, 0, 31
}

 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, vertexes);
   glTexCoordPointer(2, GL_FLOAT, 0, tex_coord);
   glDrawElements(GL_TRIANGLES, 2, GL_UNSIGNED_INT, indices);
 glDisableClientState(GL_VERTEX_ARRAY);
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);

The result :

(with 2 triangles)

enter image description hereenter image description here

(with 4 triangles)enter image description here

enter image description here but it didn't work.

I'm having a problem for displaying a single quad, here is how i do :

enter image description here

float tex_coord[] =
{
   0.0, 0.0,
   0.0, 1.0,
   1.0, 1.0,
   1.0, 1.0,
   1.0, 0.0,
   0.0, 0.0
};  //how many coords should i give ?

int indexes[] = 
{
    3, 2, 0, 0, 1, 3
}

float vertexes[] = 
{
   -37, 0, 30,
   -38, 0, 29,
   -41, 0, 32,
   -42, 0, 31
}

 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, vertexes);
   glTexCoordPointer(2, GL_FLOAT, 0, tex_coord);
   glDrawElements(GL_TRIANGLES, 2, GL_UNSIGNED_INT, indices);
 glDisableClientState(GL_VERTEX_ARRAY);
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);

The result :

(with 2 triangles)

enter image description here

(with 4 triangles)

enter image description here

I'm having a problem for displaying a single quad, here is how i do :

enter image description here

float tex_coord[] =
{
   0.0, 0.0,
   0.0, 1.0,
   1.0, 1.0,
   1.0, 1.0,
   1.0, 0.0,
   0.0, 0.0
};  //how many coords should i give ?

int indexes[] = 
{
    3, 2, 0, 0, 1, 3
}

float vertexes[] = 
{
   -37, 0, 30,
   -38, 0, 29,
   -41, 0, 32,
   -42, 0, 31
}

 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, vertexes);
   glTexCoordPointer(2, GL_FLOAT, 0, tex_coord);
   glDrawElements(GL_TRIANGLES, 2, GL_UNSIGNED_INT, indices);
 glDisableClientState(GL_VERTEX_ARRAY);
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);

The result :

enter image description here

enter image description here

but it didn't work.

Tweeted twitter.com/#!/StackGameDev/status/267521906914230272
added 125 characters in body
Source Link
tigrou
  • 3.3k
  • 1
  • 28
  • 44
Loading
added 81 characters in body
Source Link
tigrou
  • 3.3k
  • 1
  • 28
  • 44
Loading
Source Link
tigrou
  • 3.3k
  • 1
  • 28
  • 44
Loading