Skip to content

Commit 64fb2de

Browse files
committed
Fix double GL include warning (OSX)
1 parent 235fb0a commit 64fb2de

File tree

4 files changed

+7
-181
lines changed

4 files changed

+7
-181
lines changed

App/ImGUI/imgui_impl_glfw_gl3.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
#ifdef __APPLE__
1313
#include <OpenCL/OpenCL.h>
14-
#include <OpenGL/gl3.h>
14+
#define GLFW_INCLUDE_GLCOREARB
15+
#define GLFW_NO_GLU
1516
#include "GLFW/glfw3.h"
1617
#elif WIN32
1718
#define NOMINMAX

App/Renderers/PT/ptrenderer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ namespace Baikal
321321
{
322322
if (output)
323323
{
324-
auto current_output = FindFirstNonZeroOutput();
325324
auto required_size = output->width() * output->height();
326325

327326
if (required_size > m_render_data->paths.GetElementCount())

App/Utils/shader_manager.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ THE SOFTWARE.
2424

2525
#ifdef __APPLE__
2626
#include <OpenCL/OpenCL.h>
27-
#include <OpenGL/gl3.h>
27+
#define GLFW_INCLUDE_GLCOREARB
28+
#define GLFW_NO_GLU
29+
#include "GLFW/glfw3.h"
2830
#elif WIN32
2931
#define NOMINMAX
3032
#include <Windows.h>

App/main.cpp

Lines changed: 2 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ THE SOFTWARE.
2323

2424
#ifdef __APPLE__
2525
#include <OpenCL/OpenCL.h>
26-
#define GLFW_INCLUDE_GL3
26+
#define GLFW_INCLUDE_GLCOREARB
2727
#define GLFW_NO_GLU
2828
#include "GLFW/glfw3.h"
2929
#elif WIN32
@@ -207,10 +207,6 @@ void Render(GLFWwindow* window)
207207

208208
glClear(GL_COLOR_BUFFER_BIT); CHECK_GL_ERROR;
209209
glBindVertexArray(g_vao); CHECK_GL_ERROR;
210-
//glEnableClientState(GL_VERTEX_ARRAY);CHECK_GL_ERROR;
211-
212-
213-
214210

215211
GLuint program = g_shader_manager->GetProgram("../App/GLSL/simple");
216212
glUseProgram(program); CHECK_GL_ERROR;
@@ -525,178 +521,6 @@ void OnKey(GLFWwindow* window, int key, int scancode, int action, int mods)
525521
case GLFW_KEY_F3:
526522
g_benchmark = action == GLFW_PRESS ? true : g_benchmark;
527523
break;
528-
case GLFW_KEY_F4:
529-
if (!g_interop)
530-
{
531-
std::ostringstream oss;
532-
oss << "aov_color" << g_num_samples << ".png";
533-
SaveFrameBuffer(oss.str(), &g_outputs[g_primary].fdata[0]);
534-
break;
535-
}
536-
case GLFW_KEY_PAGE_DOWN:
537-
{
538-
if (action == GLFW_RELEASE)
539-
{
540-
++g_num_bounces;
541-
for (int i = 0; i < g_cfgs.size(); ++i)
542-
{
543-
g_cfgs[i].renderer->SetNumBounces(g_num_bounces);
544-
g_cfgs[i].renderer->Clear(float3(0, 0, 0), *g_outputs[i].output);
545-
}
546-
g_samplecount = 0;
547-
break;
548-
}
549-
}
550-
case GLFW_KEY_PAGE_UP:
551-
{
552-
if (action == GLFW_RELEASE)
553-
{
554-
if (g_num_bounces > 1)
555-
{
556-
--g_num_bounces;
557-
for (int i = 0; i < g_cfgs.size(); ++i)
558-
{
559-
g_cfgs[i].renderer->SetNumBounces(g_num_bounces);
560-
g_cfgs[i].renderer->Clear(float3(0, 0, 0), *g_outputs[i].output);
561-
}
562-
g_samplecount = 0;
563-
}
564-
break;
565-
}
566-
}
567-
default:
568-
break;
569-
}
570-
}
571-
572-
573-
void OnLetterKey(unsigned char key, int x, int y)
574-
{
575-
switch (key)
576-
{
577-
case 'w':
578-
{
579-
float focal_length = g_camera->GetFocalLength();
580-
focal_length += 0.001f;
581-
g_camera->SetFocalLength(focal_length);
582-
583-
for (int i = 0; i < g_cfgs.size(); ++i)
584-
{
585-
g_cfgs[i].renderer->Clear(float3(0, 0, 0), *g_outputs[i].output);
586-
}
587-
588-
break;
589-
}
590-
591-
case 's':
592-
{
593-
float focal_length = g_camera->GetFocalLength();
594-
595-
if (focal_length > 0.f)
596-
{
597-
focal_length -= 0.001f;
598-
g_camera->SetFocalLength(focal_length);
599-
600-
for (int i = 0; i < g_cfgs.size(); ++i)
601-
{
602-
g_cfgs[i].renderer->Clear(float3(0, 0, 0), *g_outputs[i].output);
603-
}
604-
}
605-
606-
break;
607-
}
608-
609-
case 'q':
610-
{
611-
612-
float aperture = g_camera->GetAperture();
613-
614-
if (aperture == 0.f)
615-
{
616-
g_camera->SetAperture(0.025f);
617-
}
618-
else
619-
{
620-
g_camera->SetAperture(0.0f);
621-
}
622-
623-
for (int i = 0; i < g_cfgs.size(); ++i)
624-
{
625-
g_cfgs[i].renderer->Clear(float3(0, 0, 0), *g_outputs[i].output);
626-
}
627-
628-
break;
629-
}
630-
631-
case 'd':
632-
{
633-
float aperture = g_camera->GetAperture();
634-
635-
if (aperture > 0.f)
636-
{
637-
aperture -= 0.001f;
638-
g_camera->SetAperture(aperture);
639-
640-
for (int i = 0; i < g_cfgs.size(); ++i)
641-
{
642-
g_cfgs[i].renderer->Clear(float3(0, 0, 0), *g_outputs[i].output);
643-
}
644-
}
645-
646-
break;
647-
}
648-
649-
case 'a':
650-
{
651-
float aperture = g_camera->GetAperture();
652-
653-
if (aperture < 0.2f)
654-
{
655-
aperture += 0.001f;
656-
g_camera->SetAperture(aperture);
657-
658-
for (int i = 0; i < g_cfgs.size(); ++i)
659-
{
660-
g_cfgs[i].renderer->Clear(float3(0, 0, 0), *g_outputs[i].output);
661-
}
662-
}
663-
664-
break;
665-
}
666-
667-
case 'z':
668-
{
669-
float focus_dist = g_camera->GetFocusDistance();
670-
671-
if (focus_dist > 0.f)
672-
{
673-
focus_dist -= 0.1f;
674-
g_camera->SetFocusDistance(focus_dist);
675-
676-
for (int i = 0; i < g_cfgs.size(); ++i)
677-
{
678-
g_cfgs[i].renderer->Clear(float3(0, 0, 0), *g_outputs[i].output);
679-
}
680-
}
681-
682-
break;
683-
}
684-
685-
case 'x':
686-
{
687-
float focus_dist = g_camera->GetFocusDistance();
688-
689-
focus_dist += 0.1f;
690-
g_camera->SetFocusDistance(focus_dist);
691-
692-
for (int i = 0; i < g_cfgs.size(); ++i)
693-
{
694-
g_cfgs[i].renderer->Clear(float3(0, 0, 0), *g_outputs[i].output);
695-
}
696-
697-
break;
698-
}
699-
700524
default:
701525
break;
702526
}
@@ -1135,7 +959,7 @@ int main(int argc, char * argv[])
1135959
{
1136960
std::unique_ptr<Baikal::Iterator> shape_iter(g_scene->CreateShapeIterator());
1137961

1138-
for (shape_iter; shape_iter->IsValid(); shape_iter->Next())
962+
for (; shape_iter->IsValid(); shape_iter->Next())
1139963
{
1140964
auto shape = shape_iter->ItemAs<Baikal::Shape const>();
1141965
auto mesh = dynamic_cast<Baikal::Mesh const*>(shape);

0 commit comments

Comments
 (0)