[QUESTION]Why i could not perceive my OpenGL Drawing??

hello everyone:

I am trying to dray something in 3D Scene…using OpenGL commands. like:

import bpy
import bgl

 
bgl.glBegin(bgl.GL_TRIANGLE_FAN)
bgl.glColor3f(1.0,0.0,0.0)
bgl.glVertex3f(  0.0,  30.0, 0.0)
bgl.glColor3f(0.0,1.0,0.0)
bgl.glVertex3f(-50.0, -50.0, 50.0)
bgl.glColor3f(1.0,1.0,0.0)
bgl.glVertex3f( 50.0, -50.0, 50.0)
bgl.glColor3f(0.0,0.0,1.0)
bgl.glColor3f(1.0,1.0,1.0)
bgl.glVertex3f( -50.0, -50.0, -50.0)
bgl.glColor3f(0.0,1.0,0.0)
bgl.glVertex3f(-50.0, -50.0, 50.0)
bgl.glEnd()

Normally, it should draw a triangle in the 3D scene…but after running it, there’s nothing in the 3D scene…what is the problem? in order to draw something, what should we do?

Look under text -> script example -> Operator Model Draw

Only problem I have seen so far is that the objects I draw only take one color, no smooth color change.

dormousan, how is blender supposed to know where/in which window to draw that information?

It has already been suggested to you to download one of the blender builds on Graphical.org to have a look at the code required to do it. it’s out there, you should not be stuck much longer. Rather than answering the question straight, here is an example of it working.

Compiled by filiciss, they contain this script :


it draws to the 3dview.