Commit 09b3fe71 authored by David Llewellyn-Jones's avatar David Llewellyn-Jones

Bumped version number to 0.36. Updated dpkg configuration files.

parent 4078f308
The MIT License
Copyright (c) 2012-2014 David Llewellyn-Jones
Copyright (c) 2012-2015 David Llewellyn-Jones
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
Functy-0.36: 5-August-2015
- Initial support for function animation using real-time audio frequency analysis
Functy-0.35: 10-May-2015
- Added config scripts
......
The MIT License
Copyright (c) 2012-2014 David Llewellyn-Jones
Copyright (c) 2012-2015 David Llewellyn-Jones
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
......
......@@ -567,6 +567,12 @@ The set of frames is compressed as a zip archive.</property>
<signal name="activate" handler="gtk_widget_show" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem6">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="MenuQuit">
<property name="label">gtk-quit</property>
......
......@@ -13,6 +13,9 @@
//float DifferentialX (float x, float y, float t);
//float DifferentialY (float x, float y, float t);
//vec4 Colour (float x, float y, float z, float t);
//uniform sampler2D tAudio;
//float audio (float x);
void main () {
// vec3 vHalf;
......@@ -68,6 +71,10 @@ void main () {
gl_FragColor = vec4 (1.0, 1.0, 1.0, 1.0);
}
//float audio (float x) {
// return texture2D (tAudio, vec2(x, 0)).r;
//}
//float DifferentialX (float x, float y, float t) {
// float z;
//
......
......@@ -7,10 +7,12 @@ uniform float fTime;
//varying float fDist;
varying vec3 vFuncParams;
//varying mat3 vNormalMatrix;
uniform sampler2D tAudio;
/*REPLACE:controlvars*//*END*/
float FunctionZ (float x, float y, float t);
float audio (float x);
void main() {
vec4 vEyeCoordsPos;
......@@ -51,6 +53,10 @@ void main() {
gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vVertex;
}
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
float FunctionZ (float x, float y, float t) {
float z;
......
......@@ -12,6 +12,7 @@ varying mat3 mNormalMatrix;
uniform sampler2D tTexture;
uniform sampler2D tBumpMap;
uniform sampler2DShadow tShadow;
uniform sampler2D tAudio;
uniform float fBumpScale;
uniform float fTextureStrength;
varying vec4 vShadowPos;
......@@ -25,6 +26,7 @@ uniform float fShadowBlurY;
float DifferentialX (float x, float y, float t);
float DifferentialY (float x, float y, float t);
vec4 Colour (float x, float y, float z, float t);
float audio (float x);
void main () {
vec3 vHalf;
......@@ -101,6 +103,10 @@ void main () {
gl_FragColor.a = vColourRaw.a;
}
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
float DifferentialX (float x, float y, float t) {
float z;
......
......@@ -9,12 +9,14 @@ varying vec3 vFuncParams;
varying mat3 mNormalMatrix;
varying vec4 vShadowPos;
uniform mat4 mLightTransform;
uniform sampler2D tAudio;
#define M_PI (3.1415926535897932384626433832795)
/*REPLACE:controlvars*//*END*/
float FunctionZ (float x, float y, float t);
float audio (float x);
void main() {
vec4 vEyeCoordsPos;
......@@ -61,6 +63,10 @@ void main() {
gl_TexCoord[0].t = 0.1f + (vVertex.y) / 2.2f;
}
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
float FunctionZ (float x, float y, float t) {
float z;
......
......@@ -9,6 +9,7 @@ uniform float fTime;
//varying mat3 vNormalMatrix;
//varying vec4 vShadowPos;
//uniform mat4 mLightTransform;
uniform sampler2D tAudio;
#define M_PI (3.1415926535897932384626433832795)
......@@ -18,6 +19,7 @@ vec3 FunctionC (float a, float t);
float FunctionR (float a, float p, float t);
vec3 FunctionD1 (float a, float t);
vec3 FunctionD2 (float a, float t);
float audio (float x);
void main() {
vec4 vEyeCoordsPos;
......@@ -98,6 +100,10 @@ void main() {
// gl_TexCoord[0].t = 1.0f * (0.1f + (fP / (M_PI)) / 15.0);
}
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
vec3 FunctionC (float a, float t) {
vec3 c;
......
......@@ -12,6 +12,7 @@ varying mat3 mNormalMatrix;
uniform sampler2D tTexture;
uniform sampler2D tBumpMap;
uniform sampler2DShadow tShadow;
uniform sampler2D tAudio;
uniform float fBumpScale;
uniform float fTextureStrength;
varying vec4 vShadowPos;
......@@ -28,6 +29,7 @@ vec3 FunctionD2 (float a, float t);
float DifferentialA (float a, float p, float t);
float DifferentialP (float a, float p, float t);
vec4 Colour (float a, float p, float r, float t);
float audio (float x);
void main () {
vec3 vHalf;
......@@ -163,6 +165,10 @@ void main () {
gl_FragColor.a = vColourRaw.a;
}
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
vec4 Colour (float a, float p, float r, float t) {
vec4 c;
......
......@@ -9,6 +9,7 @@ varying vec3 vFuncParams;
varying mat3 mNormalMatrix;
varying vec4 vShadowPos;
uniform mat4 mLightTransform;
uniform sampler2D tAudio;
#define M_PI (3.1415926535897932384626433832795)
......@@ -18,6 +19,7 @@ vec3 FunctionC (float a, float t);
float FunctionR (float a, float p, float t);
vec3 FunctionD1 (float a, float t);
vec3 FunctionD2 (float a, float t);
float audio (float x);
void main() {
vec4 vEyeCoordsPos;
......@@ -98,6 +100,10 @@ void main() {
gl_TexCoord[0].t = 1.0f * (0.1f + (fP / (M_PI)) / 15.0);
}
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
vec3 FunctionC (float a, float t) {
vec3 c;
......
......@@ -9,12 +9,14 @@ uniform float fTime;
//varying mat3 mNormalMatrix;
//varying vec4 vShadowPos;
//uniform mat4 mLightTransform;
uniform sampler2D tAudio;
#define M_PI (3.1415926535897932384626433832795)
/*REPLACE:controlvars*//*END*/
float FunctionR (float a, float p, float t);
float audio (float x);
void main() {
vec4 vEyeCoordsPos;
......@@ -69,6 +71,10 @@ void main() {
// gl_TexCoord[0].t = 0.1f + (fP / (M_PI)) / 2.2f;
}
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
float FunctionR (float a, float p, float t) {
float r;
......
......@@ -12,6 +12,7 @@ varying mat3 mNormalMatrix;
uniform sampler2D tTexture;
uniform sampler2D tBumpMap;
uniform sampler2DShadow tShadow;
uniform sampler2D tAudio;
uniform float fBumpScale;
uniform float fTextureStrength;
varying vec4 vShadowPos;
......@@ -25,6 +26,7 @@ uniform float fShadowBlurY;
float DifferentialA (float a, float p, float t);
float DifferentialP (float a, float p, float t);
vec4 Colour (float a, float p, float r, float t);
float audio (float x);
void main () {
vec3 vHalf;
......@@ -119,6 +121,10 @@ void main () {
gl_FragColor.a = vColourRaw.a;
}
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
float DifferentialA (float a, float p, float t) {
float r;
......
......@@ -9,12 +9,14 @@ varying vec3 vFuncParams;
varying mat3 mNormalMatrix;
varying vec4 vShadowPos;
uniform mat4 mLightTransform;
uniform sampler2D tAudio;
#define M_PI (3.1415926535897932384626433832795)
/*REPLACE:controlvars*//*END*/
float FunctionR (float a, float p, float t);
float audio (float x);
void main() {
vec4 vEyeCoordsPos;
......@@ -69,6 +71,10 @@ void main() {
gl_TexCoord[0].t = 0.1f + (fP / (M_PI)) / 2.2f;
}
float audio (float x) {
return texture2D (tAudio, vec2(x, 0)).r;
}
float FunctionR (float a, float p, float t) {
float r;
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for Functy 0.35.
# Generated by GNU Autoconf 2.69 for Functy 0.36.
#
# Report bugs to <david@flypig.co.uk>.
#
......@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='Functy'
PACKAGE_TARNAME='functy'
PACKAGE_VERSION='0.35'
PACKAGE_STRING='Functy 0.35'
PACKAGE_VERSION='0.36'
PACKAGE_STRING='Functy 0.36'
PACKAGE_BUGREPORT='david@flypig.co.uk'
PACKAGE_URL=''
......@@ -1294,7 +1294,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures Functy 0.35 to adapt to many kinds of systems.
\`configure' configures Functy 0.36 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1360,7 +1360,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of Functy 0.35:";;
short | recursive ) echo "Configuration of Functy 0.36:";;
esac
cat <<\_ACEOF
......@@ -1469,7 +1469,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
Functy configure 0.35
Functy configure 0.36
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -1930,7 +1930,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by Functy $as_me 0.35, which was
It was created by Functy $as_me 0.36, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -2793,7 +2793,7 @@ fi
# Define the identity of the package.
PACKAGE='functy'
VERSION='0.35'
VERSION='0.36'
cat >>confdefs.h <<_ACEOF
......@@ -6553,7 +6553,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by Functy $as_me 0.35, which was
This file was extended by Functy $as_me 0.36, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -6619,7 +6619,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
Functy config.status 0.35
Functy config.status 0.36
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
......@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT([Functy], [0.35], [david@flypig.co.uk])
AC_INIT([Functy], [0.36], [david@flypig.co.uk])
AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE([-Wall -Werror])
AC_CONFIG_SRCDIR([src/functy.c])
......
functy (0.36.0-1) unstable; urgency=low
* Initial support for function animation using real-time audio frequency analysis
-- David Llewellyn-Jones <david@flypig.co.uk> Wed, 5 Aug 2015 23:19:30 +0100
functy (0.35.0-1) unstable; urgency=low
* Added config scripts
......
......@@ -2,7 +2,7 @@ Source: functy
Section: math
Priority: extra
Maintainer: David Llewellyn-Jones <david@flypig.co.uk>
Build-Depends: debhelper (>= 7), autotools-dev, libgtkglext1-dev, freeglut3-dev, libgtk2.0-dev, libpango1.0-dev, libglib2.0-dev, libcairo2-dev, zlib1g-dev, libzip-dev, libpng12-dev, libtbb-dev, glee-dev, libopenvdb-dev, libopenexr-dev, libsymbolic-dev, libboost-dev
Build-Depends: debhelper (>= 7), autotools-dev, libgtkglext1-dev, freeglut3-dev, libgtk2.0-dev, libpango1.0-dev, libglib2.0-dev, libcairo2-dev, zlib1g-dev, libzip-dev, libpng12-dev, libtbb-dev, glee-dev, libopenvdb-dev, libopenexr-dev, libsymbolic-dev, libboost-dev, libpulse-dev, libpulse-mainloop-glib0, fftw3-dev, libncursesw5-dev
Standards-Version: 3.8.0
Package: functy
......
......@@ -20,8 +20,12 @@
#include <fftw3.h>
#include <math.h>
//#include <locale.h>
//#include <curses.h>
//#define NCURSESBARS (1)
#ifdef NCURSESBARS
#include <locale.h>
#include <curses.h>
#endif // NCURSESBARS
#include "audio.h"
......@@ -32,22 +36,21 @@
#define CHANNELS (1)
#define FPS (30)
#define GAIN (1.0)
#define BARS (120)
#define UPPER_FREQ (3520.0)
#define SCALE (78)
#define SOURCE NULL
#define LATENCY (300000)
//#define NCURSESBARS (1)
///////////////////////////////////////////////////////////////////
// Structures and enumerations
struct _AudioPersist {
// General
int nBufferSize;
int anBars[BARS];
GLubyte auBars[AUDIO_BARS];
int nBufferPos;
TexPersist * psTexData;
bool boPause;
// PulseAudio structures
pa_glib_mainloop * psMainLoop;
......@@ -72,7 +75,7 @@ struct _AudioPersist {
void AudioInitialise (AudioPersist * psAudioData);
float AudioHanningWindow (int nFrequency, int nMaxFrequency) ;
void CalculateBars (fftw_complex * acFFTData, int nDataSize, int * anBars, int nNumBars);
void CalculateBars (fftw_complex * acFFTData, int nDataSize, GLubyte * auBars, int nNumBars);
void PulseAudioStateCallback (pa_context * psContext, void * psUserData);
static void PulseAudioStreamReadCallback (pa_stream * psRecordStream, size_t nLength, void * psUserData);
void AudioAnalyse (AudioPersist * psAudioData);
......@@ -110,9 +113,10 @@ void AudioInitialise (AudioPersist * psAudioData) {
psAudioData->pfWindow = g_new (float, psAudioData->nBufferSize);
psAudioData->pfBuffer = g_new (float, psAudioData->nBufferSize);
psAudioData->psRecordStream = NULL;
psAudioData->boPause = FALSE;
for (nBar = 0; nBar < BARS; nBar++) {
psAudioData->anBars[nBar] = 0;
for (nBar = 0; nBar < AUDIO_BARS; nBar++) {
psAudioData->auBars[nBar] = 0;
}
for (nFrequency = 0; nFrequency < psAudioData->nBufferSize; nFrequency++) {
......@@ -143,6 +147,14 @@ void DeleteAudioPersist (AudioPersist * psAudioData) {
g_free (psAudioData);
}
void SetAudioTextureData (TexPersist * psTexData, AudioPersist * psAudioData) {
psAudioData->psTexData = psTexData;
}
void SetAudioPause (bool boPause, AudioPersist * psAudioData) {
psAudioData->boPause = boPause;
}
float AudioHanningWindow (int nFrequency, int nMaxFrequency) {
float fActual;
fActual = 0.5f * (1.0f - cosf (2.0f * M_PI * nFrequency / (nMaxFrequency - 1.0f)));
......@@ -186,18 +198,21 @@ void RecordStop (AudioPersist * psAudioData) {
psAudioData->psRecordStream = NULL;
}
for (nBar = 0; nBar < BARS; nBar++) {
psAudioData->anBars[nBar] = 0;
for (nBar = 0; nBar < AUDIO_BARS; nBar++) {
psAudioData->auBars[nBar] = 0;
}
// Transfer to texture
UpdateTextureSingleChannel (TEXNAME_AUDIO, AUDIO_BARS, 1, psAudioData->auBars, psAudioData->psTexData);
}
bool AudioCheckRecordActive (AudioPersist * psAudioData) {
return (psAudioData->psRecordStream != NULL);
}
void CalculateBars (fftw_complex * acFFTData, int nDataSize, int * anBars, int nNumBars) {
void CalculateBars (fftw_complex * acFFTData, int nDataSize, GLubyte * auBars, int nNumBars) {
// todo: use the float-point value and implement proper interpolation.
double barWidthD = UPPER_FREQ / (FPS * BARS);
double barWidthD = UPPER_FREQ / (FPS * AUDIO_BARS);
int barWidth = (int)ceil(barWidthD);
int nBar;
int nMidBar;
......@@ -234,7 +249,7 @@ void CalculateBars (fftw_complex * acFFTData, int nDataSize, int * anBars, int n
}
// Set the bar height
anBars[nBar] = dB;
auBars[nBar] = dB;
}
}
......@@ -293,19 +308,23 @@ static void PulseAudioStreamReadCallback (pa_stream * psRecordStream, size_t nLe
void AudioAnalyse (AudioPersist * psAudioData) {
int nBar;
for (nBar = 0; nBar < psAudioData->nBufferSize; nBar++) {
psAudioData->pfIn[nBar] = (double)(psAudioData->pfWindow[nBar] * psAudioData->pfBuffer[nBar]);
}
if (psAudioData->psRecordStream && (!psAudioData->boPause)) {
for (nBar = 0; nBar < psAudioData->nBufferSize; nBar++) {
psAudioData->pfIn[nBar] = (double)(psAudioData->pfWindow[nBar] * psAudioData->pfBuffer[nBar]);
}
fftw_execute (psAudioData->sPlan);
CalculateBars (psAudioData->pOut, psAudioData->nBufferSize, psAudioData->anBars, BARS);
fftw_execute (psAudioData->sPlan);
CalculateBars (psAudioData->pOut, psAudioData->nBufferSize, psAudioData->auBars, AUDIO_BARS);
// Transfer to texture
UpdateTextureSingleChannel (TEXNAME_AUDIO, AUDIO_BARS, 1, psAudioData->auBars, psAudioData->psTexData);
}
#ifdef NCURSESBARS
erase ();
for (nBar = 0; nBar < BARS; nBar++) {
move (LINES - psAudioData->anBars[nBar], nBar);
vline (ACS_VLINE, psAudioData->anBars[nBar]);
for (nBar = 0; nBar < AUDIO_BARS; nBar++) {
move (LINES - psAudioData->auBars[nBar], nBar);
vline (ACS_VLINE, psAudioData->auBars[nBar]);
}
refresh ();
......@@ -315,8 +334,8 @@ void AudioAnalyse (AudioPersist * psAudioData) {
int GetAudioPower (int nBar, AudioPersist * psAudioData) {
int nPower = 0;
if ((nBar > 0) && (nBar < BARS)) {
nPower = psAudioData->anBars[nBar];
if ((nBar > 0) && (nBar < AUDIO_BARS)) {
nPower = psAudioData->auBars[nBar];
}
return nPower;
}
......@@ -344,3 +363,35 @@ pa_stream * AudioGetRecordStream (AudioPersist * psAudioData) {
return psAudioData->psRecordStream;
}
// Test user function approximate
double AudioApproximate (double fVar1, void * psContext) {
return 0.0;
}
// Test user function differentiate
Operation * AudioDifferentiate (Operation * psOp, Operation * psWRT, void * psContext) {
Operation * psReturn = NULL;
psReturn = CreateInteger (0);
return psReturn;
}
// Test user function simplify
Operation * AudioSimplify (Operation * psOp, void * psContext) {
Operation * psReturn = NULL;
psReturn = psOp;
return psReturn;
}
......@@ -15,11 +15,14 @@
// Includes
#include <pulse/pulseaudio.h>
#include "textures.h"
#include "symbolic.h"
///////////////////////////////////////////////////////////////////
// Defines
#define AUDIO_SOURCE_NAME_MAX (256)
#define AUDIO_BARS (120)
///////////////////////////////////////////////////////////////////
// Structures and enumerations
......@@ -34,6 +37,8 @@ typedef struct _AudioPersist AudioPersist;
AudioPersist * NewAudioPersist ();
void DeleteAudioPersist (AudioPersist * psAudioData);
void SetAudioTextureData (TexPersist * psTexData, AudioPersist * psAudioData);
void SetAudioPause (bool boPause, AudioPersist * psAudioData);
int GetAudioPower (int nBar, AudioPersist * psAudioData);
void AudioReturnSources (pa_source_info_cb_t pfCallback, void * psUserData, AudioPersist * psAudioData);
pa_stream * AudioGetRecordStream (AudioPersist * psAudioData);
......@@ -41,6 +46,10 @@ void RecordStart (char const * const szSource, AudioPersist * psAudioData);
void RecordStop (AudioPersist * psAudioData);
bool AudioCheckRecordActive (AudioPersist * psAudioData);
double AudioApproximate (double fVar1, void * psContext);
Operation * AudioDifferentiate (Operation * psOp, Operation * psWRT, void * psContext);
Operation * AudioSimplify (Operation * psOp, void * psContext);
///////////////////////////////////////////////////////////////////
// Function definitions
......
......@@ -133,6 +133,9 @@ FuncPersist * NewFuncPersist (FUNCTYPE eType) {
// Shadow data
psFuncData->psShadowData = NULL;
// Texture data
psFuncData->psTexData = NULL;
psFuncData->boMaterialFill = FALSE;
psFuncData->fMaterialThickness = 0.1f;
......@@ -267,9 +270,16 @@ void DeleteFuncPersist (FuncPersist * psFuncData) {
// Clear the shadow data (will be freed in vis)
psFuncData->psShadowData = NULL;
// Clear the texture data (will be freed in vis)
psFuncData->psTexData = NULL;
g_free (psFuncData);
}
void SetFunctionTextureData (TexPersist * psTexData, FuncPersist * psFuncData) {
psFuncData->psTexData = psTexData;
}
void InitShader (FuncPersist * psFuncData) {
if (psFuncData->psShaderData == NULL) {
psFuncData->psShaderData = NewShaderPersist ();
......@@ -1139,6 +1149,13 @@ void DrawGraph (FuncPersist * psFuncData) {
nVar = glGetUniformLocation (uShaderProgram, "tShadow");
glUniform1i (nVar, 2);
// Transfer the audio spectrum analysis texture
uTexture = GetTexture (TEXNAME_AUDIO, NULL, psFuncData->psTexData);
glActiveTexture (GL_TEXTURE3);
glBindTexture (GL_TEXTURE_2D, uTexture);
nVar = glGetUniformLocation (uShaderProgram, "tAudio");
glUniform1i (nVar, 3);
//uBumpMap = GetFunctionBumpTexture (psFuncData);
uTexture = GetFunctionTexture (psFuncData);
if (uTexture != TEXTURE_NONE) {
......@@ -1251,7 +1268,9 @@ void DrawGraphShadow (FuncPersist * psFuncData) {
int nYVertices;
int nXVertices;
FUNCTYPE eFuncType;
//GLuint uShaderProgram;
GLuint uTexture;
GLint nVar;
GLuint uShaderProgram;
static GLdouble afClipEquations[4][4] = {{-1.0, 0.0, 0.0, AXIS_XHSIZE},
{1.0, 0.0, 0.0, AXIS_XHSIZE},
{0.0, -1.0, 0.0, AXIS_YHSIZE},
......@@ -1269,7 +1288,7 @@ void DrawGraphShadow (FuncPersist * psFuncData) {
glPushMatrix();
ActivateFunctionShaderShadow (psFuncData);
//uShaderProgram = GetShaderProgram (psFuncData->psShaderData);
uShaderProgram = GetShaderProgram (psFuncData->psShaderShadowData);
if ((eFuncType == FUNCTYPE_SPHERICAL) || (eFuncType == FUNCTYPE_CURVE)) {
// Enable the spherical clipping planes
......@@ -1286,6 +1305,13 @@ void DrawGraphShadow (FuncPersist * psFuncData) {
glMultMatrixf (psFuncData->mStructureTransform.afM);
}
// Transfer the audio spectrum analysis texture
uTexture = GetTexture (TEXNAME_AUDIO, NULL, psFuncData->psTexData);
glActiveTexture (GL_TEXTURE3);
glBindTexture (GL_TEXTURE_2D, uTexture);
nVar = glGetUniformLocation (uShaderProgram, "tAudio");
glUniform1i (nVar, 3);
glEnableClientState (GL_VERTEX_ARRAY);
for (nXIndex = 0; nXIndex < nXVertices - 1; nXIndex++) {
......
......@@ -53,6 +53,7 @@ FUNCTYPE GetFunctionType (FuncPersist * psFuncData);
void SetFunction (char const * const szFunction, FuncPersist * psFuncData);
void SetFunctionName (char const * const szName, FuncPersist * psFuncData);
void SetFunctionColours (char const * const szRed, char const * const szGreen, char const * const szBlue, char const * const szAlpha, FuncPersist * psFuncData);
void SetFunctionTextureData (TexPersist * psTexData, FuncPersist * psFuncData);
char const * GetFunctionName (FuncPersist * psFuncData);
char const * GetFunctionString (FuncPersist * psFuncData);
char const * GetRedString (FuncPersist * psFuncData);
......
......@@ -109,6 +109,9 @@ struct _FuncPersist {
// Shadow variables
ShadowPersist * psShadowData;
// Textures
TexPersist * psTexData;
// Material variables
bool boMaterialFill;
float fMaterialThickness;
......
......@@ -4265,7 +4265,7 @@ static gboolean AboutShow (GtkWidget * psWidget, gpointer psData) {
gtk_show_about_dialog (GTK_WINDOW (psWindow),
"program-name", "Functy",
"comments", "3D graph drawing package. Render Cartesian, spherical and parametric curve functions on the GPU.",
"copyright", "Copyright © 2014 David Llewellyn-Jones",
"copyright", "Copyright © 2015 David Llewellyn-Jones",
"logo", psIcon,
"title", "About Functy",
"wrap-license", TRUE,
......
......@@ -14,6 +14,7 @@
#include "utils.h"
#include "textures.h"
#include "audio.h"
///////////////////////////////////////////////////////////////////
// Defines
......@@ -60,6 +61,7 @@ void DeleteTexPersist (TexPersist * psTexData) {
}
void LoadTextures (TexPersist * psTexData) {
psTexData->aunTextureName[TEXNAME_AUDIO] = CreateBlankTextureSingleChannel (AUDIO_BARS, 1);
//LoadTextureRaw (FUNCTYDIR "/Grid.raw", 256, 256, TRUE, psTexData);
//LoadTextureRaw ("/home/flypig/Documents/Development/Projects/Functy/Star.raw", 256, 256, TRUE, psTexData);
}
......@@ -144,9 +146,81 @@ GLuint LoadTextureRaw (char const * const szFilename, int const nWidth, int cons
return unTextureName;
}
GLuint CreateBlankTexture (int const nWidth, int const nHeight,