flyx / OpenGLAda

Thick Ada binding for OpenGL and GLFW
flyx.github.io/OpenGLAda/
MIT License
96 stars 13 forks source link

In need of glCompressedTexImage2D #37

Closed rogermc2 closed 7 years ago

rogermc2 commented 7 years ago

I'm in need of glCompressedTexImage2D which is declared in OpenGL.frameworks gl3.h. SOIL seems to provide a dead end, I think: typedef void (APIENTRY P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid data); P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC soilGlCompressedTexImage2D = NULL; which I don't fully understand.

In the meantime I've made a thin binding based on your API procedure Tex_Image_2D.

flyx commented 7 years ago

Can you point me to any docs where a list for internalformat values for glCompressedTexImage2D is shown? The official reference pages do not have one for some reason.

I would guess that SOIL simply loads post-OpenGL 1.1 functions dynamically like OpenGLAda does, hence the function pointer.

If you got Tex_Image_2D to work from Ada on any level, please show me (preferably in the other issue)!

rogermc2 commented 7 years ago

The only internalformat values for glCompressedTexImage2D that I can find appear to be in glew.h.txt glext.h.txt I got these files from: https://github.com/opengl-tutorials/ogl/archive/OpenGL-tutorial_0015_33.zip

Example: glCompressedTexImage2D(GL_TEXTURE_2D, level, format, width, height,
0, size, buffer + offset);

where format is set to format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; format = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; within the file texture.cpp of ogl-OpenGL-tutorial_0015_33/common

So far, I haven't managed to get Tex_Image_2D to work but will make some further attempts as a top priority.

flyx commented 7 years ago

You should now be able to do Load_Compressed on fillable texture targets, it is defined in GL.Objects.Textures.With_?D_Loader.

flyx commented 7 years ago

btw, I looked up possible compressed formats and added them to GL.Pixels.Internal_Format. Amongst others, the ones you mentioned are available.

rogermc2 commented 7 years ago

Thanks flyx.