+
+struct glTexture
+{
+ GLuint texture_id;
+ int width, height;
+};
+
+static scm_t_bits glTexture_tag;
+
+SCM
+make_glTexture (GLuint texture_id)
+{
+ SCM smob;
+ struct glTexture *glTexture;
+
+ glTexture = (struct glTexture *) scm_gc_malloc (sizeof (struct glTexture), "glTexture");
+
+ glTexture->texture_id = 0;
+
+ SCM_NEWSMOB (smob, glTexture_tag, glTexture);
+
+ glTexture->texture_id = texture_id;
+
+ return smob;
+}
+
+GLuint
+get_glTexture_id (SCM glTexture_smob)
+{
+ struct glTexture *glTexture;
+
+ scm_assert_smob_type (glTexture_tag, glTexture_smob);
+ glTexture = (struct glTexture *) SCM_SMOB_DATA (glTexture_smob);
+ return glTexture->texture_id;
+}
+
+SCM
+get_glTexture_width (SCM glTexture_smob)
+{
+ struct glTexture *glTexture;
+
+ scm_assert_smob_type (glTexture_tag, glTexture_smob);
+ glTexture = (struct glTexture *) SCM_SMOB_DATA (glTexture_smob);
+ return scm_from_int (glTexture->width);
+}
+
+SCM
+get_glTexture_height (SCM glTexture_smob)
+{
+ struct glTexture *glTexture;
+
+ scm_assert_smob_type (glTexture_tag, glTexture_smob);
+ glTexture = (struct glTexture *) SCM_SMOB_DATA (glTexture_smob);
+ return scm_from_int (glTexture->height);
+}
+
+SCM
+set_glTexture_size (SCM glTexture_smob, SCM width, SCM height)
+{
+ struct glTexture *glTexture;
+
+ scm_assert_smob_type (glTexture_tag, glTexture_smob);
+ glTexture = (struct glTexture *) SCM_SMOB_DATA (glTexture_smob);
+ glTexture->width = scm_to_int (width);
+ glTexture->height = scm_to_int (height);
+ return SCM_UNSPECIFIED;
+}
+
+size_t
+free_glTexture (SCM glTexture_smob)
+{
+ struct glTexture *glTexture = (struct glTexture *) SCM_SMOB_DATA (glTexture_smob);
+ GLuint text[1];
+
+ text[0] = glTexture->texture_id;
+ glDeleteTextures (1, &text[0]);
+ scm_gc_free (glTexture, sizeof (struct glTexture), "glTexture");
+
+ return 0;
+}
+
+