-
Notifications
You must be signed in to change notification settings - Fork 1
/
NOTES.txt
64 lines (57 loc) · 4.67 KB
/
NOTES.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Meshes
========================================
- Meshes can have multiple segments each with their own material (SegmentMaterial) and primitive type (GL_TRIANGLES, GL_QUADS, etc.)
- Each segment material can have their own lighting parameters and textures.
- All mesh segments must define the same data in all segments. If normals are supplied in one segment then all segments are required to have them defined.
- A mesh has indexes that are shared by all segments.
- The mesh has a renderable configuration which defines how the data will be sent to OpenGL. For example colors can have a size 3 (RGB) or 4 (RGBA) and can be GL_BYTE, GL_FLOAT or GL_UNSIGNED_BYTE.
- An AABB is attached to a mesh which represents a bounding box in object coordinates.
- A mesh can have a material (MeshMaterial) which overrides which shader it is rendered with.
OpenGL 1.X
========================================
- You must choose withOpenGL33ProfileCompatibility() in your Configuration.
- This is the default mode for Graphics.
- Shaders cannot be used.
- You can render objects using Display Lists, Immediate Mode, Vertex Arrays and VBOs.
- You must not attach any shaders to a mesh material.
- The bind state uses gl*ClientState and gl*Pointer calls.
- You should not used named texture types (defined in net.smert.frameworkgl.opengl.TextureType) instead use TextureType.TEXTURE[0-8].
OpenGL 2.1
========================================
- You must choose withOpenGL33ProfileCompatibility() in your Configuration.
- You need to enable the correct renderer and renderable factory with Fw.graphics.switchRenderableFactoryAndRenderer(2).
- You must render all objects with a shader.
- You can render objects using Display Lists, Immediate Mode, Vertex Arrays and VBOs (Immediate Mode & Display Lists do not appear to work for Intel drivers).
- You must use the matrix helper instead of OpenGL matrix functions.
- The bind state uses gl*VertexAttribArray and glVertexAttribPointer.
OpenGL 3.2
========================================
- You must choose withOpenGL32ProfileCore() in your Configuration.
- You need to enable the correct renderer and renderable factory with Fw.graphics.switchRenderableFactoryAndRenderer(3).
- There are no built-in shaders for this version.
- You must render all objects with a shader.
- You can render objects using Vertex Arrays and VAOs.
- You must use the matrix helper instead of OpenGL matrix functions.
- The bind state uses gl*VertexAttribArray (glVertexAttribPointer is used when the VBO is created and is saved by the VAO).
OpenGL 3.3
========================================
- You must choose withOpenGL33ProfileCore() in your Configuration.
- You need to enable the correct renderer and renderable factory with Fw.graphics.switchRenderableFactoryAndRenderer(3).
- You must render all objects with a shader.
- You can render objects using Vertex Arrays and VAOs.
- You must use the matrix helper instead of OpenGL matrix functions.
- The bind state uses gl*VertexAttribArray (glVertexAttribPointer is used when the VBO is created and is saved by the VAO).
Renderables
========================================
- These are created from a mesh and represents how OpenGL will be rendering the object (Display list, VBO, etc.).
- Vertex arrays, vertex buffer objects and vertex array objects have a bind state which is called once before the render call. This bind state sets up gl*ClientState, gl*Pointer, gl*VertexAttribArray and glVertexAttribPointer depending on the OpenGL version.
Shaders
========================================
- GLSL 120 & 330 shaders do not rely on built-in attributes, uniforms and variables (GLSL 120 still uses gl_FragColor and gl_FragData).
- All shaders reference a global DefaultAttribLocations by default (during compiling) for locating vertex attributes and must be consistent across all shaders. The bind state uses this information to enable/disable the correct vertex attributes.
- If you make changes to the global DefaultAttribLocations then you must update the bind state (Renderable.bindState[2 or 3].setAttribLocations(GL.defaultAttribLocations)).
- Vertex lit shaders emulate glEnable(GL_COLOR_MATERIAL) and glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE) by default.
- The current shader is changed by calling Fw.graphics.switchShader() and all Fw.render* methods will use it unless a mesh material has a shader assigned to it.
Textures
========================================
- Textures attached to a mesh's segment material have a texture type (defined in net.smert.frameworkgl.opengl.TextureType) and each type has to be mapped to a texture unit (GL_TEXTURE0, etc.). This mapping is defined on a per shader basis.