mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-30 23:30:07 +00:00
Merge branch 'master' of github.com:PixarAnimationStudios/OpenSubdiv
This commit is contained in:
commit
4bbc42fd52
157
CMakeLists.txt
157
CMakeLists.txt
@ -59,16 +59,16 @@ project(OpenSubdiv)
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
# XXXX manuelk - API version is managed from opensubdiv/version.h - we should remove this
|
||||
set(OpenSubdiv_VERSION_MAJOR 0)
|
||||
set(OpenSubdiv_VERSION_MINOR 1)
|
||||
set(OpenSubdiv_VERSION_PATCH 0)
|
||||
|
||||
set(OpenSubdiv_VERSION
|
||||
${OpenSubdiv_VERSION_MAJOR}.${OpenSubdiv_VERSION_MINOR}.${OpenSubdiv_VERSION_PATCH})
|
||||
set(OpenSubdiv_VERSION ${OpenSubdiv_VERSION_MAJOR}.${OpenSubdiv_VERSION_MINOR}.${OpenSubdiv_VERSION_PATCH})
|
||||
|
||||
message(STATUS "Compiling ${CMAKE_PROJECT_NAME} version ${OpenSubdiv_VERSION}")
|
||||
message(STATUS "Using cmake version ${CMAKE_VERSION}")
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Specify the default install path
|
||||
SET( CMAKE_INSTALL_PREFIX
|
||||
${PROJECT_BINARY_DIR}/ )
|
||||
@ -98,19 +98,99 @@ set(CMAKE_MODULE_PATH
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake
|
||||
)
|
||||
|
||||
#add_definitions(-Wall)
|
||||
|
||||
# Disable spurrious offsetof warning in gcc builds and clang
|
||||
if (CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
add_definitions("-Wno-invalid-offsetof")
|
||||
#-------------------------------------------------------------------------------
|
||||
# Detect Clang (until a cmake version provides built-in variables)
|
||||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
set(CMAKE_COMPILER_IS_CLANGCC 1)
|
||||
endif()
|
||||
|
||||
|
||||
# Disable spurrious warnings in gcc builds and clang
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANGCC)
|
||||
|
||||
# Turn on all warnings
|
||||
add_definitions(-Wall)
|
||||
|
||||
# HBR uses the offsetof macro on a templated struct, which appears
|
||||
# to spurriously set off this warning in both gccc and Clang
|
||||
add_definitions(-Wno-invalid-offsetof)
|
||||
|
||||
# FAR and OSD have templated virtual function implementations that trigger
|
||||
# a lot of hidden virtual function overloads (some of them spurrious).
|
||||
# Disable those for now in Clang.
|
||||
if(CMAKE_COMPILER_IS_CLANGCC)
|
||||
add_definitions(-Wno-overloaded-virtual)
|
||||
endif()
|
||||
|
||||
elseif(MSVC)
|
||||
|
||||
# Turn on all warnings
|
||||
add_definitions(/Wall)
|
||||
|
||||
# MSVC is unfortunately not standard conforming with regards to
|
||||
# the alternative names for logical and bitwise operators:
|
||||
# http://stackoverflow.com/questions/555505/c-alternative-tokens
|
||||
# http://stackoverflow.com/questions/6006526/c-writing-or-instead-of
|
||||
#
|
||||
# This can be solved by including iso646.h, but that is a rather
|
||||
# unsatisfactory solution since we then always have to remember to
|
||||
# include this header file. Instead we define these operators
|
||||
# ourselves as command line arguments to cl.exe.
|
||||
#
|
||||
# An alternative would be to compile with the /Za option
|
||||
# (but unfortunately that breaks other code):
|
||||
# http://msdn.microsoft.com/en-us/library/0k0w269d.aspx
|
||||
add_definitions(
|
||||
/Dand=&&
|
||||
/Dand_eq=&=
|
||||
/Dbitand=&
|
||||
/Dbitor=|
|
||||
/Dcompl=~
|
||||
/Dnot=!
|
||||
/Dnot_eq=!=
|
||||
/Dor=||
|
||||
/Dor_eq=|=
|
||||
# nvcc does not seem to like a caret being the last character
|
||||
# in a command line defined preprocessor symbol, so add an
|
||||
# empty trailing comment to avoid this.
|
||||
/Dxor=^/**/
|
||||
/Dxor_eq=^=
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
/W3 # Use warning level recommended for production purposes.
|
||||
/WX # Treat all compiler warnings as errors.
|
||||
|
||||
# Make sure WinDef.h does not define min and max macros which
|
||||
# will conflict with std::min() and std::max().
|
||||
/DNOMINMAX
|
||||
|
||||
# Make sure the constants in <math.h> get defined.
|
||||
/D_USE_MATH_DEFINES
|
||||
|
||||
# Do not enforce MSVC's safe CRT replacements.
|
||||
/D_CRT_SECURE_NO_WARNINGS
|
||||
|
||||
# Disable checked iterators and iterator debugging. Visual Studio
|
||||
# 2008 does not implement std::vector::data(), so we need to take the
|
||||
# address of std::vector::operator[](0) to get the memory location of
|
||||
# a vector's underlying data storage. This does not work for an empty
|
||||
# vector if checked iterators or iterator debugging is enabled.
|
||||
/D_SECURE_SCL=0
|
||||
/D_HAS_ITERATOR_DEBUGGING=0
|
||||
)
|
||||
endif()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Ignore rules that will re-run cmake (this will avoid constant
|
||||
# reloading of the generated Visual Studio project).
|
||||
set(CMAKE_SUPPRESS_REGENERATION TRUE)
|
||||
|
||||
# Check for dependencies
|
||||
find_package(OpenMP)
|
||||
if(NOT NO_OMP)
|
||||
find_package(OpenMP)
|
||||
endif()
|
||||
find_package(OpenGL)
|
||||
find_package(OpenGLES)
|
||||
find_package(OpenCL)
|
||||
@ -255,62 +335,9 @@ if (WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# MSVC is unfortunately not standard conforming with regards to
|
||||
# the alternative names for logical and bitwise operators:
|
||||
# http://stackoverflow.com/questions/555505/c-alternative-tokens
|
||||
# http://stackoverflow.com/questions/6006526/c-writing-or-instead-of
|
||||
#
|
||||
# This can be solved by including iso646.h, but that is a rather
|
||||
# unsatisfactory solution since we then always have to remember to
|
||||
# include this header file. Instead we define these operators
|
||||
# ourselves as command line arguments to cl.exe.
|
||||
#
|
||||
# An alternative would be to compile with the /Za option
|
||||
# (but unfortunately that breaks other code):
|
||||
# http://msdn.microsoft.com/en-us/library/0k0w269d.aspx
|
||||
add_definitions(
|
||||
/Dand=&&
|
||||
/Dand_eq=&=
|
||||
/Dbitand=&
|
||||
/Dbitor=|
|
||||
/Dcompl=~
|
||||
/Dnot=!
|
||||
/Dnot_eq=!=
|
||||
/Dor=||
|
||||
/Dor_eq=|=
|
||||
# nvcc does not seem to like a caret being the last character
|
||||
# in a command line defined preprocessor symbol, so add an
|
||||
# empty trailing comment to avoid this.
|
||||
/Dxor=^/**/
|
||||
/Dxor_eq=^=
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
/W3 # Use warning level recommended for production purposes.
|
||||
/WX # Treat all compiler warnings as errors.
|
||||
|
||||
# Make sure WinDef.h does not define min and max macros which
|
||||
# will conflict with std::min() and std::max().
|
||||
/DNOMINMAX
|
||||
|
||||
# Make sure the constants in <math.h> get defined.
|
||||
/D_USE_MATH_DEFINES
|
||||
|
||||
# Do not enforce MSVC's safe CRT replacements.
|
||||
/D_CRT_SECURE_NO_WARNINGS
|
||||
|
||||
# Disable checked iterators and iterator debugging. Visual Studio
|
||||
# 2008 does not implement std::vector::data(), so we need to take the
|
||||
# address of std::vector::operator[](0) to get the memory location of
|
||||
# a vector's underlying data storage. This does not work for an empty
|
||||
# vector if checked iterators or iterator debugging is enabled.
|
||||
/D_SECURE_SCL=0
|
||||
/D_HAS_ITERATOR_DEBUGGING=0
|
||||
)
|
||||
endif(MSVC)
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# General-use macros
|
||||
|
||||
# Macro for adding a cuda executable if cuda is found and a regular
|
||||
# executable otherwise.
|
||||
@ -357,6 +384,8 @@ macro(_add_glut_executable target)
|
||||
|
||||
endmacro()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Build targets
|
||||
|
||||
add_subdirectory(opensubdiv)
|
||||
|
||||
|
@ -50,6 +50,7 @@ Optional:
|
||||
-DGLEW_LOCATION=[path to GLEW]
|
||||
-DGLUT_LOCATION=[path to GLUT]
|
||||
-DMAYA_LOCATION=[path to Maya]
|
||||
-DNO_OMP=1 // disable OpenMP
|
||||
````
|
||||
|
||||
The paths to Maya, Ptex, GLUT, and GLEW can also be specified through the
|
||||
|
4
cmake/FindMaya.cmake
Normal file → Executable file
4
cmake/FindMaya.cmake
Normal file → Executable file
@ -134,6 +134,10 @@ IF(WIN32)
|
||||
FIND_PATH(MAYA_BASE_DIR include/maya/MFn.h PATH
|
||||
${MAYA_LOCATION}
|
||||
$ENV{MAYA_LOCATION}
|
||||
"C:/Program Files/Autodesk/Maya2013.5-x64"
|
||||
"C:/Program Files/Autodesk/Maya2013.5"
|
||||
"C:/Program Files (x86)/Autodesk/Maya2013.5"
|
||||
"C:/Autodesk/maya-2013.5x64"
|
||||
"C:/Program Files/Autodesk/Maya2013-x64"
|
||||
"C:/Program Files/Autodesk/Maya2013"
|
||||
"C:/Program Files (x86)/Autodesk/Maya2013"
|
||||
|
4156
examples/common/font_image.cpp
Normal file
4156
examples/common/font_image.cpp
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -54,18 +54,58 @@
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#include <GL/glew.h>
|
||||
#if defined(ANDROID)
|
||||
#include <GLES2/gl2.h>
|
||||
#else
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#if not defined(__APPLE__)
|
||||
#include <GL/glew.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "gl_hud.h"
|
||||
#include "font_image.h"
|
||||
#include "simple_math.h"
|
||||
|
||||
GLhud::GLhud() : _fontTexture(0), _vbo(0), _staticVbo(0)
|
||||
static const char *s_VS =
|
||||
"attribute vec2 position;\n"
|
||||
"attribute vec3 color;\n"
|
||||
"attribute vec2 uv;\n"
|
||||
"varying vec4 fragColor;\n"
|
||||
"varying vec2 fragUV;\n"
|
||||
"uniform mat4 ModelViewProjectionMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" fragColor = vec4(1, 0, 0, 1);\n"
|
||||
" fragUV = uv;\n"
|
||||
" gl_Position = ModelViewProjectionMatrix * "
|
||||
" vec4(position.x, position.y, 0, 1);\n"
|
||||
"}\n";
|
||||
|
||||
static const char *s_FS =
|
||||
"precision mediump float;\n"
|
||||
"varying vec4 fragColor;\n"
|
||||
"varying vec2 fragUV;\n"
|
||||
"uniform sampler2D texture;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 c = texture2D(texture, fragUV);\n"
|
||||
" if (c.a == 0.0) discard;\n"
|
||||
" gl_FragColor = c;\n"
|
||||
"}\n";
|
||||
|
||||
GLhud::GLhud() : _fontTexture(0), _vbo(0), _staticVbo(0), _program(0),
|
||||
_aPosition(0), _aColor(0), _aUV(0)
|
||||
{
|
||||
}
|
||||
|
||||
GLhud::~GLhud()
|
||||
{
|
||||
if (_program)
|
||||
glDeleteProgram(_program);
|
||||
if (_fontTexture)
|
||||
glDeleteTextures(1, &_fontTexture);
|
||||
if (_vbo)
|
||||
@ -74,6 +114,15 @@ GLhud::~GLhud()
|
||||
glDeleteBuffers(1, &_staticVbo);
|
||||
}
|
||||
|
||||
static GLuint compileShader(GLenum shaderType, const char *source)
|
||||
{
|
||||
GLuint shader = glCreateShader(shaderType);
|
||||
glShaderSource(shader, 1, &source, NULL);
|
||||
glCompileShader(shader);
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
void
|
||||
GLhud::Init(int width, int height)
|
||||
{
|
||||
@ -83,16 +132,44 @@ GLhud::Init(int width, int height)
|
||||
glBindTexture(GL_TEXTURE_2D, _fontTexture);
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8,
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
|
||||
FONT_TEXTURE_WIDTH, FONT_TEXTURE_HEIGHT,
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE, font_image);
|
||||
|
||||
glGenBuffers(1, &_vbo);
|
||||
glGenBuffers(1, &_staticVbo);
|
||||
|
||||
GLuint vertexShader = compileShader(GL_VERTEX_SHADER, s_VS);
|
||||
GLuint fragmentShader = compileShader(GL_FRAGMENT_SHADER, s_FS);
|
||||
|
||||
_program = glCreateProgram();
|
||||
glAttachShader(_program, vertexShader);
|
||||
glAttachShader(_program, fragmentShader);
|
||||
|
||||
glLinkProgram(_program);
|
||||
|
||||
glDeleteShader(vertexShader);
|
||||
glDeleteShader(fragmentShader);
|
||||
|
||||
GLint status;
|
||||
glGetProgramiv(_program, GL_LINK_STATUS, &status);
|
||||
if (status == GL_FALSE) {
|
||||
GLint infoLogLength;
|
||||
glGetProgramiv(_program, GL_INFO_LOG_LENGTH, &infoLogLength);
|
||||
char *infoLog = new char[infoLogLength];
|
||||
glGetProgramInfoLog(_program, infoLogLength, NULL, infoLog);
|
||||
printf("%s\n", infoLog);
|
||||
delete[] infoLog;
|
||||
}
|
||||
|
||||
_mvpMatrix = glGetUniformLocation(_program, "ModelViewProjectionMatrix");
|
||||
_aPosition = glGetAttribLocation(_program, "position");
|
||||
_aColor = glGetAttribLocation(_program, "color");
|
||||
_aUV = glGetAttribLocation(_program, "uv");
|
||||
}
|
||||
|
||||
void
|
||||
@ -136,7 +213,8 @@ GLhud::Rebuild(int width, int height)
|
||||
|
||||
_staticVboSize = (int)vboSource.size();
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _staticVbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, _staticVboSize * sizeof(float), &vboSource[0], GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, _staticVboSize * sizeof(float),
|
||||
&vboSource[0], GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
@ -148,65 +226,55 @@ GLhud::Flush()
|
||||
|
||||
// update dynamic text
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, getVboSource().size() * sizeof(float), &getVboSource()[0], GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, getVboSource().size() * sizeof(float),
|
||||
&getVboSource()[0], GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
int numVertices = (int)getVboSource().size()/7; /* (x, y, r, g, b, u, v) = 7*/
|
||||
/* (x, y, r, g, b, u, v) = 7*/
|
||||
int numVertices = (int)getVboSource().size()/7;
|
||||
|
||||
// reserved space of the vector remains for the next frame.
|
||||
getVboSource().clear();
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
gluOrtho2D(0, GetWidth(), GetHeight(), 0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glUseProgram(_program);
|
||||
float proj[16];
|
||||
ortho(proj, 0, 0, GetWidth(), GetHeight());
|
||||
glUniformMatrix4fv(_mvpMatrix, 1, GL_FALSE, proj);
|
||||
|
||||
glPushAttrib(GL_ENABLE_BIT|GL_POLYGON_BIT);
|
||||
{
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glAlphaFunc(GL_GREATER, 0);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glColor4f(1, 1, 1, 1);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, _fontTexture);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glEnableVertexAttribArray(_aPosition);
|
||||
glEnableVertexAttribArray(_aColor);
|
||||
glEnableVertexAttribArray(_aUV);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
||||
glVertexPointer(2, GL_FLOAT, 7*sizeof(float), (void*)0);
|
||||
glColorPointer(3, GL_FLOAT, 7*sizeof(float), (void*)(2*sizeof(float)));
|
||||
glTexCoordPointer(2, GL_FLOAT, 7*sizeof(float), (void*)(5*sizeof(float)));
|
||||
glVertexAttribPointer(_aPosition, 2, GL_FLOAT, GL_FALSE,
|
||||
sizeof(GLfloat)*7, (void*)0);
|
||||
glVertexAttribPointer(_aColor, 3, GL_FLOAT, GL_FALSE,
|
||||
sizeof(GLfloat)*7, (void*)(sizeof(GLfloat)*2));
|
||||
glVertexAttribPointer(_aUV, 2, GL_FLOAT, GL_FALSE,
|
||||
sizeof(GLfloat)*7, (void*)(sizeof(GLfloat)*5));
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, numVertices);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _staticVbo);
|
||||
glVertexPointer(2, GL_FLOAT, 7*sizeof(float), (void*)0);
|
||||
glColorPointer(3, GL_FLOAT, 7*sizeof(float), (void*)(2*sizeof(float)));
|
||||
glTexCoordPointer(2, GL_FLOAT, 7*sizeof(float), (void*)(5*sizeof(float)));
|
||||
glVertexAttribPointer(_aPosition, 2, GL_FLOAT, GL_FALSE,
|
||||
sizeof(GLfloat)*7, (void*)0);
|
||||
glVertexAttribPointer(_aColor, 3, GL_FLOAT, GL_FALSE,
|
||||
sizeof(GLfloat)*7, (void*)(sizeof(GLfloat)*2));
|
||||
glVertexAttribPointer(_aUV, 2, GL_FLOAT, GL_FALSE,
|
||||
sizeof(GLfloat)*7, (void*)(sizeof(GLfloat)*5));
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, _staticVboSize/7);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableVertexAttribArray(_aPosition);
|
||||
glDisableVertexAttribArray(_aColor);
|
||||
glDisableVertexAttribArray(_aUV);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
glPopAttrib();
|
||||
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -57,7 +57,14 @@
|
||||
#ifndef GL_HUD_H
|
||||
#define GL_HUD_H
|
||||
|
||||
#include <GL/gl.h>
|
||||
#if defined(ANDROID)
|
||||
#include <GLES2/gl2.h>
|
||||
#else
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include "hud.h"
|
||||
|
||||
class GLhud : public Hud
|
||||
@ -76,6 +83,10 @@ private:
|
||||
GLuint _fontTexture;
|
||||
GLuint _vbo, _staticVbo;
|
||||
int _staticVboSize;
|
||||
|
||||
GLint _program;
|
||||
GLint _mvpMatrix;
|
||||
GLint _aPosition, _aColor, _aUV;
|
||||
};
|
||||
|
||||
#endif // GL_HUD_H
|
||||
|
@ -73,6 +73,7 @@ include_directories(
|
||||
)
|
||||
|
||||
set(SOURCE_FILES
|
||||
../common/font_image.cpp
|
||||
../common/hud.cpp
|
||||
../common/d3d11_hud.cpp
|
||||
dxViewer.cpp
|
||||
|
@ -104,6 +104,7 @@ _add_glut_executable(glutViewer
|
||||
else()
|
||||
_add_glut_executable(glutViewer
|
||||
viewer.cpp
|
||||
../common/font_image.cpp
|
||||
../common/hud.cpp
|
||||
../common/gl_hud.cpp
|
||||
${SHADER_FILES}
|
||||
|
@ -56,7 +56,6 @@
|
||||
//
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <OpenGL/gl3.h>
|
||||
#include <GLUT/glut.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
@ -217,7 +216,7 @@ static void
|
||||
initializeShapes( ) {
|
||||
|
||||
#include <shapes/bilinear_cube.h>
|
||||
// g_defaultShapes.push_back(SimpleShape(bilinear_cube, "bilinear_cube", kBilinear));
|
||||
g_defaultShapes.push_back(SimpleShape(bilinear_cube, "bilinear_cube", kBilinear));
|
||||
|
||||
#include <shapes/catmark_cube_corner0.h>
|
||||
g_defaultShapes.push_back(SimpleShape(catmark_cube_corner0, "catmark_cube_corner0", kCatmark));
|
||||
@ -397,7 +396,7 @@ updateGeom() {
|
||||
|
||||
float r = sin(g_frame*0.001f) * g_moveScale;
|
||||
for (int i = 0; i < nverts; ++i) {
|
||||
float move = 0.05f*cosf(p[0]*20+g_frame*0.01f);
|
||||
//float move = 0.05f*cosf(p[0]*20+g_frame*0.01f);
|
||||
float ct = cos(p[2] * r);
|
||||
float st = sin(p[2] * r);
|
||||
g_positions[i*3+0] = p[0]*ct + p[1]*st;
|
||||
|
7
examples/mayaPtexViewer/OpenSubdivPtexShader.cpp
Normal file → Executable file
7
examples/mayaPtexViewer/OpenSubdivPtexShader.cpp
Normal file → Executable file
@ -55,7 +55,12 @@
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
|
||||
#include <GL/glew.h>
|
||||
#if not defined(__APPLE__)
|
||||
#include <GL/glew.h>
|
||||
#if defined(WIN32)
|
||||
#include <GL/wglew.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <maya/MFnTypedAttribute.h>
|
||||
#include <maya/MFnNumericAttribute.h>
|
||||
|
8
examples/mayaPtexViewer/OpenSubdivPtexShaderOverride.cpp
Normal file → Executable file
8
examples/mayaPtexViewer/OpenSubdivPtexShaderOverride.cpp
Normal file → Executable file
@ -55,7 +55,12 @@
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
|
||||
#include <GL/glew.h>
|
||||
#if not defined(__APPLE__)
|
||||
#include <GL/glew.h>
|
||||
#if defined(WIN32)
|
||||
#include <GL/wglew.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Include this first to avoid winsock2.h problems on Windows:
|
||||
#include <maya/MTypes.h>
|
||||
@ -371,7 +376,6 @@ public:
|
||||
const MComponentDataIndexing &targetIndexing) const
|
||||
{
|
||||
#endif
|
||||
const MVertexBufferDescriptor &desc = vertexBuffer.descriptor();
|
||||
|
||||
MFnMesh meshFn(dagPath);
|
||||
int nVertices = meshFn.numVertices();
|
||||
|
7
examples/mayaPtexViewer/cudaUtil.cpp
Normal file → Executable file
7
examples/mayaPtexViewer/cudaUtil.cpp
Normal file → Executable file
@ -57,6 +57,13 @@
|
||||
|
||||
#ifdef OPENSUBDIV_HAS_CUDA
|
||||
|
||||
#if not defined(__APPLE__)
|
||||
#include <GL/glew.h>
|
||||
#if defined(WIN32)
|
||||
#include <GL/wglew.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <cuda_runtime_api.h>
|
||||
#include <cuda_gl_interop.h>
|
||||
#include <stdio.h>
|
||||
|
8
examples/mayaPtexViewer/osdPtexMeshData.cpp
Normal file → Executable file
8
examples/mayaPtexViewer/osdPtexMeshData.cpp
Normal file → Executable file
@ -54,7 +54,13 @@
|
||||
// exclude the implied warranties of merchantability, fitness for
|
||||
// a particular purpose and non-infringement.
|
||||
//
|
||||
#include <GL/glew.h>
|
||||
|
||||
#if not defined(__APPLE__)
|
||||
#include <GL/glew.h>
|
||||
#if defined(WIN32)
|
||||
#include <GL/wglew.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <maya/MFnMesh.h>
|
||||
|
||||
|
4
examples/mayaViewer/OpenSubdivShader.cpp
Normal file → Executable file
4
examples/mayaViewer/OpenSubdivShader.cpp
Normal file → Executable file
@ -58,8 +58,10 @@
|
||||
#if defined(__APPLE__)
|
||||
#include <maya/OpenMayaMac.h>
|
||||
#else
|
||||
// Include GLEW before Maya and OSD includes
|
||||
#include <GL/glew.h>
|
||||
#if defined(WIN32)
|
||||
#include <GL/wglew.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
4
examples/mayaViewer/OpenSubdivShaderOverride.cpp
Normal file → Executable file
4
examples/mayaViewer/OpenSubdivShaderOverride.cpp
Normal file → Executable file
@ -63,8 +63,10 @@
|
||||
#if defined(__APPLE__)
|
||||
#include <maya/OpenMayaMac.h>
|
||||
#else
|
||||
// Include GLEW before Maya and OSD includes
|
||||
#include <GL/glew.h>
|
||||
#if defined(WIN32)
|
||||
#include <GL/wglew.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
7
examples/mayaViewer/cudaUtil.cpp
Normal file → Executable file
7
examples/mayaViewer/cudaUtil.cpp
Normal file → Executable file
@ -57,6 +57,13 @@
|
||||
|
||||
#ifdef OPENSUBDIV_HAS_CUDA
|
||||
|
||||
#if not defined(__APPLE__)
|
||||
#include <GL/glew.h>
|
||||
#if defined(WIN32)
|
||||
#include <GL/wglew.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <cuda_runtime_api.h>
|
||||
#include <cuda_gl_interop.h>
|
||||
#include <stdio.h>
|
||||
|
@ -103,6 +103,7 @@ endforeach()
|
||||
#-------------------------------------------------------------------------------
|
||||
_add_glut_executable(ptexViewer
|
||||
viewer.cpp
|
||||
../common/font_image.cpp
|
||||
../common/hud.cpp
|
||||
../common/gl_hud.cpp
|
||||
../common/hdr_reader.cpp
|
||||
|
Loading…
Reference in New Issue
Block a user