Hello All,
I'm learning OpenGL on my own atm and I have a question about
texturing a surface:
I can create a simple polygon like this:
public class Square {
// Our vertices.
private FloatBuffer colorBuffer;
float[] colors = {
.5f, .5f, 0f, .2f, // vertex 0 red
0f, 1f, 0f, .2f, // vertex 1 green
0f, 0f, 1f, .2f, // vertex 2 blue
1f, 0f, 1f, .2f, // vertex 3 magenta
};
private float vertices[] = {
-.7f, .04f, -.5f, // 0, Top Left
-.7f, -.04f, -0.5f, // 1, Bottom Left
.7f, -.04f, 0.05f, // 2, Bottom Right
.7f, .04f, 0.05f, // 3, Top Right
};
private short[] indices = { 0, 1, 2, 0, 2, 3 };
Then I load all of that info into the approriate buffers and draw it
to the screen with a call to:
gl.glDrawElements(GL10.GL_TRIANGLES, indices.length,
GL10.GL_UNSIGNED_SHORT, indexBuffer);
My question:
I'm looking for a good example of how to take an image and texture it
to the surface.
(I'm looking for a good book on JOGL with examples.)
Any suggestions are appreciated.
Thanks,
Josh Beck
Northeast ISD
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en