verifying glyphs
glyph.start & glyph.count look good, curves look good, incremental debugging :-)
This commit is contained in:
parent
d8a7bc7a98
commit
412c64298d
3 changed files with 99 additions and 64 deletions
|
@ -123,10 +123,10 @@ void main() {
|
||||||
alpha += computeCoverage(inverseDiameter.y, rotate(p0), rotate(p1), rotate(p2));
|
alpha += computeCoverage(inverseDiameter.y, rotate(p0), rotate(p1), rotate(p2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vec4 debug = texelFetch(curves, int(uv.x * textureSize(curves)));
|
//vec4 debug = texelFetch(glyphs, int(uv.x * textureSize(glyphs)));
|
||||||
result = vec4(debug.rgb, 1.0);
|
//result = vec4(debug.rgb, 1.0);
|
||||||
|
|
||||||
return;
|
//return;
|
||||||
|
|
||||||
if (enableSuperSamplingAntiAliasing) {
|
if (enableSuperSamplingAntiAliasing) {
|
||||||
alpha *= 0.5;
|
alpha *= 0.5;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
// because both files have mostly the same dependencies (OpenGL, GLM, FreeType).
|
// because both files have mostly the same dependencies (OpenGL, GLM, FreeType).
|
||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
|
|
||||||
|
#include <GL/glext.h>
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#ifdef TARGET_OPENGLES
|
#ifdef TARGET_OPENGLES
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
|
@ -336,6 +337,7 @@ class Font {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool done = false;
|
||||||
void uploadBuffers(){
|
void uploadBuffers(){
|
||||||
cout << "bufferGlyphs.size(): " << bufferGlyphs.size() << endl;
|
cout << "bufferGlyphs.size(): " << bufferGlyphs.size() << endl;
|
||||||
cout << "bufferCurves.size(): " << bufferCurves.size() << endl;
|
cout << "bufferCurves.size(): " << bufferCurves.size() << endl;
|
||||||
|
@ -355,7 +357,7 @@ class Font {
|
||||||
//glBindBuffer(GL_TEXTURE_2D, curveBuffer);
|
//glBindBuffer(GL_TEXTURE_2D, curveBuffer);
|
||||||
//glBufferData(GL_TEXTURE_2D, sizeof(BufferCurve) * bufferCurves.size(), bufferCurves.data(), GL_STATIC_DRAW);
|
//glBufferData(GL_TEXTURE_2D, sizeof(BufferCurve) * bufferCurves.size(), bufferCurves.data(), GL_STATIC_DRAW);
|
||||||
//glBindBuffer(GL_TEXTURE_2D, 0);
|
//glBindBuffer(GL_TEXTURE_2D, 0);
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE2);
|
||||||
glBindTexture(GL_TEXTURE_2D, glyphBuffer);
|
glBindTexture(GL_TEXTURE_2D, glyphBuffer);
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||||
|
@ -364,7 +366,6 @@ class Font {
|
||||||
GL_NEAREST);
|
GL_NEAREST);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||||
GL_NEAREST);
|
GL_NEAREST);
|
||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D,
|
glTexImage2D(GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
GL_RG32I,
|
GL_RG32I,
|
||||||
|
@ -374,7 +375,39 @@ class Font {
|
||||||
GL_RG_INTEGER,
|
GL_RG_INTEGER,
|
||||||
GL_INT,
|
GL_INT,
|
||||||
bufferGlyphs.data());
|
bufferGlyphs.data());
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
|
//int size = 2048;
|
||||||
|
//float * data = new float[3 * size * sizeof(float)];
|
||||||
|
//for(unsigned int i = 0; i < size; i++){
|
||||||
|
//data[i * 3] = (float)(0.1f);
|
||||||
|
//data[i * 3 + 1] = (float)(0.5f);
|
||||||
|
//data[i * 3 + 2] = (float)(1.0f);
|
||||||
|
//}
|
||||||
|
//glTexImage2D(GL_TEXTURE_2D,
|
||||||
|
//0,
|
||||||
|
//GL_RGB32F,
|
||||||
|
//size,
|
||||||
|
//1,
|
||||||
|
//0,
|
||||||
|
//GL_RGB,
|
||||||
|
//GL_FLOAT,
|
||||||
|
//data);
|
||||||
|
/////////////////////////////////////////
|
||||||
|
//int size = 2048;
|
||||||
|
//uint32_t * data = new uint32_t[2 * size * sizeof(uint32_t)];
|
||||||
|
//for(unsigned int i = 0; i < size; i++){
|
||||||
|
//data[i * 2] = (uint32_t)(0.1f);
|
||||||
|
//data[i * 2 + 1] = (uint32_t)(255.0f);
|
||||||
|
//}
|
||||||
|
//glTexImage2D(GL_TEXTURE_2D,
|
||||||
|
//0,
|
||||||
|
//GL_RG32I,
|
||||||
|
//size,
|
||||||
|
//1,
|
||||||
|
//0,
|
||||||
|
//GL_RG_INTEGER,
|
||||||
|
//GL_INT,
|
||||||
|
//data);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D, curveBuffer);
|
glBindTexture(GL_TEXTURE_2D, curveBuffer);
|
||||||
|
@ -703,17 +736,17 @@ class Font {
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
#else
|
#else
|
||||||
glyphBuffer = glGetUniformLocation(program, "glyphs");
|
glyphBuffer = glGetUniformLocation(program, "glyphs");
|
||||||
glUniform1i(glyphBuffer, 0);
|
glUniform1i(glyphBuffer, 2);
|
||||||
curveBuffer = glGetUniformLocation(program, "curves");
|
curveBuffer = glGetUniformLocation(program, "curves");
|
||||||
glUniform1i(curveBuffer, 1);
|
glUniform1i(curveBuffer, 1);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
//glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_BUFFER, glyphBuffer);
|
//glBindTexture(GL_TEXTURE_2D, glyphBuffer);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
//glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_BUFFER, curveBuffer);
|
//glBindTexture(GL_TEXTURE_BUFFER, curveBuffer);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
//glActiveTexture(GL_TEXTURE0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,9 +124,10 @@ start. I hope to capture something essential.)DONE";
|
||||||
void ofApp::update(){
|
void ofApp::update(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
bool hasDrawnOnce = false;
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
void ofApp::draw(){
|
void ofApp::draw(){
|
||||||
|
if(!hasDrawnOnce){
|
||||||
GLuint location;
|
GLuint location;
|
||||||
|
|
||||||
int width = ofGetWidth();
|
int width = ofGetWidth();
|
||||||
|
@ -193,6 +194,7 @@ void ofApp::draw(){
|
||||||
|
|
||||||
ofDrawBitmapStringHighlight("fps: " + ofToString(ofGetFrameRate()), 20, 20);
|
ofDrawBitmapStringHighlight("fps: " + ofToString(ofGetFrameRate()), 20, 20);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
void ofApp::keyPressed(int key){
|
void ofApp::keyPressed(int key){
|
||||||
|
|
Loading…
Reference in a new issue