aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/util/glsl
Commit message (Collapse)AuthorAgeFilesLines
* BuildComposablePipeline: Handle synthetic isGL* and getGL* more generic, ↵Sven Gothel2014-07-291-0/+22
| | | | | | | | | | | | | | | | | allow FixedFunctionHook to properly determine it's identity BuildComposablePipeline: Handle synthetic isGL* and getGL* more generic, allow using a prologue hook as needed for FixedFunctionHook's 'isGL*core()', 'isGLES*Compatible()' and 'getGLProfile()' methods. The latter FixedFunctionHook take the emulated GL profile GL2ES1 into account, allowing JOGL code to assume only having GL2ES1 available. Otherwise methods like Texture.enable(..) would skip the glEnable(TEXTURE_2D) call and FixedFunctionHook could not enable it's usage. GLProfile received a 'public static GLProfile createCustomGLProfile(final String profile, final GLProfile profileImpl)' allowing utilities like FixedFunctionHook to create a generic profile. BuildComposablePipeline sorts the methods before emitting for better readability.
* Findbugs: Misc minor issues (see below)Sven Gothel2014-07-081-7/+7
| | | | | | | - remove duplicate code in branch - Use Type.valueOf(primitive) - Don't use array.toString() directly - remove dead code
* Code Clean-Up based on our Recommended Settings (jogamp-scripting ↵Sven Gothel2014-07-036-163/+164
| | | | | | | | | | | | | c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines
* Bug 801: Reduce temp. object creation, i.e. GC loadSven Gothel2014-04-021-6/+6
|
* Math and PMVMatrix: Cleanup and RefineSven Gothel2014-03-142-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added final qualifier where possible - Refined API doc - FloatUtil: - Add machine EPSILON - fixed value and runtime computed (real machEps) - incl. isZero(..), isEqual(..) - Add makeRotationAxis(..) - Moved from PMVMatrix for reusage - Add makeRotationEuler(..) - New, not recommended due to Gimbal-Lock - Add copyMatrix[Column|Row](..) - Add more PI variations and trigo-func float mappings - Removed cross and normalize, use VectorUtil! VectorUtil: - Add copyVec* - Add equals and isZero w/ and w/o EPSILON - Add distance[Square] - Add length[Square] PMVMatrix: - Removed 'destroy' method in favor of making most fields 'final'. AffineTransform: - Added AABBox transform - Public multiply
* Bug 942: GLBufferObjectTracker: Tracking GLBufferStorage accurately, ↵Sven Gothel2014-01-211-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | synchronized and secure [1/2] GLBufferSizeTracker becomes GLBufferObjectTracker and tracks the buffer's data store, GLBufferStorage, accurately, synchronized and secure. Synchronization is required, since the GLBufferStorage can be shared across many GLContext on multiple threads. This requires all GLBufferStorage lifecycle affecting GL functions to utilize synchronized GLBufferObjectTracker methods while passing a native GL-func callback. These GL functions are: - glBufferData, glBufferStorage (GL 4.4), glNamedBufferDataEXT Creating the GLBufferStorage object - glMapBuffer, glMapBufferRange, and their *Named*EXT variants - glUnmapBuffer, glUnmapNamedBufferEXT 'glDeleteBuffers' can simply notify the GLBufferObjectTracker No more HashMap is required to associate the mapped buffer address to the mapped ByteBuffer. GLBufferObjectTracker simply utilizes a buffer-name (int) -> GLBufferStorage map. +++ The security aspect shall be implemented by validating all arguments whether they match the required GL constraints, as well as validating tracked states like 'size'. The following functions will throw an GLException accordingly: - glBufferData, glNamedBufferDataEXT * @throws GLException if size is less-than zero * @throws GLException if a native GL-Error occurs - glBufferStorage (GL 4.4) * @throws GLException if size is less-or-eqaul zero * @throws GLException if a native GL-Error occurs - glMapBuffer, and it's *Named*EXT variant * @throws GLException if buffer is not bound to target * @throws GLException if buffer is not tracked * @throws GLException if buffer is already mapped * @throws GLException if buffer has invalid store size, i.e. less-than zero - glMapBufferRange, and it's *Named*EXT variant * @throws GLException if buffer is not bound to target * @throws GLException if buffer is not tracked * @throws GLException if buffer is already mapped * @throws GLException if buffer has invalid store size, i.e. less-than zero * @throws GLException if buffer mapping range does not fit, incl. offset - glMapBufferRange, and it's *Named*EXT variant Only clear mapped buffer reference of GLBufferStorage if native unmap was successful. Further more special error handling shall be applied to: - glMapBuffer, and it's *Named*EXT variant, glMapBuffer, and it's *Named*EXT variant - A zero GLBufferStorage size will avoid a native call and returns null - A null native mapping result indicating an error will not cause a GLException but returns null This allows the user to handle this case.
* Bug 776 GLContext Sharing: Fix copy-ctor GLArrayDataClient: Create new ↵Sven Gothel2013-10-302-5/+3
| | | | | | instance of GLArrayHandler of same type; Simplify GLArrayHandler inheritance. Refines commit 9f2a9df0a4b7093925c8854b37fba053469a4b35
* jogl: add missing @Override annotationsHarvey Harrison2013-10-175-0/+49
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* jogl: remove all trailing whitespaceHarvey Harrison2013-10-176-209/+209
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* Bug 852: Validate CPU sourced data API is allowed, throw exception if not. ↵v2.1.0Sven Gothel2013-10-101-2/+2
| | | | GLContext: isCPUSourcedAvail() -> isCPUDataSourcingAvail()
* Bug 852: Remove CPU sourced data API entry where not allowed (ES3 and GL ↵Sven Gothel2013-10-101-4/+11
| | | | | | | | | | | | | | | | | | | | | | | core >= 3.0) ; GL2 cfg: Ignore GL2ES3 symbols (super) Remove CPU sourced data API entries via new config 'BufferObjectOnly <name>', listed in 'gl-common-gpubufferonly.cfg' and included in ES3 and all GL core >= 3 interfaces. If BufferObjectOnly is defined for a function, only the 'long offset' variant is being emitted. Due to limitations of GlueGen's 'ExtendedInterfaceSymbolsIgnore A.java', which only identifies the function name and not the signature - all CPU sourced variants are manually added to the compatibility and ES2 GL profiles via '*-common-cpubufferJavaCode.java' files. GLContext: Added 'isCPUSourcedAvail()' to determine whether context allows CPU sourced data, i.e. for GL2ES1 and GLES2 ctx. GLContext/GLProfile/GL: isGLES2() now returns false if having a ES3 context due to 'CPU sourced' incompatibility! +++ GL2 cfg: Added ignore GL2ES3 symbols of it's superclass, removing duplicated symbols.
* Fix Bug 815: GL*: Change glIs<Buffer>Enabled() -> glIs<Buffer>Bound() to ↵Sven Gothel2013-08-141-8/+8
| | | | | | | | | | | | | | | | reflect semanics - Also fix the exception message (enabled/disabled -> bound/unbound) Reason of change: Avoid confusion and point to the cause! API change: glIsVBOArrayEnabled() -> glIsVBOArrayBound() glIsVBOElementArrayEnabled() -> glIsVBOElementArrayBound() glIsPBOPackEnabled() -> glIsPBOPackBound() glIsPBOUnpackEnabled() -> glIsPBOUnpackBound() Exception message change: "must be enabled to call this method" -> "must be bound to call this method" "must be disabled to call this method" -> "must be unbound to call this method"
* Remedy for Bug 782: Issue Debug.initSingleton() or Debug.debug(..) before ↵Sven Gothel2013-07-171-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | calling 'PropertyAccess.isPropertyDefined(propName, default)' through Debug class. Calling 'Debug.isPropertyDefined(propName, default)' may be 'optimized' to 'PropertyAccess.isPropertyDefined(propName, default)', which would skip the modules Debug's class initialization. Iff that happens, an AccessControlException may happen, due to requesting an insecure property, since modules own Debug class has not been added it's trusted prefixes from within it's init block yet. This seems to be a bug of the JVM .. to me, however .. the above description is the only able to explain the issue at hand. +++ Fix calls Debug class own static methods, either Debug.initSingleton() or Debug.debug(), before calling 'isPropertyDefined(propName, default)'. +++ Also mark Debug class static methods final! +++
* Fix Bug 737: Add shader default precision for GLSL [1.30 .. 1.50[ - See GLSL ↵Sven Gothel2013-05-172-4/+4
| | | | Spec [1.30 - 1.40].
* type: weather -> whether :) .. it's spring again :)Sven Gothel2013-04-181-1/+1
|
* GLJPanel: Impl. is GLProfile agnostic; Use ↵Sven Gothel2012-12-161-0/+195
| | | | | | | | | | | | | | GLDrawableFactory.createOffscreenDrawable(..) for common OffscreenBackend (dropping pbuffer/software); Flip FBO w/ GLSL texture renderer. - Implementation is GLProfile agnostic - Shall work on ES2, GL2, .. etc - Use GLDrawableFactory.createOffscreenDrawable(..) for common OffscreenBackend (dropping pbuffer/software) - Leave offscreen selection to common factory code, favoring FBO - Flip FBO w/ GLSL texture renderer - Faster on low CPU machines - Enabled if GL2ES2 and FBO offscreen
* GLArrayData/ImmModeSink: Remove implicit dependency on ShaderState - allow ↵Sven Gothel2012-12-162-13/+84
| | | | | | | | | | | | | | | | | | | | | | operating w/o it; ShaderState: Remove notion of GL context attachment, use pass-through or object association; GLArrayData/GLUniformData: Add basic GLSL location methods - GLArrayData/GLUniformData: Add basic GLSL location methods - GLArrayData - add: setLocation(..) for attribute location/index retrieval (post link) and binding (pre link) - GLUniformData - add: setLocation(..) for attribute location/index retrieval (post link) - GLArrayData/ImmModeSink: Remove implicit dependency on ShaderState - allow operating w/o it - GLArrayData - add: 'public void associate(Object obj, boolean enable)', allows setting ShaderState usage - ShaderState: Remove notion of GL context attachment, use pass-through or object association - ownsAttribute(..) associates the attribute w/ ShaderState - removed GL context ShaderState attachment Tested: - ImmModeSink w/ GLSL/ES2 w/ and w/o ShaderState - GLArrayData* w/ and w/o ShaderState
* Shader: Add '#define texture2D texture' for GLSL >= 130 ; TestGearsES2AWT ↵Sven Gothel2012-10-311-0/+1
| | | | add forceGL3; TextureDraw01ES2Listener uses defaultShaderCustomization()
* FixedFuncPipeline: Use proper shader version and make GLSL code compatible ↵Sven Gothel2012-10-297-26/+57
| | | | w/ higher GLSL versions
* FixedFuncPipeline: Require GLSL 1.20 (GL 2.1) due to GL driver bugs in OSX ↵Sven Gothel2012-10-231-3/+1
| | | | (gl_PointCoords n/a otherwise); Add FFP Emul point test in TestPointNEWT/PointDemoES1.
* FixedFuncHook/ImmModeSink: Fix *Pointer 'normalized' parameterSven Gothel2012-10-221-11/+10
| | | | | | | | | All *Pointer methods used 'normalized:=false', but we cannot assume the fixed function code does use normalized (0f..1f) values. On the contrary, it usually uses the native format value range. Hence we have to pass normalized:=true for all fixed point data types and normalized:=false for floating point data types.
* FixedFuncPipeline GL_POINTS: Fix gl_PointSize (attribute data format), Add ↵Sven Gothel2012-10-224-97/+91
| | | | | | | | | | | | | | GL_POINT_SOFT and dist/fade attenuation (Adding basic POINT unit tests) gl_PointSize (and all other uniform array elems) was not propagated due to wrong usage of GLUniformData component param. Due to efficiency, we use vec4[2] now and #defines in shader to easy readability. GL_POINT_SOFT uses gl_PointCoord to determnine inside/outside circle position while adding a seam of 10% in/out. This almost matches 'other' implementations and gives a nice smooth circle. !GL_POINT_SOFT produces a proper square (billboard). Point-Vertex shader takes dist/fade attentuation into account.
* FFP-Emu: Adding simple POINTS shader ; Adding GLRunnable2 interface, ↵Sven Gothel2012-10-204-61/+241
| | | | | | | | | | | | allowing passing a GL action w/ custom argument and return value. Adding simple POINTS shader not regarding POINTS parameters and not using a texture (commented out). FIXME: Event thought it works using a texture and gl_PointCoord in frag shader, I don't see the point here (lol) if gl_PointSize must be 1.0 in vert shader .. otherwise nothing is seen on ES2.0. On Desktop POINTS are always shown as 1 pixel sized points!
* FixedFuncPipeline: Add GL_POINT* state tracking; Fix glDrawArrays(): Issued ↵Sven Gothel2012-10-193-49/+131
| | | | | | twice (duh!) almost halfed performance :) TODO: Create GL_POINT texture and render w/ glDraw*()
* FixedFuncPipeline: Don't handle CullFace, ES2 impl. already takes care of ↵Sven Gothel2012-10-185-11/+20
| | | | discarding pixels of culled faces.
* FixedFuncPipeline: Cache current ShaderSelectionMode, update PMVMatrix ↵Sven Gothel2012-10-181-12/+25
| | | | according it's usage (update Mvi/Mvit only if lighting is being used)
* FixedFuncPipeline/Hook: Add glColor4ub() w/ value conversion, make ↵Sven Gothel2012-10-182-9/+24
| | | | glColor4f() more efficient, use pre-alloc NIO buffer
* ImmModeSink: Fix buffer grow (+1 element @ named buffer), enable DEBUG_* via ↵Sven Gothel2012-10-161-6/+13
| | | | properties, drawIndices QUAD w/ proper range and add uint; FixedFunctionHook: drawIndices QUAD w/ proper range and add uint
* FixedFuncColorTexture.fp: Remove unused local varSven Gothel2012-10-151-2/+0
|
* FixedFuncPipeline: Use ES2/GL2 prelude and set default precision. Shader ↵Sven Gothel2012-10-146-37/+49
| | | | code: Remove precision for default precision types.
* FixedFuncPipeline: Use resource efficient texture shader in AUTO mode as wellSven Gothel2012-10-141-2/+18
|
* FixedFuncPipeline: Optimize shader resource, if preset != ↵Sven Gothel2012-10-137-80/+206
| | | | ShaderSelectionMode.AUTO (good for mobile); Lazy shader instantiation.
* FixedFuncHook: Add ES2 alignment of certain GL functions, i.e. ↵Sven Gothel2012-10-121-3/+50
| | | | GL_QUAD_STRIP/GL_POLYGON/GL_QUADS mapping, glTexImage2D internalformat/format match.
* GLArrayData* VBO binding: Properly document and impl. bindBuffer(..) in ↵Sven Gothel2012-10-122-24/+10
| | | | | | | | | detail w/ data sync within GLArrayHandle, which also removed redundant code (VBO data sync and binding). Refines commit 8582ece7dc7f65271b3184261697a542766d9864 and f49f8e22953ed2426fd4264ee407e2dc3fc07cfc
* Enhance FixedFuncPipeline: Multi-Texture, Tex-Env, Alpha-Test, Lighting ↵Sven Gothel2012-10-1210-298/+880
| | | | | | | | | (fix, incomplete still), ShaderSelectionMode, Fix default values Besides the above mentioned additional features towards completness of the FFP emu, the ShaderSelectionMode allows fixating a shader program configuration, i.e. AUTO switch (default) or choosing a static shader program to avoid heavy program switches incl. uniform/attribute updates.
* Simplify GLArrayHandler and reduce VBO sideffectsSven Gothel2012-10-103-45/+31
| | | | | | | | | | VBO: Always unbind VBO ASAP after data transfer (glBufferData()) and assignment (glVertexPointer(..), glVertexAttribPointer()). It's a bug to leave it bound .. due to redundancy and other calls which could have change the VBO binding. Removed syncData(..), now it's only issued at enable and hence migrated into the enable method.
* Fix regression of commit a644d779ab19cb1d200ae4ba567b9c042c34b337, cannot ↵Sven Gothel2012-10-041-1/+1
| | | | | | compile FixedFuncHook due to removed 'isDirty()' - getModifiedBits() -> getModifiedBits(boolean clear)
* FixedFuncPipeline: Cleanup warnings ..Sven Gothel2012-10-041-7/+7
|
* API Change ShaderCode/ShaderUtil: Enable optional mutable shader source / ↵Sven Gothel2012-04-161-8/+8
| | | | | | | | | | | | | | | | | | | | | | generalize shader source storage type to CharSequence[] Benefits: - Allows code injection and general shader source editing (before compilation) - Uses mutable StringBuilder only if editing is intended, hence reduces memory footprint and String conversion at compilation in such case. - ShaderCode.create(..) factory methods add nw attribute 'mutableStringBuilder' if true method returns a mutable StringBuilder instance which can be edited later on at the costs of a String conversion when passing to 'glShaderSource(int, int, String[], IntBuffer)'. If <code>false</code> method returns an immutable <code>String</code> instance, which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)} at no additional costs. - New 'edit' methods in ShaderCode: ' - int insertShaderSource(int shaderIdx, String tag, int fromIndex, CharSequence data); - int insertShaderSource(int shaderIdx, int position, CharSequence data);
* StringBuffer -> StringBuilder (Local objects, no concurrency) ; Impacts: ↵Sven Gothel2012-04-161-8/+7
| | | | Capabilities/GLContext API 'toString(StringBuilder)'
* Fix commit fb7165e690546359dee92dd60b04be69f141c87e; Clarify ↵Sven Gothel2012-02-201-4/+4
| | | | ShaderState.attachShaderProgram(..)
* Cleanup ShaderCode/Program/StateSven Gothel2012-02-191-2/+1
| | | | | | - Add multiple sources for create ShaderCode - Add Shaderstate attachShaderProgram w/ enable flag - Clarify doc
* GLArrayData<VBO>: Add GLArrayHandlerFlat ; Update VBO name to interleaved ↵Sven Gothel2011-10-073-13/+137
| | | | | | | subarrays - Add GLArrayHandlerFlat gives better distinction of semantics - update sub-array VBO name, if parent's interleaved array initializes it.
* GLSL DataArray/Handler: Remove ShaderState state and pass it through: ↵Sven Gothel2011-08-303-141/+18
| | | | | | | | | ShaderState.getShaderState(gl) This removes the dependency of a GLSL GLDataArray object to a specific ShaderState and enables sharing of this VBO data, i.e. via a shared context. Test: TestSharedContextVBOES2NEWT
* API Change GLArrayDataWrapper/GLArrayDataServer: Add vboTarget to wrapper ↵Sven Gothel2011-08-221-8/+8
| | | | | | cstr and add interleaved seg. vboTarget is required in case of interleaved segments to allow eg. interleaved indices.
* Fix regression of commit 6c346d98f04e2355210960fe9ffde47432f04d62, where ↵Sven Gothel2011-08-223-22/+76
| | | | VBO/attribute binding wasn't updated (VBO data written, shader change/switch attribute on same location) ; Optimized interleaved GLSL VBO binding, hence split up GLArrayHandler syncData/enableState
* Misc Rename/Reloc; GLArrayData*/PMVMatrix enhancments; Test fixes/adds ↵Sven Gothel2011-08-228-39/+318
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GearsES1/ES2) rename/reloc: - javax.media.nativewindow.util: DimensionReadOnly -> DimensionImmutable PointReadOnly -> PointImmutable RectangleReadOnly -> RectangleImmutable unified 'immutable' name as used within jogamp already - remove array handler from public API com.jogamp.opengl.util.GL*ArrayHandler -> jogamp.opengl.util.GL*ArrayHandler - GLArrayData: Clarify method names getComponentNumber() -> getComponentCount() getComponentSize() -> getComponentSizeInBytes() getElementNumber() -> getElementCount() getByteSize() -> getSizeInBytes() - FixedFuncPipeline: Moved def. array names to GLPointerFuncUtil enhancement: - GLArrayDataServer: Add support for interleaved arrays/VBO - GLArrayData*.createFixed(..) remove 'name' argument (non sense for fixed function) - PMVMatrix: - one nio buffer - removed 'Pmv' multiplied matrix - removed 2x2 cut down 'Mvi' normal matrix (use 4x4 Mvi) - tests: - RedSquare -> RedSquareES1/RedSquareES2 - Gears ES1 fixed + ES2 added. Both work properly and share common Gears VBO construction - Added TestMapBuffer01NEWT, testing glMapBuffer
* Cont. fix 'Allow VBO/Texture Name (int) < 0'Sven Gothel2011-08-011-4/+4
| | | | | | | Refines spec GLArrayData and it's implementations. see commit 4d33a2df1e991ab75817dcb44061d88d3c499cdb see commit 2dbd16fc3edf29b39ba37a11b9fbf1b2aad75c45
* Fixed regression of commit 360b86f4b5d0e440863c1749fe990e39fbabc51cSven Gothel2011-08-011-2/+2
|
* ShaderState: Add 'ownUniform()/ownAttribute()'; rename glFunction -> ↵Sven Gothel2011-04-261-61/+61
| | | | | | | | | | | | | | function; switch program enh. ; Graph lifecycle Add 'ownUniform()/ownAttribute()' allowing to reset all bound uniforms/attributes, not just active ones plus handling the lifecycle of the owned attributes (destroy). This simplifies the lifecycle of all shader attributes. Rename glFunction -> function .. well, the GL attribute marks them GL related already Switch program enhancement. If switching to new program (unlinked), issue glBindAttributeLocation .. Graph lifecycle cleanup using the above ..