Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
OpenGL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
C-Fu
OpenGL
Commits
9c12598b
Commit
9c12598b
authored
Nov 03, 2016
by
Anakin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trying to give MVP via buffer,
nothing displayed -.-
parent
3af88645
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
38 deletions
+19
-38
MshViewer/Shader/FragmentColorShader.mv2shdr
MshViewer/Shader/FragmentColorShader.mv2shdr
+0
-12
MshViewer/Shader/TextureShader.frag
MshViewer/Shader/TextureShader.frag
+0
-0
MshViewer/Shader/TextureShader.vert
MshViewer/Shader/TextureShader.vert
+6
-3
MshViewer/Shader/VertexColorShader.mv2shdr
MshViewer/Shader/VertexColorShader.mv2shdr
+0
-20
MshViewer/Source/OpenGlController.cpp
MshViewer/Source/OpenGlController.cpp
+13
-3
No files found.
MshViewer/Shader/FragmentColorShader.mv2shdr
deleted
100644 → 0
View file @
3af88645
#version 450 core
// Input
in vec3 fragmentColor;
// Ouput data
out vec3 color;
void main()
{
color = fragmentColor;
}
\ No newline at end of file
MshViewer/Shader/
FragmentTextureShader.mv2shdr
→
MshViewer/Shader/
TextureShader.frag
View file @
9c12598b
File moved
MshViewer/Shader/
VertexTextureShader.mv2shdr
→
MshViewer/Shader/
TextureShader.vert
View file @
9c12598b
...
...
@@ -3,18 +3,21 @@
// Input vertex data, different for all executions of this shader.
layout
(
location
=
0
)
in
vec3
vertexPosition_modelspace
;
layout
(
location
=
1
)
in
vec2
vertexUV
;
//layout(location = 2) in mat4 mvp;
layout
(
location
=
2
)
in
mat4
mvp
;
//layout(location = 3) in mat4 mvp;
//layout(location = 4) in mat4 mvp;
//layout(location = 5) in mat4 mvp;
// Output
out
vec2
UV
;
// Values that stay constant for the whole mesh.
uniform mat4 MVP;
//
uniform mat4 MVP;
void
main
(){
// Output position of the vertex, in clip space : MVP * position
gl_Position =
MVP
* vec4(vertexPosition_modelspace, 1);
gl_Position
=
mvp
*
vec4
(
vertexPosition_modelspace
,
1
);
UV
=
vertexUV
;
...
...
MshViewer/Shader/VertexColorShader.mv2shdr
deleted
100644 → 0
View file @
3af88645
#version 450 core
// Input vertex data, different for all executions of this shader.
layout(location = 0) in vec3 vertexPosition_modelspace;
layout(location = 1) in vec3 vertexColor;
// Output
out vec3 fragmentColor;
// Values that stay constant for the whole mesh.
uniform mat4 MVP;
void main(){
// Output position of the vertex, in clip space : MVP * position
gl_Position = MVP * vec4(vertexPosition_modelspace,1);
fragmentColor = vertexColor;
}
MshViewer/Source/OpenGlController.cpp
View file @
9c12598b
...
...
@@ -9,8 +9,8 @@
#include "Texture.h"
#include <iostream>
#define VERTEX_SHADER "Shader/
VertexTextureShader.mv2shdr
"
#define FRAGMENT_SHADER "Shader/
FragmentTextureShader.mv2shdr
"
#define VERTEX_SHADER "Shader/
TextureShader.vert
"
#define FRAGMENT_SHADER "Shader/
TextureShader.frag
"
/////////////////////////////////////////////////////////////////////////
...
...
@@ -91,6 +91,13 @@ void OpenGLController::processInit()
glVertexAttribPointer
(
VERTEX_INDEX_UV
,
VERTEX_COMPONENTS_UV
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
Vertex
),
(
void
*
)
VERTEX_OFFSET_UV
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
0
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
gluiInstanceBufferID
);
glVertexAttribPointer
(
2
,
4
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
glm
::
mat4
),
(
void
*
)(
sizeof
(
GL_FLOAT
)
*
0
));
glVertexAttribPointer
(
3
,
4
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
glm
::
mat4
),
(
void
*
)(
sizeof
(
GL_FLOAT
)
*
4
));
glVertexAttribPointer
(
4
,
4
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
glm
::
mat4
),
(
void
*
)(
sizeof
(
GL_FLOAT
)
*
8
));
glVertexAttribPointer
(
5
,
4
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
glm
::
mat4
),
(
void
*
)(
sizeof
(
GL_FLOAT
)
*
12
));
glBindBuffer
(
GL_ARRAY_BUFFER
,
0
);
glEnableVertexAttribArray
(
0
);
glEnableVertexAttribArray
(
1
);
...
...
@@ -245,7 +252,10 @@ void OpenGLController::updateScene()
glUseProgram
(
gluiShaderPrgmID
);
// tell shader transformation
glUniformMatrix4fv
(
gluiMatrixID
,
1
,
GL_FALSE
,
&
getMVPMatrix
()[
0
][
0
]);
//glUniformMatrix4fv(gluiMatrixID, 1, GL_FALSE, &getMVPMatrix()[0][0]);
glBindBuffer
(
GL_UNIFORM_BUFFER
,
gluiInstanceBufferID
);
glBufferData
(
GL_UNIFORM_BUFFER
,
sizeof
(
glm
::
mat4
)
*
1
,
NULL
,
GL_STREAM_DRAW
);
glBindBuffer
(
GL_UNIFORM_BUFFER
,
0
);
// bind texture in texture unit 0
glActiveTexture
(
GL_TEXTURE0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment