Merge branch 'master' of github.com:bkaradzic/bgfx

This commit is contained in:
Branimir Karadžić 2015-03-05 17:45:05 -08:00
commit 4419338b27
4 changed files with 56 additions and 28 deletions

View File

@ -152,9 +152,6 @@ void VectorDisplay::beginFrame()
void VectorDisplay::endFrame()
{
float proj[16];
float ident[16];
bx::mtxIdentity(ident);
bx::mtxOrtho(proj, 0.0f, (float)m_screenWidth, (float)m_screenHeight, 0.0f, 0.0f, 1000.0f);
bgfx::setViewRect(m_view, 0, 0, m_screenWidth, m_screenHeight);
@ -171,14 +168,6 @@ void VectorDisplay::endFrame()
);
m_vertexBuffersSize[m_currentDrawStep] = (uint32_t)m_points.size();
//if the index buffer is cleared from the last "submit"-call everything is fine, but if not
//we clear it here again just to be sure it's not set... (the same for the Transform)
bgfx::IndexBufferHandle ib;
ib.idx = bgfx::invalidHandle;
bgfx::setIndexBuffer(ib);
bgfx::setTransform(ident);
for (int loopvar = 0; loopvar < m_numberDecaySteps; loopvar++)
{
int stepi = m_numberDecaySteps - loopvar - 1;

View File

@ -16,9 +16,6 @@
#include <bx/os.h>
#include <bx/handlealloc.h>
#define DEFAULT_WIDTH 1280
#define DEFAULT_HEIGHT 720
@interface AppDelegate : NSObject<NSApplicationDelegate>
{
bool terminated;
@ -80,7 +77,8 @@ namespace entry
struct Context
{
Context()
: m_exit(false)
: m_scroll(0)
, m_exit(false)
{
s_translateKey[27] = Key::Esc;
s_translateKey[13] = Key::Return;
@ -236,10 +234,11 @@ namespace entry
case NSMouseMoved:
case NSLeftMouseDragged:
case NSRightMouseDragged:
case NSOtherMouseDragged:
{
int x, y;
getMousePos(&x, &y);
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, 0);
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll);
break;
}
@ -247,7 +246,7 @@ namespace entry
{
int x, y;
getMousePos(&x, &y);
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, 0, MouseButton::Left, true);
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll, MouseButton::Left, true);
break;
}
@ -255,7 +254,7 @@ namespace entry
{
int x, y;
getMousePos(&x, &y);
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, 0, MouseButton::Left, false);
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll, MouseButton::Left, false);
break;
}
@ -263,7 +262,7 @@ namespace entry
{
int x, y;
getMousePos(&x, &y);
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, 0, MouseButton::Right, true);
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll, MouseButton::Right, true);
break;
}
@ -271,7 +270,32 @@ namespace entry
{
int x, y;
getMousePos(&x, &y);
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, 0, MouseButton::Right, false);
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll, MouseButton::Right, false);
break;
}
case NSOtherMouseDown:
{
int x, y;
getMousePos(&x, &y);
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll, MouseButton::Middle, true);
break;
}
case NSOtherMouseUp:
{
int x, y;
getMousePos(&x, &y);
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll, MouseButton::Middle, false);
break;
}
case NSScrollWheel:
{
int x, y;
getMousePos(&x, &y);
m_scroll += ([event deltaY] > 0.0f) ? 1 : -1;
m_eventQueue.postMouseEvent(s_defaultWindow, x, y, m_scroll);
break;
}
@ -364,7 +388,7 @@ namespace entry
[NSApp setMainMenu:menubar];
m_windowAlloc.alloc();
NSRect rect = NSMakeRect(0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT);
NSRect rect = NSMakeRect(0, 0, ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT);
NSWindow* window = [[NSWindow alloc]
initWithContentRect:rect
styleMask:0
@ -419,6 +443,7 @@ namespace entry
bx::HandleAllocT<ENTRY_CONFIG_MAX_WINDOWS> m_windowAlloc;
NSWindow* m_window[ENTRY_CONFIG_MAX_WINDOWS];
int32_t m_scroll;
bool m_exit;
};

View File

@ -1171,12 +1171,7 @@ namespace bgfx
{
setTextureFormat(TextureFormat::D32, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT);
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
{
setTextureFormat(TextureFormat::R16, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT);
setTextureFormat(TextureFormat::RGBA16, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT);
}
else
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES < 30) )
{
setTextureFormat(TextureFormat::RGBA16F, GL_RGBA, GL_RGBA, GL_HALF_FLOAT);
@ -1188,6 +1183,17 @@ namespace bgfx
}
}
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
|| BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
{
setTextureFormat(TextureFormat::R16, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT);
setTextureFormat(TextureFormat::RG16, GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT);
setTextureFormat(TextureFormat::RGBA16, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT);
setTextureFormat(TextureFormat::R32, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT);
setTextureFormat(TextureFormat::RG32, GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT);
setTextureFormat(TextureFormat::RGBA32, GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT);
}
if (s_extension[Extension::EXT_texture_format_BGRA8888 ].m_supported
|| s_extension[Extension::EXT_bgra ].m_supported
|| s_extension[Extension::IMG_texture_format_BGRA8888 ].m_supported

View File

@ -143,6 +143,10 @@ typedef uint64_t GLuint64;
# define GL_RG16 0x822C
#endif // GL_RG16
#ifndef GL_RG16UI
# define GL_RG16UI 0x823A
#endif // GL_RG16UI
#ifndef GL_RG16F
# define GL_RG16F 0x822F
#endif // GL_RG16F
@ -183,6 +187,10 @@ typedef uint64_t GLuint64;
# define GL_RG 0x8227
#endif // GL_RG
#ifndef GL_RG_INTEGER
# define GL_RG_INTEGER 0x8228
#endif // GL_RG_INTEGER
#ifndef GL_GREEN
# define GL_GREEN 0x1904
#endif // GL_GREEN