[DEV] add draw triangles
This commit is contained in:
parent
e9541980c0
commit
920ac8cb20
@ -22,7 +22,7 @@ import org.atriasoft.gale.key.KeyType;
|
||||
import org.atriasoft.gale.resource.ResourceManager;
|
||||
|
||||
interface ActionToDoInAsyncLoop {
|
||||
public void run(GaleContext context);
|
||||
void run(GaleContext context);
|
||||
}
|
||||
|
||||
enum ApplicationState {
|
||||
@ -658,7 +658,7 @@ public abstract class GaleContext {
|
||||
// // internal clean elements
|
||||
// //this.objectManager.cleanInternalRemoved();
|
||||
// this.resourceManager.cleanInternalRemoved();
|
||||
//
|
||||
//
|
||||
// Log.info("List of all widget of this context must be equal at 0 ==> otherwise some remove is missing");
|
||||
// //this.objectManager.displayListObject();
|
||||
// // Resource is an lower element as objects ...
|
||||
|
@ -27,7 +27,6 @@ public class ResourceColored3DObject extends Resource {
|
||||
private int oGLMatrixView;
|
||||
|
||||
protected ResourceColored3DObject() {
|
||||
super();
|
||||
// get the shader resource :
|
||||
this.oGLPosition = 0;
|
||||
this.program = ResourceProgram.create(new Uri("DATA", "simple3D.vert", "gale"), new Uri("DATA", "simple3D.frag", "gale"));
|
||||
@ -86,13 +85,13 @@ public class ResourceColored3DObject extends Resource {
|
||||
if (color.a() < 1.0f) {
|
||||
OpenGL.enable(OpenGL.Flag.flag_blend);
|
||||
}
|
||||
// Request the draw of the elements:
|
||||
// Request the draw of the elements:
|
||||
OpenGL.drawArrays(OpenGL.RenderMode.TRIANGLE, 0, vertices.size());
|
||||
if (color.a() < 1.0f) {
|
||||
OpenGL.disable(OpenGL.Flag.flag_blend);
|
||||
}
|
||||
this.program.unUse();
|
||||
// Request the draw od the elements:
|
||||
// Request the draw od the elements:
|
||||
//glDrawArrays(oGLLINES, 0, vertices.size());
|
||||
//this.oGLprogram.UnUse();
|
||||
if (depthtest) {
|
||||
@ -134,7 +133,7 @@ public class ResourceColored3DObject extends Resource {
|
||||
if (color.a() < 1.0f) {
|
||||
OpenGL.enable(OpenGL.Flag.flag_blend);
|
||||
}
|
||||
// Request the draw of the elements:
|
||||
// Request the draw of the elements:
|
||||
OpenGL.drawArrays(OpenGL.RenderMode.TRIANGLE, 0, vertices.size());
|
||||
if (color.a() < 1.0f) {
|
||||
OpenGL.disable(OpenGL.Flag.flag_blend);
|
||||
@ -424,7 +423,7 @@ public class ResourceColored3DObject extends Resource {
|
||||
if (color.a() < 1.0f) {
|
||||
OpenGL.enable(OpenGL.Flag.flag_blend);
|
||||
}
|
||||
// Request the draw od the elements:
|
||||
// Request the draw od the elements:
|
||||
OpenGL.drawArrays(OpenGL.RenderMode.LINE, 0, vertices.size());
|
||||
if (color.a() < 1.0f) {
|
||||
OpenGL.disable(OpenGL.Flag.flag_blend);
|
||||
@ -492,6 +491,15 @@ public class ResourceColored3DObject extends Resource {
|
||||
draw(tmpVertices, tmpColor, transformationMatrix, true, true);
|
||||
}
|
||||
|
||||
public void drawTriangle(final Vector3f p1, final Vector3f p2, final Vector3f p3, final Matrix4f transformationMatrix, final Color tmpColor) {
|
||||
final List<Vector3f> tmpVertices = new ArrayList<>();
|
||||
tmpVertices.add(p1);
|
||||
tmpVertices.add(p2);
|
||||
tmpVertices.add(p3);
|
||||
//Log.info("display " << tmpVertices.size() << " vertices form " << indice.size());
|
||||
draw(tmpVertices, tmpColor, transformationMatrix, true, true);
|
||||
}
|
||||
|
||||
public void drawTriangles(final List<Vector3f> vertex, final List<Integer> indice, final Matrix4f transformationMatrix, final Color tmpColor) {
|
||||
drawTriangles(vertex, indice, transformationMatrix, tmpColor, new Vector3f(0.0f, 0.0f, 0.1f));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user