1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
From 4cd8ea9e5fad7a8dc2300518dc926b81d4efbe59 Mon Sep 17 00:00:00 2001
From: Joseph Lenox <lenox.joseph@gmail.com>
Date: Thu, 17 Nov 2016 12:05:42 -0600
Subject: [PATCH 1/3] hamfisted fix for opengl 0.70 problems, making and using
buffers explicitly for bed grid base
---
lib/Slic3r/GUI/3DScene.pm | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/lib/Slic3r/GUI/3DScene.pm b/lib/Slic3r/GUI/3DScene.pm
index a36d226..715be64 100644
--- a/lib/Slic3r/GUI/3DScene.pm
+++ b/lib/Slic3r/GUI/3DScene.pm
@@ -750,15 +750,26 @@ sub Render {
# draw ground
my $ground_z = GROUND_Z;
if ($self->bed_triangles) {
+ my($VertexObjID,$NormalObjID,$ColorObjID);
+ my $colors = OpenGL::Array->new_list(GL_FLOAT,(0.8,0.6,0.5,0.4));
+ my $norms = OpenGL::Array->new_list(GL_FLOAT,(0,0,1));
+ ($VertexObjID,$NormalObjID,$ColorObjID) =
+ glGenBuffersARB_p(3);
+ $self->bed_triangles->bind($VertexObjID);
+ glBufferDataARB_p(GL_ARRAY_BUFFER_ARB, $self->bed_triangles, GL_STATIC_DRAW_ARB);
+ glVertexPointer_c(3, GL_FLOAT, 0, 0);
+ $norms->bind($NormalObjID);
+ glBufferDataARB_p(GL_ARRAY_BUFFER_ARB, $norms, GL_STATIC_DRAW_ARB);
+ glNormalPointer_c(GL_FLOAT, 0, 0);
+
glDisable(GL_DEPTH_TEST);
-
+
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnableClientState(GL_VERTEX_ARRAY);
- glColor4f(0.8, 0.6, 0.5, 0.4);
- glNormal3d(0,0,1);
- glVertexPointer_p(3, $self->bed_triangles);
+ #glNormal3d(0,0,1);
+ #glVertexPointer_p(3, $self->bed_triangles);
glDrawArrays(GL_TRIANGLES, 0, $self->bed_triangles->elements / 3);
glDisableClientState(GL_VERTEX_ARRAY);
@@ -766,11 +777,17 @@ sub Render {
# the object from below
glEnable(GL_DEPTH_TEST);
+ my($GridVertexObjID,$GridNormalObjID,$GridColorObjID);
+ ($GridVertexObjID,$GridNormalObjID,$GridColorObjID) =
+ glGenBuffersARB_p(3);
+ glBufferDataARB_p(GL_ARRAY_BUFFER_ARB, $self->bed_grid_lines, GL_STATIC_DRAW_ARB);
+ glVertexPointer_c(3, GL_FLOAT, 0, 0);
# draw grid
glLineWidth(3);
glColor4f(0.2, 0.2, 0.2, 0.4);
glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer_p(3, $self->bed_grid_lines);
+
+ #glVertexPointer_p(3, $self->bed_grid_lines);
glDrawArrays(GL_LINES, 0, $self->bed_grid_lines->elements / 3);
glDisableClientState(GL_VERTEX_ARRAY);
--
2.10.2
|