aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-10-03 18:55:29 +0800
committerchai <chaifix@163.com>2018-10-03 18:55:29 +0800
commitc6f9d4182aaa868a72acac59cf8837f5924ed11e (patch)
treedf83c8456209e7207b7d27ca288887687a72fee0
parent1bfd342a90460e7360f96ea4ba7c4e02645c9b42 (diff)
*update
-rw-r--r--libjin/Filesystem/Buffer.h9
-rw-r--r--libjin/Graphics/Canvas.cpp33
-rw-r--r--libjin/Graphics/Canvas.h1
-rw-r--r--libjin/Graphics/Drawable.cpp24
-rw-r--r--libjin/Graphics/Font.cpp2
-rw-r--r--libjin/Graphics/OpenGL.cpp11
-rw-r--r--libjin/Graphics/OpenGL.h13
-rw-r--r--libjin/Graphics/Shader.cpp99
-rw-r--r--libjin/Graphics/Shader.h9
-rw-r--r--libjin/Graphics/Shaders/base.shader.h102
-rw-r--r--libjin/Graphics/Shaders/default.shader.h20
-rw-r--r--libjin/Graphics/Shaders/font.shader.h22
-rw-r--r--libjin/Math/Matrix.cpp11
-rw-r--r--libjin/Math/Matrix.h4
-rw-r--r--test/05Font/main.cpp92
15 files changed, 320 insertions, 132 deletions
diff --git a/libjin/Filesystem/Buffer.h b/libjin/Filesystem/Buffer.h
index 15ea665..5598f66 100644
--- a/libjin/Filesystem/Buffer.h
+++ b/libjin/Filesystem/Buffer.h
@@ -2,6 +2,7 @@
#define __LIBJIN_BUFFER_H
#include <string.h>
+#include <stdlib.h>
namespace jin
{
@@ -47,6 +48,14 @@ namespace filesystem
memcpy(data, buffer.data, size);
}
+ void clear()
+ {
+ if (data == nullptr)
+ return;
+ free(data);
+ data = nullptr;
+ }
+
void* data;
unsigned int size;
diff --git a/libjin/Graphics/Canvas.cpp b/libjin/Graphics/Canvas.cpp
index 514f73a..827a5d2 100644
--- a/libjin/Graphics/Canvas.cpp
+++ b/libjin/Graphics/Canvas.cpp
@@ -71,18 +71,8 @@ namespace graphics
/* set view port to canvas */
glViewport(0, 0, w, h);
- /* set projection matrix */
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, w, 0, h, -1, 1);
-
- /* set (model*view) matrix */
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
-
- /* ready to draw */
+ projectionMatrix.setOrtho(0, w, 0, h, -1, 1);
+
}
/**
@@ -102,24 +92,11 @@ namespace graphics
glBindFramebuffer(GL_FRAMEBUFFER, DEFAULT_CANVAS->fbo);
- /* radio of screen and canvas sound be the same */
-
/* set viewport on screen */
glViewport(0, 0, ww, wh);
-
- /* set projection matrix */
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- /* flip bottom and top */
- gl.orthox(ww, wh);
-
- /* set (model*view) matrix */
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
-
- /* ready to draw */
+
+ projectionMatrix.setOrtho(0, ww, wh, 0, -1, 1);
+
}
} // render
diff --git a/libjin/Graphics/Canvas.h b/libjin/Graphics/Canvas.h
index 041005a..09ae7aa 100644
--- a/libjin/Graphics/Canvas.h
+++ b/libjin/Graphics/Canvas.h
@@ -29,6 +29,7 @@ namespace graphics
GLuint fbo;
+
};
} // render
diff --git a/libjin/Graphics/Drawable.cpp b/libjin/Graphics/Drawable.cpp
index a6910ab..22ca935 100644
--- a/libjin/Graphics/Drawable.cpp
+++ b/libjin/Graphics/Drawable.cpp
@@ -1,6 +1,7 @@
#include "../jin_configuration.h"
#if LIBJIN_MODULES_RENDER
+#include "Shader.h"
#include "drawable.h"
#include "../math/matrix.h"
#include <stdlib.h>
@@ -39,26 +40,13 @@ namespace graphics
void Drawable::draw(int x, int y, float sx, float sy, float r)
{
- static jin::math::Matrix t;
- t.setTransformation(x, y, r, sx, sy, anchor.x, anchor.y);
-
+ JSLProgram* jsl = JSLProgram::getCurrentJSL();
+ modelMatrix.setTransformation(x, y, r, sx, sy, anchor.x, anchor.y);
+ jsl->sendMatrix4("_modelMatrix_", &modelMatrix);
+ jsl->bindVertexAttribPointer("_vert_coord_", 2, GL_FLOAT, GL_FALSE, 0, vertex_coords);
+ jsl->bindVertexAttribPointer("_tex_coord_", 2, GL_FLOAT, GL_FALSE, 0, texture_coords);
gl.bindTexture(texture);
-
- /* push modle matrix */
- glPushMatrix();
- glMultMatrixf((const GLfloat*)t.getElements());
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- gl.vertexPointer(2, GL_FLOAT, 0, vertex_coords);
- gl.texCoordPointer(2, GL_FLOAT, 0, texture_coords);
gl.drawArrays(GL_QUADS, 0, 4);
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- /* pop the model matrix */
- glPopMatrix();
-
- /* bind texture to default screen */
gl.bindTexture(0);
}
diff --git a/libjin/Graphics/Font.cpp b/libjin/Graphics/Font.cpp
index 19257db..d702dcf 100644
--- a/libjin/Graphics/Font.cpp
+++ b/libjin/Graphics/Font.cpp
@@ -188,6 +188,8 @@ namespace graphics
void Font::render(const Page* page)
{
+ JSLProgram* jsl = JSLProgram::getCurrentJSL();
+
const vector<GlyphArrayDrawInfo>& glyphinfolist = page->glyphinfolist;
const vector<GlyphVertex>& glyphvertices = page->glyphvertices;
gl.enableClientState(GL_VERTEX_ARRAY);
diff --git a/libjin/Graphics/OpenGL.cpp b/libjin/Graphics/OpenGL.cpp
index ff9d307..30a8a1f 100644
--- a/libjin/Graphics/OpenGL.cpp
+++ b/libjin/Graphics/OpenGL.cpp
@@ -1,2 +1,13 @@
#define OGL2D_IMPLEMENT
#include "OpenGL.h"
+
+namespace jin
+{
+namespace graphics
+{
+
+ math::Matrix projectionMatrix;
+ math::Matrix modelMatrix;
+
+}
+}
diff --git a/libjin/Graphics/OpenGL.h b/libjin/Graphics/OpenGL.h
index 97db164..45e7499 100644
--- a/libjin/Graphics/OpenGL.h
+++ b/libjin/Graphics/OpenGL.h
@@ -1,7 +1,20 @@
#include "../3rdparty/GLee/GLee.h"
#include "../3rdparty/ogl/OpenGL.h"
+#include "../Math/Matrix.h"
using namespace ogl2d;
+namespace jin
+{
+namespace graphics
+{
+
+ extern math::Matrix projectionMatrix;
+ extern math::Matrix modelMatrix;
+
+}
+}
+
+
/* GL.h
WINGDIAPI void APIENTRY glAccum(GLenum op, GLfloat value);
diff --git a/libjin/Graphics/Shader.cpp b/libjin/Graphics/Shader.cpp
index f514169..13207b6 100644
--- a/libjin/Graphics/Shader.cpp
+++ b/libjin/Graphics/Shader.cpp
@@ -1,6 +1,9 @@
+#include <regex>
#include "../jin_configuration.h"
#if LIBJIN_MODULES_RENDER
+#include <iostream>
+
#include "../utils/macros.h"
#include "Shader.h"
#include "../Filesystem/Buffer.h"
@@ -10,6 +13,7 @@ namespace graphics
{
using namespace jin::filesystem;
+ using namespace std;
/**
* default_texture
@@ -46,7 +50,7 @@ namespace graphics
/*static*/ JSLProgram* JSLProgram::currentJSLProgram = nullptr;
- JSLProgram* JSLProgram::createJSLProgram(const char* program)
+ JSLProgram* JSLProgram::createJSLProgram(const string& program)
{
JSLProgram* jsl = nullptr;
try
@@ -60,23 +64,10 @@ namespace graphics
return jsl;
}
- JSLProgram::JSLProgram(const char* program)
+ JSLProgram::JSLProgram(const string& program)
: currentTextureUnit(DEFAULT_TEXTURE_UNIT)
{
- Buffer b = Buffer(strlen(program) + SHADER_FORMAT_SIZE);
- formatShader((char*)b.data, program);
- GLuint shader = glCreateShader(GL_FRAGMENT_SHADER);
- glShaderSource(shader, 1, (const GLchar**)&b.data, NULL);
- glCompileShader(shader);
- GLint success;
- glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
- if (success == GL_FALSE)
- throw 0;
- pid = glCreateProgram();
- glAttachShader(pid, shader);
- glLinkProgram(pid);
- glGetProgramiv(pid, GL_LINK_STATUS, &success);
- if (success == GL_FALSE)
+ if (!compile(program))
throw 0;
}
@@ -86,6 +77,57 @@ namespace graphics
unuse();
}
+ bool JSLProgram::compile(const string& program)
+ {
+ int loc_VERTEX_SHADER = program.find("#VERTEX_SHADER");
+ int loc_END_VERTEX_SHADER = program.find("#END_VERTEX_SHADER");
+ int loc_FRAGMENT_SHADER = program.find("#FRAGMENT_SHADER");
+ int loc_END_FRAGMENT_SHADER = program.find("#END_FRAGMENT_SHADER");
+ if (loc_VERTEX_SHADER == string::npos
+ || loc_END_VERTEX_SHADER == string::npos
+ || loc_FRAGMENT_SHADER == string::npos
+ || loc_END_FRAGMENT_SHADER == string::npos
+ )
+ return false;
+ int p = loc_VERTEX_SHADER + strlen("#VERTEX_SHADER");
+ string vertex_shader = program.substr(p, loc_END_VERTEX_SHADER - p);
+ Buffer vbuffer = Buffer(vertex_shader.length() + BASE_VERTEX_SHADER_SIZE);
+ formatVertexShader((char*)vbuffer.data, vertex_shader.c_str());
+ p = loc_FRAGMENT_SHADER + strlen("#FRAGMENT_SHADER");
+ string fragment_shader = program.substr(p, loc_END_FRAGMENT_SHADER - p);
+ Buffer fbuffer = Buffer(fragment_shader.length() + BASE_FRAGMENT_SHADER_SIZE);
+ formatFragmentShader((char*)fbuffer.data, fragment_shader.c_str());
+ /* compile */
+ GLint success;
+ GLuint vshader = glCreateShader(GL_VERTEX_SHADER);
+ glShaderSource(vshader, 1, (const GLchar**)&vbuffer.data, NULL);
+ glCompileShader(vshader);
+ glGetShaderiv(vshader, GL_COMPILE_STATUS, &success);
+ std::cout << (char*)vbuffer.data << std::endl;
+ Buffer log = Buffer(1024);
+ int len;
+ glGetShaderInfoLog(vshader, sizeof(log), &len, (GLchar*)log.data);
+ std::cout << (char*)log.data << std::endl;
+ if (success == GL_FALSE)
+ return false;
+ GLuint fshader = glCreateShader(GL_FRAGMENT_SHADER);
+ glShaderSource(fshader, 1, (const GLchar**)&fbuffer.data, NULL);
+ glCompileShader(fshader);
+ glGetShaderiv(fshader, GL_COMPILE_STATUS, &success);
+ std::cout << (char*)fbuffer.data << std::endl;
+ if (success == GL_FALSE)
+ return false;
+ pid = glCreateProgram();
+ glAttachShader(pid, vshader);
+ glAttachShader(pid, fshader);
+ glLinkProgram(pid);
+ glGetProgramiv(pid, GL_LINK_STATUS, &success);
+ glGetProgramInfoLog(pid, 1024, &len, (GLchar*)log.data);
+ std::cout << (char*)log.data << std::endl;
+ if (success == GL_FALSE)
+ throw false;
+ }
+
static inline GLint getMaxTextureUnits()
{
GLint maxTextureUnits = 0;
@@ -97,9 +139,8 @@ namespace graphics
{
glUseProgram(pid);
currentJSLProgram = this;
- /* bind default texture */
- int loc = glGetUniformLocation(pid, default_texture);
- glUniform1i(loc, DEFAULT_TEXTURE_UNIT);
+ sendInt("_tex0_", DEFAULT_TEXTURE_UNIT);
+ sendMatrix4("_projectionMatrix_", &projectionMatrix);
}
/*static*/ void JSLProgram::unuse()
@@ -124,6 +165,13 @@ namespace graphics
if (currentJSLProgram != this) \
return
+ void JSLProgram::sendInt(const char* name, int value)
+ {
+ checkJSL();
+ int loc = glGetUniformLocation(pid, name);
+ glUniform1i(loc, value);
+ }
+
void JSLProgram::sendFloat(const char* variable, float number)
{
checkJSL();
@@ -215,6 +263,19 @@ namespace graphics
);
}
+ void JSLProgram::sendMatrix4(const char* name, const math::Matrix* mat4)
+ {
+ int loc = glGetUniformLocation(pid, name);
+ glUniformMatrix4fv(loc, 1, GL_FALSE, mat4->getElements());
+ }
+
+ void JSLProgram::bindVertexAttribPointer(const char* name, int n, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer)
+ {
+ GLint loc = glGetAttribLocation(pid, name);
+ glEnableVertexAttribArray(1);
+ glVertexAttribPointer(loc, n, type, normalized, stride, pointer);
+ }
+
} // graphics
} // jin
diff --git a/libjin/Graphics/Shader.h b/libjin/Graphics/Shader.h
index bfc787f..963607d 100644
--- a/libjin/Graphics/Shader.h
+++ b/libjin/Graphics/Shader.h
@@ -19,7 +19,7 @@ namespace graphics
class JSLProgram
{
public:
- static JSLProgram* createJSLProgram(const char* program);
+ static JSLProgram* createJSLProgram(const std::string& program);
static inline JSLProgram* getCurrentJSL() { return currentJSLProgram; }
static void unuse();
@@ -28,17 +28,22 @@ namespace graphics
void use();
void sendFloat(const char* name, float number);
void sendTexture(const char* name, const Texture* image);
+ void sendInt(const char* name, int value);
void sendVec2(const char* name, float x, float y);
void sendVec3(const char* name, float x, float y, float z);
void sendVec4(const char* name, float x, float y, float z, float w);
void sendCanvas(const char* name, const Canvas* canvas);
void sendColor(const char* name, const Color* col);
+ void sendMatrix4(const char* name, const math::Matrix* mat4);
+
+ void bindVertexAttribPointer(const char* name, int n, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer);
protected:
static JSLProgram* currentJSLProgram;
GLint claimTextureUnit(const std::string& name);
- JSLProgram(const char* program);
+ JSLProgram(const std::string& program);
+ bool compile(const std::string& program);
GLuint pid;
GLint currentTextureUnit;
diff --git a/libjin/Graphics/Shaders/base.shader.h b/libjin/Graphics/Shaders/base.shader.h
index 6136267..0fc7dd6 100644
--- a/libjin/Graphics/Shaders/base.shader.h
+++ b/libjin/Graphics/Shaders/base.shader.h
@@ -4,40 +4,102 @@
* unit zero. The glActiveTexture call is only needed if you are going to use multiple
* texture units (because GL_TEXTURE0 is the default anyway).
*/
+/*
+#VERTEX_SHADER
-static const char* default_texture = "_tex0_";
-
-static const char* base_vertex = R"(
-#version 330 core
-void main()
+vertex vert(vertex v)
{
+ return v;
+}
+
+#END_VERTEX_SHADER
+#FRAGMENT_SHADER
+
+vec4 frag(vec4 color, Texture tex, vertex v)
+{
+ return Texel(tex, v.uv);
}
-)";
-static const char* base_fragment = R"(
-#version 130 core
+#END_FRAGMENT_SHADER
+
+*/
+
+static const char* base_shared = R"(
#define number float
#define Texture sampler2D
#define Canvas sampler2D
#define Color vec4
#define Texel texture2D
-#define extern uniform
-#define Vec2 vec2
-#define Vec3 vec3
-#define Vec4 vec4
-#define Number number
-#define Image Texture
-out vec4 color;
-extern Texture %s;
+
+struct vertex
+{
+ vec2 xy;
+ vec2 uv;
+};
+
+)";
+
+static const int BASE_MACRO_SIZE = strlen(base_shared);
+
+static const char* base_vertex = R"(
+#version 130 core
+
%s
+
+uniform mat4 _projectionMatrix_;
+uniform mat4 _modelMatrix_;
+
+in vec2 _vert_coord_;
+in vec2 _tex_coord_;
+
+out vec2 _xy;
+out vec2 _uv;
+
+%s
+
+void main()
+{
+ _xy = (_projectionMatrix_ * _modelMatrix_ * vec4(_vert_coord_, 0, 0)).xy;
+ _uv = _tex_coord_;
+ vertex _v;
+ _v.xy = _xy;
+ _v.uv = _uv;
+ _v = vert(_v);
+ _xy = _v.xy;
+ _uv = _v.uv;
+ gl_Position = vec4(_xy, 0, 0);
+}
+)";
+
+static const int BASE_VERTEX_SHADER_SIZE = strlen(base_vertex) + BASE_MACRO_SIZE;
+
+#define formatVertexShader(buf, program) sprintf(buf,base_vertex, base_shared, program)
+
+static const char* base_fragment = R"(
+#version 130 core
+
+%s
+
+uniform Texture _tex0_;
+
+in vec2 _xy;
+in vec2 _uv;
+
+out vec4 _outColor_;
+
+%s
+
void main()
{
- color = effect(gl_Color, %s, gl_TexCoord[0].xy, gl_FragCoord.xy);
+ vertex v;
+ v.xy = _xy;
+ v.uv = _uv;
+ _outColor_ = frag(gl_Color, _tex0_, v);
+ _outColor_ = vec4( 1, 1, 1, 1);
}
)";
-static const int SHADER_FORMAT_SIZE = strlen(base_fragment) + strlen(default_texture) * 2;
+static const int BASE_FRAGMENT_SHADER_SIZE = strlen(base_fragment) + BASE_MACRO_SIZE;
-#define formatShader(buf, program)\
- sprintf(buf, base_fragment, default_texture, program, default_texture)
+#define formatFragmentShader(buf, program) sprintf(buf, base_fragment, base_shared, program)
diff --git a/libjin/Graphics/Shaders/default.shader.h b/libjin/Graphics/Shaders/default.shader.h
index 1fd4542..40c72e0 100644
--- a/libjin/Graphics/Shaders/default.shader.h
+++ b/libjin/Graphics/Shaders/default.shader.h
@@ -1,7 +1,21 @@
// Ĭshader
static const char* default_shader = R"(
-Color effect(Color col, Texture tex, vec2 uv, vec2 xy)
+
+#VERTEX_SHADER
+
+vertex vert(vertex v)
{
- return Texel(tex, uv);
-}
+ return v;
+}
+
+#END_VERTEX_SHADER
+
+#FRAGMENT_SHADER
+
+Color frag(Color col, Texture tex, vertex v)
+{
+ return Texel(tex, v.uv);
+}
+
+#END_FRAGMENT_SHADER
)"; \ No newline at end of file
diff --git a/libjin/Graphics/Shaders/font.shader.h b/libjin/Graphics/Shaders/font.shader.h
index c2555a6..7904077 100644
--- a/libjin/Graphics/Shaders/font.shader.h
+++ b/libjin/Graphics/Shaders/font.shader.h
@@ -1,9 +1,21 @@
// shader
static const char* font_shader = R"(
-Color effect(Color col, Texture tex, vec2 uv, vec2 xy)
+
+#VERTEX_SHADER
+
+vertex vert(vertex v)
{
-// r͸
- Color c = Texel(tex, uv);
- return Vec4(col.rgb, c.a);
-}
+ return v;
+}
+
+#END_VERTEX_SHADER
+
+#FRAGMENT_SHADER
+
+Color frag(Color col, Texture tex, vertex v)
+{
+ return Texel(tex, v.uv);
+}
+
+#END_FRAGMENT_SHADER
)"; \ No newline at end of file
diff --git a/libjin/Math/Matrix.cpp b/libjin/Math/Matrix.cpp
index 39042f0..beed1c8 100644
--- a/libjin/Math/Matrix.cpp
+++ b/libjin/Math/Matrix.cpp
@@ -22,6 +22,17 @@ namespace math
{
}
+ void Matrix::setOrtho(float l, float r, float b, float t, float n, float f)
+ {
+ setIdentity();
+ e[0] = 2 / (r - l);
+ e[5] = 2 / (t - b);
+ e[10] = -2 / (f - n);
+ e[3] = -(r + l) / (r - l);
+ e[7] = -(t + b) / (t - b);
+ e[11] = -(f + n) / (f - n);
+ }
+
// | e0 e4 e8 e12 |
// | e1 e5 e9 e13 |
// | e2 e6 e10 e14 |
diff --git a/libjin/Math/Matrix.h b/libjin/Math/Matrix.h
index b9a55d4..f02e317 100644
--- a/libjin/Math/Matrix.h
+++ b/libjin/Math/Matrix.h
@@ -16,6 +16,8 @@ namespace math
* This class is the basis for all transformations in LOVE. Althought not
* really needed for 2D, it contains 4x4 elements to be compatible with
* OpenGL without conversions.
+ * Ҫתõľ
+ * https://blog.csdn.net/candycat1992/article/details/8830894
**/
class Matrix
{
@@ -41,6 +43,8 @@ namespace math
**/
~Matrix();
+ void setOrtho(float _left, float _right, float _bottom, float _top, float _near, float _far);
+
/**
* Multiplies this Matrix with another Matrix, changing neither.
* @param m The Matrix to multiply with this Matrix.
diff --git a/test/05Font/main.cpp b/test/05Font/main.cpp
index ec82b6a..cdda3f0 100644
--- a/test/05Font/main.cpp
+++ b/test/05Font/main.cpp
@@ -11,16 +11,30 @@ Canvas* canvas;
FontData* data = nullptr;
JSLProgram* shader = nullptr;
Page* page = nullptr;
+Texture* tex = nullptr;
float dt;
void onLoad()
{
const char* program = R"(
-uniform float dt;
-Color effect(Color col, Texture tex, vec2 uv, vec2 screen)
+#VERTEX_SHADER
+
+vertex vert(vertex v)
{
- return Texel(tex, uv);
+ return v;
}
+
+#END_VERTEX_SHADER
+
+#FRAGMENT_SHADER
+
+Color frag(Color col, Texture tex, vertex v)
+{
+ //return Texel(tex, v.uv);
+ return vec4(1, 1, 1, 1);
+}
+
+#END_FRAGMENT_SHADER
)";
shader = JSLProgram::createJSLProgram(program);
Filesystem* fs = Filesystem::get();
@@ -31,6 +45,10 @@ Color effect(Color col, Texture tex, vec2 uv, vec2 screen)
font = Font::createFont(data, 15);
//canvas = Canvas::createCanvas(100, 100);
//page = font->typeset("こんにちは世界!", 120, 20);
+ buffer.clear();
+ fs->read("img.png", &buffer);
+ Bitmap* bitmap = Bitmap::createBitmap(buffer.data, buffer.size);
+ tex = Texture::createTexture(bitmap);
}
void onEvent(jin::input::Event* e)
@@ -47,42 +65,42 @@ void onUpdate(int ms)
void onDraw()
{
- gl.pushColor(32, 32, 32, 255);
- glColor4f(32 / 255.f, 32 / 255.f, 32 / 255.f, 1);
- rect(FILL, 0, 0, 500, 500);
- glColor4f(1, 1, 1, 1);
+ //gl.pushColor(32, 32, 32, 255);
+ //rect(FILL, 0, 0, 500, 500);
+ gl.pushColor(255, 255, 255, 255);
shader->use();
- shader->sendFloat("dt", dt);
+ tex->draw(0, 0, 1, 1, 0);
+ //shader->sendFloat("dt", dt);
//Canvas::bind(canvas);
- if (font != nullptr)
- {
- glColor4f(1, 1, 1, 1);
- //font->print(u8"Hello,你好\n啊 world!", 10, 10);
- //font->print(u8"Привет мир!", 10, 10 + 15 * 1);
- font->print(u8R"(
-One of the most enjoyable arcade game.
-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
-平安時代中期の物語。紫式部著。ただし,そのすべてが紫式部の筆に成るのでは
-ないとする説もある。 54帖。寛弘 (1004~12) 頃成立か。物語は3部に分けてみ
-ることができる。第1部は,容貌,才能などすべてにすぐれた主人公光源氏が,多
-啊哈噶科膜卡して広く迎えられている。貴族社会の苦悩を摘出したところに磁瓷得
-ることができる。第1部は,容貌,才能などすべてにすぐれた主人公光源氏が,多
-くの女性と関係をもちながら,運命に導かれて栄華をきわめる姿を描く。これに対
-して第2部は苦悩の世界であって,光源氏は最愛の紫の上を失い,栄華は内側から崩
-壊する。第3部 (宇治十帖) は光源氏没後の物語で,不義によって生れた薫大将を主
-人公として,不安に満ちた暗い世界が展開される。さまざまな恋愛と運命的な人生の
-うちに,貴族社会の苦悩を摘出したところに価値があり,現代では,世界的な文学と
-して広く迎えられている。abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
-漫画自1999年开始在日本集英社旗下的少年漫画杂志《周刊少年Jump》上连载。2002年
-,由日本动画工作室Studio Pierrot根据漫画原作所改编制作的电视动画版《火影忍者
-》开始在日本东京电视台播出。2004年,漫画进而改编成电影。2006年,漩涡鸣人入选
-美国《新闻周刊》日文版于10月18日发行的特集中选出的“全世界最受尊敬的100位日本
-人”。[2]
-)", 12, 10 + 15 * 2, 18);
- //font->print(u8"你好世界!", 10, 10 + 15*3);
- //font->render(page);
- glColor4f(1, 1, 1, 1);
- }
+// if (font != nullptr)
+// {
+// glColor4f(1, 1, 1, 1);
+// //font->print(u8"Hello,你好\n啊 world!", 10, 10);
+// //font->print(u8"Привет мир!", 10, 10 + 15 * 1);
+// font->print(u8R"(
+//One of the most enjoyable arcade game.
+//abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
+//平安時代中期の物語。紫式部著。ただし,そのすべてが紫式部の筆に成るのでは
+//ないとする説もある。 54帖。寛弘 (1004~12) 頃成立か。物語は3部に分けてみ
+//ることができる。第1部は,容貌,才能などすべてにすぐれた主人公光源氏が,多
+//啊哈噶科膜卡して広く迎えられている。貴族社会の苦悩を摘出したところに磁瓷得
+//ることができる。第1部は,容貌,才能などすべてにすぐれた主人公光源氏が,多
+//くの女性と関係をもちながら,運命に導かれて栄華をきわめる姿を描く。これに対
+//して第2部は苦悩の世界であって,光源氏は最愛の紫の上を失い,栄華は内側から崩
+//壊する。第3部 (宇治十帖) は光源氏没後の物語で,不義によって生れた薫大将を主
+//人公として,不安に満ちた暗い世界が展開される。さまざまな恋愛と運命的な人生の
+//うちに,貴族社会の苦悩を摘出したところに価値があり,現代では,世界的な文学と
+//して広く迎えられている。abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
+//漫画自1999年开始在日本集英社旗下的少年漫画杂志《周刊少年Jump》上连载。2002年
+//,由日本动画工作室Studio Pierrot根据漫画原作所改编制作的电视动画版《火影忍者
+//》开始在日本东京电视台播出。2004年,漫画进而改编成电影。2006年,漩涡鸣人入选
+//美国《新闻周刊》日文版于10月18日发行的特集中选出的“全世界最受尊敬的100位日本
+//人”。[2]
+//)", 12, 10 + 15 * 2, 18);
+// //font->print(u8"你好世界!", 10, 10 + 15*3);
+// //font->render(page);
+// glColor4f(1, 1, 1, 1);
+// }
shader->unuse();
//Canvas::unbind();
//canvas->draw(0, 0, 2, 2, 0);