Giter VIP home page Giter VIP logo

texample2's Introduction

Texample2

Rendering Text in OpenGL ES 2 on Android.

An OpenGL ES 2 port of the code by fractious - Rendering Text in OpenGL on Android.

Licensed under CC0 1.0 public domain license, so use it freely, no restrictions at all.

How to use

The provided code includes Texample2 and Texample2Renderer which are a working example of the usage of the code.

For more information, see the original post by fractious. Most of the syntax is unchanged.

See it in action

[TheHunt - Interactive graphical platform for AI experiments] (http://d3kod.github.com/TheHunt---Interactive-graphical-platform-for-AI-Experiments/)

More information

I made a blog post with a bit more information about the implementation steps I took to port the code - Rendering Text in OpenGL 2.0 ES on Android

texample2's People

Contributors

d3alek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

texample2's Issues

(0, 0) position at top, left screen

currently, the (0, 0) position is at the center of the screen, but I want to set it at the top, left of the screen, how can I do it, try to change the matrix:

    for (int i = 0; i < 16; i++) {
        this.mtrxProjection[i] = 0.0f;
        this.mtrxView[i] = 0.0f;
        this.mtrxProjectionAndView[i] = 0.0f;
    }

    Matrix.orthoM(mtrxProjection, 0, 0f, width, height, 0f, 0.1f, 100f);
    Matrix.setLookAtM(mtrxView, 0, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
    Matrix.multiplyMM(mtrxProjectionAndView, 0, mtrxProjection, 0, mtrxView, 0);

and the text can be displayed at 0, 0 but it has 180 angleDegX so I have to use this method:

    draw(string, x, y, 0, 180, 0, 0);

to rotate it again,

so how to set (0, 0) position at top, left of the screen without rotate the text?

Origin in left top flips text

Hi,

I changed content of OnSurfaceChanged function with code which sets origin to left top corner. But after that is text flipped. Please can someone help to fix it?

public void onSurfaceChanged(GL10 unused, int width, int height) { 
	GLES20.glViewport(0, 0, width, height);

	for(int i=0;i<16;i++)
	{
		mtrxProjection[i] = 0.0f;
		mtrxView[i] = 0.0f;
		mtrxProjectionAndView[i] = 0.0f;
	}

	Matrix.orthoM(mtrxProjection, 0, 0, width, height, 0, -1, 1);
	Matrix.setLookAtM(mtrxView, 0,
			0f, 0f, 1f,
			0f, 0f, 0f,
			0f, 1.0f, 0.0f);
	Matrix.multiplyMM(mtrxProjectionAndView, 0,
			mtrxProjection, 0,
			mtrxView, 0);
}

// Our matrices
private final float[] mtrxProjection = new float[16];
private final float[] mtrxView = new float[16];
private final float[] mtrxProjectionAndView = new float[16]; 

Many thanks

Editable Text?

Hello,
How would I display an editable text in a live wallpaper? I am using the Rajawali opengl framework. OpenGL ES 2.0 I want the user to be able to edit the text through the preferences and it show up in front of the model or below it. I want to also use a custom font from my assets. I coded a canvas to bitmap but when I try to call it in my renderer, it doesn't show up. I don't get any errors in my logcat just a black screen on my device. I still don't completely understand canvas to bitmap but I thought I'd ask you since you obviously know how to do it. I would greatly appreciate your help. I've been at this for months and can't seem to get it working. Thank you in advance.

Getting glError 1281 and bindTextureImage errors when drawing text

Hi,

I'm trying to incorporate GLText rendering in my app in combination with ARCore rendering (using BackgroundRenderer, PlaneRenderer, ObjectRenderer, for reference: https://github.com/google-ar/arcore-android-sdk/tree/master/samples/hello_ar_java/app/src/main/java/com/google/ar/core/examples/java/common/rendering)

I've tried several things, like changing the order of rendering, disabling depth test, etc..
Nothing seems to help.

These are the error appearing in the log:

W/GLConsumer: [SurfaceTexture--1-7652-1] bindTextureImage: clearing GL error: 0x501

E/ARCoreVideoRenderer: Exception on the OpenGL thread java.lang.RuntimeException: Draw: glError 1281

Any ideas as to what might cause this?
Could this be some kind of texture conflict?

Fyi, this is on a Samsung S8, Android 8.0.0

Crashes Visual Studio Emulator for Android

I suspect that this project currently crashes the latest version of the VS Android Emulator (v 1.1.622.2). I've tracked it down to the unbind function in Vertices.java:

public void unbind()  {
	GLES20.glDisableVertexAttribArray(mTextureCoordinateHandle);
}

It would appear that glDisableVertexAttribArray also needs to be called on mMVPIndexHandle, and I'm guessing mPositionHandle probably needs it as well. I haven't seen this on any physical hardware and it only broke on the emulator sometime over the past year.

My apologies for not fixing this myself and submitting a pull-request, I'm not actually set up with Android Studio at the moment and have only seen this in a C#/Xamarin port of the code (although I'd be rather surprised if that was somehow causing it).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.