Commit Graph

86 Commits

Author SHA1 Message Date
Takahito Tejima
9a6c37b86d Fix Hud display for higher DPI (MBP retina) 2014-05-23 13:24:31 -07:00
Sergey Sharybin
6ef232c95a Integrate CLEW into osd library and examples
If the system has CLEW installed (which is detected by recently
added FindCLEW routines) then OpenSubduv would be compiled against
this library.

It makes binaries and libraries more portable across the systems,
so it's possible to run the same binary on systems with and without
OpenCL SDK installed.

The most annoying part of the change is updating examples to load
OpenCL libraries, but ideally code around controllers and interface
creation is to be de-duplicated anyway.

Based on the pull request #303 from Martijn Berger
2014-05-22 09:10:59 +02:00
manuelk
77b71a0446 Minor fixes to gl_hud and gl_framebuffer
- leave framebuffer off by default (and remove SSAO UI from examples)
- fix some resources leakage when toggling SSAO on/off
2014-05-16 13:38:25 -07:00
manuelk
9913e349df Adding a programmable image shader to gl_hud
- add a framebuffer to gl_hud with programmable image shader
- add optional SSAO image shader to the new framebuffer
- add screenshot to png functionality
- implement in glViewer

note: ptexViewer and some others still need refactoring to use the new hud capabilities
2014-05-15 13:53:43 -07:00
Takahito Tejima
8cb0028db4 glViewer: use GL timer query to measure the GPU draw timing more precisely. 2014-05-15 09:32:47 -07:00
Takahito Tejima
9aaacae853 Added interleaved buffer mode in glViewer 2014-05-09 15:44:52 -07:00
Takahito Tejima
ee061291b7 Interleaved buffer support in OsdCompute. Removed OsdVertexDescriptor and replaced with OsdVertexBufferDescriptor.
All kernels take offset/length/stride to apply subdivision partially in each vertex elements.

Also the offset can be used for client-based VBO aggregation, without modifying index buffers.
This is useful for topology sharing, in conjunction with glDrawElementsBaseVertex etc.
However, gregory patch shader fetches vertex buffer via texture buffer, which index should also
be offsetted too. Although gl_BaseVertexARB extension should be able to do that job, it's a
relatively new extension. So we use OsdBaseVertex() call to mitigate the compatibility
issue as clients can provide it in their way at least for the time being.
2014-05-09 15:44:52 -07:00
Takahito Tejima
207cd494d5 glViewer: stop updating during freeze. 2014-05-02 14:19:08 -07:00
manuelk
a7d5db4d7d More cosmetic fixes to examples' GUI
- fix default selection for pulldown widgets
- move widgets around to prevent overlap in examples
- add a little triangle indicator to the pulldown widget
- switch color from white to yellow for selected pulldown item
2014-04-28 16:36:39 -07:00
Manuel Kraemer
48c119cb26 More cosmetic changes to the examples GUI
- switch shading radio buttons to pulldowns
- re-ordered elements on screen in most viewers

note: the ptex viewer has not been updated to the new look yet
2014-04-28 10:10:10 -07:00
Manuel Kraemer
00f2419388 Additional GUI updates to GL example code
- switch Compute selection to pull-down menu
- add TBB controller to ptexViewer
- small cleanup in Hud

note: shading should also switch to a pull-down
2014-04-27 23:05:18 -07:00
Manuel Kraemer
aa584ed2ce Adding a PullDown widget to our HUD in examples/common
- adding pulldown type menu selector
- updated shape selection to use the new widget in various Gl examples
2014-04-27 18:38:51 -07:00
manuelk
7bdbf0c8a2 One more fix for the Linux cmake build
fixes #258
2014-04-11 18:33:11 -07:00
mkraemer
05a7db5e14 Make CMake path variables more robust
Add quotes around variables containing paths - this might require a second pass...

fixes #258
2014-04-09 16:43:38 -04:00
David G Yu
dfb5c100de Added OpenCL header include paths where necessary
This follows existing patterns (more or less), but
there are certainly opportunities to move more of this
sort of logic into macros defined at the top level.
2014-02-22 21:37:11 +00:00
David G Yu
a07ad19559 Fixed examples to run correctly on high DPI displays with GLFW 3
The example code now uses the new glfw*FramebufferSize methods
to determine the size of the windows's framebuffer for rendering
and glfw*WindowSize method for user interaction

Fixes #263
2014-02-21 19:25:00 -08:00
manuelk
9fb89a2761 Fix glViewer support for GLSL compute
Core-profile request code was incorrect: we need to request GL 4.3 core profile whenever available.

