Commit 09e767a9 authored by teella's avatar teella

anti alias added for OSX and GL_LINE_SMOOTH enabled if antiAlias true

How ever createDevice does not pass any AntiAlias option so default is always false


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1282 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 5bdb986e
...@@ -308,6 +308,10 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d<s32>& screenSize, ...@@ -308,6 +308,10 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d<s32>& screenSize,
glDepthFunc(GL_LEQUAL); glDepthFunc(GL_LEQUAL);
glFrontFace( GL_CW ); glFrontFace( GL_CW );
// currently disabled, because often in software, and thus very slow // currently disabled, because often in software, and thus very slow
if (AntiAlias) {
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glEnable(GL_LINE_SMOOTH);
}
// glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST); // glHint(GL_POINT_SMOOTH_HINT, GL_FASTEST);
// glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST); // glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
// glEnable(GL_POINT_SMOOTH); // glEnable(GL_POINT_SMOOTH);
...@@ -573,10 +577,10 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) ...@@ -573,10 +577,10 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
extGlGenBuffers(1, &HWBuffer->vbo_verticesID); extGlGenBuffers(1, &HWBuffer->vbo_verticesID);
if (!HWBuffer->vbo_verticesID) return false; if (!HWBuffer->vbo_verticesID) return false;
newBuffer=true; newBuffer=true;
} }
else if (HWBuffer->vbo_verticesSize < vertexCount*vertexSize) else if (HWBuffer->vbo_verticesSize < vertexCount*vertexSize)
{ {
newBuffer=true; newBuffer=true;
} }
extGlBindBuffer(GL_ARRAY_BUFFER, HWBuffer->vbo_verticesID ); extGlBindBuffer(GL_ARRAY_BUFFER, HWBuffer->vbo_verticesID );
...@@ -585,8 +589,8 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) ...@@ -585,8 +589,8 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
if (!newBuffer) if (!newBuffer)
extGlBufferSubData(GL_ARRAY_BUFFER, 0, vertexCount * vertexSize, buffer.const_pointer()); extGlBufferSubData(GL_ARRAY_BUFFER, 0, vertexCount * vertexSize, buffer.const_pointer());
else else
{ {
HWBuffer->vbo_verticesSize = vertexCount*vertexSize; HWBuffer->vbo_verticesSize = vertexCount*vertexSize;
if (HWBuffer->Mapped==scene::EHM_STATIC) if (HWBuffer->Mapped==scene::EHM_STATIC)
extGlBufferData(GL_ARRAY_BUFFER, vertexCount * vertexSize, buffer.const_pointer(), GL_STATIC_DRAW); extGlBufferData(GL_ARRAY_BUFFER, vertexCount * vertexSize, buffer.const_pointer(), GL_STATIC_DRAW);
...@@ -630,10 +634,10 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) ...@@ -630,10 +634,10 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
if (!HWBuffer->vbo_indicesID) return false; if (!HWBuffer->vbo_indicesID) return false;
newBuffer=true; newBuffer=true;
} }
else if (HWBuffer->vbo_indicesSize < indexCount*indexSize) else if (HWBuffer->vbo_indicesSize < indexCount*indexSize)
{ {
newBuffer=true; newBuffer=true;
} }
extGlBindBuffer(GL_ELEMENT_ARRAY_BUFFER, HWBuffer->vbo_indicesID); extGlBindBuffer(GL_ELEMENT_ARRAY_BUFFER, HWBuffer->vbo_indicesID);
...@@ -641,8 +645,8 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) ...@@ -641,8 +645,8 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer)
if (!newBuffer) if (!newBuffer)
extGlBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, indexCount * indexSize, indices); extGlBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, indexCount * indexSize, indices);
else else
{ {
HWBuffer->vbo_indicesSize = indexCount*indexSize; HWBuffer->vbo_indicesSize = indexCount*indexSize;
if (HWBuffer->Mapped==scene::EHM_STATIC) if (HWBuffer->Mapped==scene::EHM_STATIC)
extGlBufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount * indexSize, indices, GL_STATIC_DRAW); extGlBufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount * indexSize, indices, GL_STATIC_DRAW);
...@@ -700,8 +704,8 @@ COpenGLDriver::SHWBufferLink *COpenGLDriver::createHardwareBuffer(const scene::I ...@@ -700,8 +704,8 @@ COpenGLDriver::SHWBufferLink *COpenGLDriver::createHardwareBuffer(const scene::I
HWBuffer->Mapped=mb->getHardwareMappingHint(); HWBuffer->Mapped=mb->getHardwareMappingHint();
HWBuffer->LastUsed=0; HWBuffer->LastUsed=0;
HWBuffer->vbo_verticesID=0; HWBuffer->vbo_verticesID=0;
HWBuffer->vbo_indicesID=0; HWBuffer->vbo_indicesID=0;
HWBuffer->vbo_verticesSize=0; HWBuffer->vbo_verticesSize=0;
HWBuffer->vbo_indicesSize=0; HWBuffer->vbo_indicesSize=0;
if (!updateHardwareBuffer(HWBuffer)) if (!updateHardwareBuffer(HWBuffer))
......
...@@ -190,7 +190,7 @@ namespace irr ...@@ -190,7 +190,7 @@ namespace irr
core::rect<s32> ReferenceRect; core::rect<s32> ReferenceRect;
}; };
bool createWindow(const irr::core::dimension2d<irr::s32>& windowSize, irr::u32 bits, bool fullscreen, bool vsync, bool stencilBuffer); bool createWindow(const irr::core::dimension2d<irr::s32>& windowSize, irr::u32 bits, bool fullscreen, bool vsync, bool stencilBuffer, bool antiAlias);
void initKeycodes(); void initKeycodes();
void storeMouseLocation(); void storeMouseLocation();
void postMouseEvent(void *event,irr::SEvent &ievent); void postMouseEvent(void *event,irr::SEvent &ievent);
......
...@@ -104,7 +104,7 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(video::E_DRIVER_TYPE driverType, ...@@ -104,7 +104,7 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(video::E_DRIVER_TYPE driverType,
os::Printer::log(name.version,ELL_INFORMATION); os::Printer::log(name.version,ELL_INFORMATION);
initKeycodes(); initKeycodes();
if (driverType != video::EDT_NULL) createWindow(windowSize,bits,fullscreen,vsync,stencilbuffer); if (driverType != video::EDT_NULL) createWindow(windowSize,bits,fullscreen,vsync,stencilbuffer, antiAlias);
CursorControl = new CCursorControl(windowSize, this); CursorControl = new CCursorControl(windowSize, this);
createDriver(driverType,windowSize,bits,fullscreen,stencilbuffer,vsync,antiAlias); createDriver(driverType,windowSize,bits,fullscreen,stencilbuffer,vsync,antiAlias);
createGUIAndScene(); createGUIAndScene();
...@@ -147,7 +147,7 @@ void CIrrDeviceMacOSX::closeDevice() ...@@ -147,7 +147,7 @@ void CIrrDeviceMacOSX::closeDevice()
_cglcontext = NULL; _cglcontext = NULL;
} }
bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& windowSize, irr::u32 bits, bool fullscreen, bool vsync, bool stencilBuffer) bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& windowSize, irr::u32 bits, bool fullscreen, bool vsync, bool stencilBuffer, bool antiAlias)
{ {
int index; int index;
CGDisplayErr error; CGDisplayErr error;
...@@ -182,6 +182,13 @@ bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& wind ...@@ -182,6 +182,13 @@ bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& wind
windowattribs[index++] = NSOpenGLPFAColorSize; windowattribs[index++] = NSOpenGLPFAColorSize;
windowattribs[index++] = (NSOpenGLPixelFormatAttribute)bits; windowattribs[index++] = (NSOpenGLPixelFormatAttribute)bits;
if (antiAlias) {
windowattribs[index++] = NSOpenGLPFASampleBuffers;
windowattribs[index++] = (NSOpenGLPixelFormatAttribute)1;
windowattribs[index++] = NSOpenGLPFASamples;
windowattribs[index++] = (NSOpenGLPixelFormatAttribute)2;
}
if (stencilBuffer) if (stencilBuffer)
{ {
windowattribs[index++] = NSOpenGLPFAStencilSize; windowattribs[index++] = NSOpenGLPFAStencilSize;
...@@ -239,6 +246,13 @@ bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& wind ...@@ -239,6 +246,13 @@ bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d<irr::s32>& wind
fullattribs[index++] = kCGLPFAColorSize; fullattribs[index++] = kCGLPFAColorSize;
fullattribs[index++] = (CGLPixelFormatAttribute)bits; fullattribs[index++] = (CGLPixelFormatAttribute)bits;
if (antiAlias) {
fullattribs[index++] = kCGLPFASampleBuffers;
fullattribs[index++] = (CGLPixelFormatAttribute)1;
fullattribs[index++] = kCGLPFASamples;
fullattribs[index++] = (CGLPixelFormatAttribute)2;
}
if (stencilBuffer) if (stencilBuffer)
{ {
fullattribs[index++] = kCGLPFAStencilSize; fullattribs[index++] = kCGLPFAStencilSize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment