Changeset 2001
- Timestamp:
- Oct 9, 2012, 5:22:37 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.gitignore
r1995 r2001 79 79 tutorial/02_cube 80 80 tutorial/03_noise 81 tutorial/04_texture 81 82 tutorial/05_easymesh 82 83 tutorial/08_fbo -
trunk/src/gpu/shader.h
r1849 r2001 51 51 friend class Shader; 52 52 friend class FrameBuffer; 53 friend class Texture; 53 54 54 55 public: -
trunk/src/gpu/texture.cpp
r1994 r2001 46 46 47 47 #if defined USE_D3D9 48 IDirect3DTexture9 *m_tex ;48 IDirect3DTexture9 *m_texture; 49 49 #elif defined _XBOX 50 D3DTexture *m_tex ;51 #else 52 GLuint m_tex id;50 D3DTexture *m_texture; 51 #else 52 GLuint m_texture; 53 53 GLint m_internal_format; 54 54 GLenum m_gl_format, m_gl_type; … … 102 102 g_d3ddevice->CreateTexture(m_data->m_size.x, m_data->m_size.y, 1, 103 103 d3d_usage, d3d_format, 104 D3DPOOL_DEFAULT, &m_data->m_tex , NULL);104 D3DPOOL_DEFAULT, &m_data->m_texture, NULL); 105 105 #else 106 106 static struct … … 144 144 m_data->m_gl_type = GET_CLAMPED(gl_formats, format).type; 145 145 146 glGenTextures(1, &m_data->m_tex id);147 glBindTexture(GL_TEXTURE_2D, m_data->m_tex id);146 glGenTextures(1, &m_data->m_texture); 147 glBindTexture(GL_TEXTURE_2D, m_data->m_texture); 148 148 149 149 # if defined __CELLOS_LV2__ … … 158 158 } 159 159 160 ShaderTexture Texture::GetTexture() const 161 { 162 ShaderTexture ret; 163 #if defined USE_D3D9 || defined _XBOX 164 ret.m_flags = (uint64_t)(uintptr_t)m_data->m_texture; 165 #else 166 ret.m_flags = m_data->m_texture; 167 #endif 168 return ret; 169 } 170 160 171 void Texture::Bind() 161 172 { 162 173 #if defined _XBOX || defined USE_D3D9 163 g_d3ddevice->SetTexture(0, m_data->m_tex );174 g_d3ddevice->SetTexture(0, m_data->m_texture); 164 175 #else 165 176 # if !defined HAVE_GLES_2X 166 177 glEnable(GL_TEXTURE_2D); 167 178 # endif 168 glBindTexture(GL_TEXTURE_2D, m_data->m_tex id);179 glBindTexture(GL_TEXTURE_2D, m_data->m_texture); 169 180 #endif 170 181 } … … 175 186 D3DLOCKED_RECT rect; 176 187 # if defined USE_D3D9 177 m_data->m_tex ->LockRect(0, &rect, NULL, D3DLOCK_DISCARD);178 # else 179 m_data->m_tex ->LockRect(0, &rect, NULL, 0);188 m_data->m_texture->LockRect(0, &rect, NULL, D3DLOCK_DISCARD); 189 # else 190 m_data->m_texture->LockRect(0, &rect, NULL, 0); 180 191 # endif 181 192 182 193 memcpy(rect.pBits, data, rect.Pitch * m_data->m_size.y); 183 194 184 m_data->m_tex ->UnlockRect(0);195 m_data->m_texture->UnlockRect(0); 185 196 186 197 #else … … 195 206 #if defined _XBOX || defined USE_D3D9 196 207 D3DLOCKED_RECT rect; 197 m_data->m_tex ->LockRect(0, &rect, NULL, 0);208 m_data->m_texture->LockRect(0, &rect, NULL, 0); 198 209 199 210 for (int j = 0; j < size.y; j++) … … 205 216 } 206 217 207 m_data->m_tex ->UnlockRect(0);218 m_data->m_texture->UnlockRect(0); 208 219 209 220 #else … … 216 227 { 217 228 #if defined USE_D3D9 || defined _XBOX 218 m_data->m_tex ->Release();219 #else 220 glDeleteTextures(1, &m_data->m_tex id);229 m_data->m_texture->Release(); 230 #else 231 glDeleteTextures(1, &m_data->m_texture); 221 232 #endif 222 233 -
trunk/src/gpu/texture.h
r1992 r2001 47 47 void SetSubData(ivec2 origin, ivec2 size, void *data); 48 48 49 ShaderTexture GetTexture() const; 50 49 51 private: 50 52 class TextureData *m_data; -
trunk/tutorial/Makefile.am
r1981 r2001 4 4 AM_CPPFLAGS = -I$(top_srcdir)/src 5 5 6 noinst_PROGRAMS = 01_triangle 02_cube 03_noise 05_easymesh 08_fbo 11_fractal 6 noinst_PROGRAMS = 01_triangle 02_cube 03_noise 04_texture 05_easymesh \ 7 08_fbo 11_fractal 7 8 8 9 01_triangle_SOURCES = 01_triangle.cpp 01_triangle.lolfx … … 21 22 03_noise_DEPENDENCIES = $(top_builddir)/src/liblol.a 22 23 24 04_texture_SOURCES = 04_texture.cpp 04_texture.lolfx 25 04_texture_CPPFLAGS = @LOL_CFLAGS@ @PIPI_CFLAGS@ 26 04_texture_LDFLAGS = $(top_builddir)/src/liblol.a @LOL_LIBS@ @PIPI_LIBS@ 27 04_texture_DEPENDENCIES = $(top_builddir)/src/liblol.a 28 23 29 05_easymesh_SOURCES = 05_easymesh.cpp 24 30 05_easymesh_CPPFLAGS = @LOL_CFLAGS@ @PIPI_CFLAGS@
Note: See TracChangeset
for help on using the changeset viewer.