1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2016 Leszek Koltunski //
|
3
|
// //
|
4
|
// This file is part of Distorted. //
|
5
|
// //
|
6
|
// Distorted is free software: you can redistribute it and/or modify //
|
7
|
// it under the terms of the GNU General Public License as published by //
|
8
|
// the Free Software Foundation, either version 2 of the License, or //
|
9
|
// (at your option) any later version. //
|
10
|
// //
|
11
|
// Distorted is distributed in the hope that it will be useful, //
|
12
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14
|
// GNU General Public License for more details. //
|
15
|
// //
|
16
|
// You should have received a copy of the GNU General Public License //
|
17
|
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. //
|
18
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19
|
|
20
|
package org.distorted.library.main;
|
21
|
|
22
|
import android.opengl.GLES30;
|
23
|
|
24
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
25
|
// common parent class of Texture & OutputSurface; so that we can store either in Nodes.
|
26
|
|
27
|
abstract class InternalSurface extends InternalObject
|
28
|
{
|
29
|
int mColorCreated;
|
30
|
int mNumColors;
|
31
|
int mNumFBOs;
|
32
|
int[] mColorH;
|
33
|
|
34
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
35
|
|
36
|
InternalSurface(int create, int numfbos, int numcolors, int type)
|
37
|
{
|
38
|
super(type);
|
39
|
|
40
|
mNumFBOs = numfbos;
|
41
|
mNumColors = numcolors;
|
42
|
mColorCreated = create;
|
43
|
|
44
|
int total = mNumFBOs*mNumColors;
|
45
|
|
46
|
if( total>0 )
|
47
|
{
|
48
|
mColorH = new int[total];
|
49
|
for( int i=0; i<total; i++ ) mColorH[i] = 0;
|
50
|
}
|
51
|
}
|
52
|
|
53
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
54
|
// debugging only
|
55
|
|
56
|
String printDetails()
|
57
|
{
|
58
|
return getClass().getSimpleName();
|
59
|
}
|
60
|
|
61
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
62
|
|
63
|
boolean setAsInput()
|
64
|
{
|
65
|
if( mColorH[0]>0 )
|
66
|
{
|
67
|
GLES30.glActiveTexture(GLES30.GL_TEXTURE0);
|
68
|
GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, mColorH[0]);
|
69
|
return true;
|
70
|
}
|
71
|
|
72
|
return false;
|
73
|
}
|
74
|
}
|