fixes #254
2014-01-22 14:23:04 -08:00
manuelk
8918173fda Improve stringification of shaders & kernels in build.
- added a _stringify function to top CMakeLists
- switched all stringification tasks to use the macro
- all suffixes are now .gen.h instead of .inc (to help cmake track dependencies)
2014-01-03 16:59:26 -08:00
manuelk
00b0d95058 Remove CMake compiling redundancies
- set OBJECT targets for osd cpu & gpu libs, and use the obj target for
  static and dynamic linking

- add a new examples_common_obj OBJECT target
- replace direct source dependencies to obj target in all examples CMakeLists

This change makes it possible to not re-compile the same source files
multiple times when they are used in multiple targets. Thanks to jcowles
for uncovering the CMake functionality.

Note: it seems that multi-process build is working again (gmake -j <x>)
2014-01-03 13:39:48 -08:00
Manuel Kraemer
a565526977 Fix unused variable build warnings (gcc 4.8.2 - Fedora 19) 2013-12-08 13:47:14 -08:00
Takahito Tejima
f7f2ca2581 Move uniform block definitions out of osd common shader into client shader.
Important notice: all client shader code must have following functions and compose them to osd intrinsic shaders (vertex/tessEval/tessControl)

mat4 OsdModelViewMatrix()
mat4 OsdProjectionMatrix()
mat4 OsdModelViewProjectionMatrix()
float OsdTessLevel()
int OsdGreogryQuadOffsetBase()
int OsdPrimitiveIdBase()

We probably should write a utility class for basic binding of them, to make client code simpler.
2013-12-03 15:59:38 -08:00
manuelk
000cb400ca Revisit singular vertex fix for FarSubdivisionTables
The previous fix pointed far indexing tables to the origin vertex
of duped singular verts.

This fix goes one step further and actually shifts all vertex indexing
to start at the end of the coarse mesh vertices, using the space for
data that was previously occupied by duplicated singular verts.

The consequence is that client code no longer needs to duplicate vertex
data in vertex buffers (huzzah !).

- fix FarSubdivisionTablesFactory to shift factory vertex table offsets using Hbr's
  singular verts map
- fix schema table factories (Catmark, Loop...) to correctly use these offsets
- remove vertex data duplication code from osdPolySmooth example
- remove some (unrelated) cruft from glViewer example
- shape_utils unfortunately still needs to dubplicate the singular verts to
  allow the coarse edge drawing in our example viewers to work correctly
  (although it could be fixed to avoid data duplication too...)

fixes #241
2013-11-22 11:27:01 -08:00
manuelk
2dc8520938 Fix Chaikin rule
The Chaikin crease interpolation mode seems to be broken:
	   - Catmark / Loop / Bilinear are passing the wrong halfedge vertex to the
	     SubdivideCreaseWeight function which results in sub-edge crease weights
	     being swapped
	   - the loop that iterates over adjacent edges needs to check against both
	     the original edge and its opposite, otherwise it may be incorrectly
	     accumulated into summation of these adjacent edges (with a 0.25 weight)

	   The proposed fix:
	   - Swaps the Dest/Org vertex passed to the SubdivideCreaseWeight (and
	     we probably want Julian to confirm that this the correct fix)
	   - Checks against both the original edge and its opposite in the iteration
	     over adjacent edges
	   - Replaces the std::vector based query with an HbrHalfedgeOperator for
	     better performance (hopefully)

	   The similar fix to OpenSubdiv been reviewed by Tony DeRose.

    Also in the fix:
        - fix "obj" tag parsing of the smooth triangle tag that was incorrectly
          associated with the crease method (and reporting the wrong errors)
        - add regression shapes for both Loop & Catmark schemes to hbr_regression
        - add same shapes to the glViewer
        - improve hbr_regression output to be more readable
        - add command-line argument parsing to hbr_regression
        - add functionality to dump an obj file when regression fails for comparison

fixes #235
2013-11-07 17:06:55 -08:00
manuelk
83d9315e64 Fix Chaikin tag parsing
Also:
- add 2 shape examples with Chaikin rule tag
- add shapes to the glViewer
- add a stub in the documentation

Note: the Chaikin rule currently applied by Hbr appears to be somewhat off...

fixes #236
2013-11-01 11:38:20 -07:00
manuelk
9e9fd5c021 Fix Far to handle disconnected vertices in an Hbr mesh.
Also:
    - change our shape parser to skip non-manifold faces (print a warning)
    - add a 'fan' non-manifold test shape to the glViewer

