Merge pull request #1 from raysan5/master

Update
This commit is contained in:
Berni8k 2018-10-20 12:34:40 +02:00 committed by GitHub
commit 464a559020
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 13 deletions

View File

@ -5,8 +5,7 @@
* This example has been created using raylib 1.8 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Example based on Berni work on Raspberry Pi:
* http://forum.raylib.com/index.php?p=/discussion/124/line-versus-triangle-drawing-order
* Example based on Berni work on Raspberry Pi.
*
* Copyright (c) 2017 Ramon Santamaria (@raysan5)
*

View File

@ -342,9 +342,6 @@ endif
INCLUDE_PATHS = -I. -Iexternal/glfw/include
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
INCLUDE_PATHS += -Iexternal
endif
ifeq ($(PLATFORM_OS),BSD)
INCLUDE_PATHS += -I/usr/local/include
LDFLAGS += -L. -Lsrc -L/usr/local/lib -L$(RAYLIB_RELEASE_PATH)

View File

@ -1158,8 +1158,9 @@ Music LoadMusicStream(const char *fileName)
music->stream = InitAudioStream(music->ctxMp3.sampleRate, 32, music->ctxMp3.channels);
// TODO: It seems the total number of samples is not obtained correctly...
music->totalSamples = (unsigned int)music->ctxMp3.framesRemaining*music->ctxMp3.channels;
// TODO: There is not an easy way to compute the total number of samples available
// in an MP3, frames size could be variable... we tried with a 60 seconds music... but crashes...
music->totalSamples = 60*music->ctxMp3.sampleRate*music->ctxMp3.channels;
music->samplesLeft = music->totalSamples;
music->ctxType = MUSIC_AUDIO_MP3;
music->loopCount = -1; // Infinite loop by default

View File

@ -125,7 +125,7 @@
#include <ctype.h> // Required for: tolower() [Used in IsFileExtension()]
#include <sys/stat.h> // Required for stat() [Used in GetLastWriteTime()]
#if defined(_WIN32) && defined(_MSC_VER)
#if defined(PLATFORM_DESKTOP) && defined(_WIN32) && defined(_MSC_VER)
#include "external/dirent.h" // Required for: DIR, opendir(), closedir() [Used in GetDirectoryFiles()]
#else
#include <dirent.h> // Required for: DIR, opendir(), closedir() [Used in GetDirectoryFiles()]

View File

@ -1506,9 +1506,17 @@ void rlDeleteTextures(unsigned int id)
void rlDeleteRenderTextures(RenderTexture2D target)
{
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
if (target.id > 0) glDeleteFramebuffers(1, &target.id);
if (target.texture.id > 0) glDeleteTextures(1, &target.texture.id);
if (target.depth.id > 0) glDeleteTextures(1, &target.depth.id);
if (target.depth.id > 0)
{
#if defined(GRAPHICS_API_OPENGL_ES2)
glDeleteRenderbuffers(1, &target.depth.id);
#elif defined(GRAPHICS_API_OPENGL_33)
glDeleteTextures(1, &target.depth.id);
#endif
}
if (target.id > 0) glDeleteFramebuffers(1, &target.id);
TraceLog(LOG_INFO, "[FBO ID %i] Unloaded render texture data from VRAM (GPU)", target.id);
#endif
@ -2171,7 +2179,7 @@ void rlUnloadTexture(unsigned int id)
// Load a texture to be used for rendering (fbo with color and depth attachments)
RenderTexture2D rlLoadRenderTexture(int width, int height)
{
RenderTexture2D target;
RenderTexture2D target = { 0 };
target.id = 0;
@ -2251,8 +2259,16 @@ RenderTexture2D rlLoadRenderTexture(int width, int height)
default: break;
}
glDeleteTextures(1, &target.texture.id);
glDeleteTextures(1, &target.depth.id);
if (target.texture.id > 0) glDeleteTextures(1, &target.texture.id);
if (target.depth.id > 0)
{
#if defined(GRAPHICS_API_OPENGL_ES2)
glDeleteRenderbuffers(1, &target.depth.id);
#elif defined(GRAPHICS_API_OPENGL_33)
glDeleteTextures(1, &target.depth.id);
#endif
}
glDeleteFramebuffers(1, &target.id);
}
else TraceLog(LOG_INFO, "[FBO ID %i] Framebuffer object created successfully", target.id);