PDA

View Full Version : DSA Cube Map Setup



Admiral Habor
12-04-2015, 07:50 AM
Hi, since this is my first post / question, please don't kill me right away.

The documentation of OpenGL is more than chaotic, at least for someone relativly new to the matter. Especially what is new and should be used and what is old. Even in this forum people still use functions of archaic age, which doesn't make things easier.
I want to use only the newest schematics and functions of OpenGL 4.5 Core.
So the question is how to set up a Cube Map Texture via DSA (Direct State Access).

1. glCreateTextures
2. glTextureParameter (or bind to Sampler)
3. glTextureSubImage3D (image data exits or data may be changed later; mutable texture; mostly for shader read) or glTexStorage3D (no image data available at any time; immutable texture; mostly for shader write)
optional 4. glGenerateTextureMipmap
Right? :dejection:

But since glTextureImage3D or something similar does not exist yet, how do you set the internal format of a mutable cube map texture? (in glTextureSubImage3D you only specify the data format, not the internal data)
Can you give an example? This depth array layer stuff is quite weird and uses parameters and functions like a maniac.

Alfonse Reinheart
12-04-2015, 09:02 AM
You don't.

ARB_DSA does not allow you to create mutable textures of any kind. 2D, 3D, Cubemap, arrays, nothing. The only way to use DSA to create storage for textures is with glTextureStorage*D. And that creates immutable storage.

Think of it as a big sign from the ARB saying, "Stop using mutable textures!"

Also:


glTextureSubImage3D (image data exits or data may be changed later; mutable texture; mostly for shader read)

This does not create mutable storage (https://www.opengl.org/wiki/Texture_Storage#Mutable_storage). It modifies existing storage (https://www.opengl.org/wiki/Texture_Storage#Pixel_upload).

Admiral Habor
12-04-2015, 09:19 AM
Ok, so I do

1. glCreateTextures
2. glTextureParameter (or bind to Sampler)
3. glTextureStorage3D glTextureStorage2D
4. glTextureSubImage3D (don't pass NULL as pixel data pointer while not using a Buffer-based Texture)
optional 4. glGenerateTextureMipmap

to setup a cube map texture?

Is there any kind of Website out there that consistently describes how to do things in OpenGL 4.5? (practical / example based)
Theory is no real help in the "real world" in many cases.