fixes #233
2013-10-28 10:40:24 -07:00
manuelk
3ae50d1c50 Amending Apache license language & file headers.
New text:

     Copyright 2013 Pixar

     Licensed under the Apache License, Version 2.0 (the "Apache License")
     with the following modification; you may not use this file except in
     compliance with the Apache License and the following modification to it:
     Section 6. Trademarks. is deleted and replaced with:

     6. Trademarks. This License does not grant permission to use the trade
        names, trademarks, service marks, or product names of the Licensor
        and its affiliates, except as required to comply with Section 4(c) of
        the License and to reproduce the content of the NOTICE file.

     You may obtain a copy of the Apache License at

         http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the Apache License with the above modification is
     distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied. See the Apache License for the specific
     language governing permissions and limitations under the Apache License.
2013-09-26 12:04:57 -07:00
Takahito Tejima
d2192f0d16 Fix face varying rendering on loop surface 2013-09-23 12:56:46 -07:00
Kenneth Russell
81d3955280 Set GLFW_OPENGL_FORWARD_COMPAT on Mac OS to make samples work on that platform.
Fixed "Quit" menu option in glBatchViewer.
2013-09-17 10:18:32 -07:00
Takahito Tejima
b3948bb336 Fixes overlapped hud menu 2013-08-28 16:36:06 -07:00
manuelk
ac72015310 Adding TBB Compute back-end to glViewer 2013-08-16 10:51:51 -07:00
takahito-tejima
8cf9c834df Fix overlapping HUD menu 2013-07-18 19:49:16 -07:00
takahito-tejima
dd91b2de8c Fix some portability issues on OSX. (GLEW will be used if exists) 2013-07-18 19:49:00 -07:00
Takahito Tejima
51a45b598d Updating EULA 2013-07-18 14:19:50 -07:00
Takahito Tejima
a13c0565e4 Renamed texture buffers and uniforms
g_VertexBuffer -> OsdVertexBuffer
g_ValenceBuffer -> OsdValenceBuffer
g_QuadOffsetBuffer -> OsdQuadOffsetBuffer
g_ptexIndicesBuffer -> OsdPatchParamBuffer
g_uvFVarBuffer -> OsdFVarDataBuffer
LevelBase -> PrimitiveIdBase
2013-07-18 12:57:26 -07:00
Takahito Tejima
de3e706379 Potential fix for the shader compilation problem.
Replace face varying computation functions with equivalent macros
to avoid gl_PrimitiveID undefined error.
2013-07-08 16:16:28 -07:00
Takahito Tejima
2b4dd1cb0a Add convenient functions to compute face varying attributes.
closes #171
2013-07-03 12:08:10 -07:00
Takahito Tejima
37b2b8150e Add FaceVarying color display mode into glViewer 2013-07-02 11:16:27 -07:00
David G Yu
b9c14e4abe Fixed hotkey display for fractional tess 2013-07-01 11:41:49 -07:00
David G Yu
288b27dc28 Finished varying color shader updates for glViewer 2013-06-28 18:34:34 -07:00
David G Yu
c94c928fe9 Fixed file execute permissions 2013-06-28 17:02:16 -07:00
Takahito Tejima
b9086b4686 Fix OsdGLSLTransformFeedbackComputeContext to bind vertex/varying buffer correctly.
Closes #186
2013-06-28 16:09:04 -07:00
David G Yu
d2abf61c56 Added adaptive tess of user varying values
This isn't necessarily a final design, but
it gets enough of the pieces in place to move
forward.
2013-06-28 14:05:47 -07:00
takahito-tejima
bd42d42be5 Fix varying color display on glViewer/mac 2013-06-27 14:05:24 -07:00
Takahito Tejima
184e90f9a1 Add fractional spacing mode for patch rendering. 2013-06-27 13:34:25 -07:00
Takahito Tejima
e030157f73 Add varying buffer handling to OsdMesh.
Fix a bug that breaks varying interpolation on cuda kernel
Clean up glViewer with some new functions : varying color, screen space lod, patch culling
2013-06-27 12:57:21 -07:00
David G Yu
7d16bffccb Continued cleanup of OpenGL dependencies 2013-06-26 00:52:57 -07:00
manuelk
30ec963112 fix example code to work with GLFW 3.0
- fix FindGLFW.cmake to match the new locations

- fix all viewer & examples to build with 3.0, 3.0.1 and 3.0.2

Note : ptxViewer and paintTest do not work with 3.0.1 and 3.0.2 (yet)
2013-06-20 11:53:33 -07:00
David G Yu
38c951a06c Fixed patch color override for uniform subdivision 2013-06-10 23:33:34 -07:00
David G Yu
29afdfc8b3 Fixed GLSL transform feedback initialization. 2013-06-10 16:56:32 -07:00
David G Yu
967fc4db72 Fixed glsl shader portability edgeDistance
Moved all edgeDistance declarations to client shader code.
2013-06-10 16:32:45 -07:00