-glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);
+glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);
#include "widget.h"
Widget::Widget(QWidget *parent)
: QOpenGLWidget(parent)
{
}
GLuint VBO;
GLfloat arr[4];
void Widget::initializeGL()
{
glewExperimental = true;
glewInit();
glClearColor(0,0,0,1);
glColor3f(1,1,1);
arr[0] = -1;
arr[1] = -1;
arr[2] = 1;
arr[3] = 1;
glGenBuffers( 1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(arr), arr, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
}
void Widget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glColor4f(1.0f, 0.0, 0.0, 1.0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);
glDrawArrays(GL_LINES, 0, sizeof(arr));
}
void Widget::resizeGL(int w, int h)
{
glViewport(0,0,w,h);
}
private void button1_Click(object sender, EventArgs e)
{
var form = new Form1();
form.Shown += form_Shown;
form.Show();
}
void form_Shown(object sender, EventArgs e)
{
MessageBox.Show("Test");
}
double d = double.Parse("1,1");
Console.WriteLine("Value of d: {0}", d);
#include<glut.h>
void Keyboard(unsigned char key, int x, int y)
{
while (true);
}
float angle = 0;
void Draw()
{
angle++;
glLoadIdentity();
glRotatef(angle, 0,0,1);
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINES);
glVertex3f(1, 1, 0);
glVertex3f(-1, -1, 0);
glEnd();
glFlush();
}
void Time(int)
{
Draw();
glutTimerFunc(0,Time,50);
}
void Init()
{
glClearColor(1.0,1.0,1.0,0.0);
glColor3f(0,0,0);
glOrtho(0.0,1,0.0,1, 1,-1);
}
int main(int argv, char** argc)
{
glutInit(&argv, argc);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowPosition(200,200);
glutInitWindowSize(400,400);
glutCreateWindow("hello");
Init();
glutKeyboardFunc(Keyboard);
glutDisplayFunc(Draw);
glutTimerFunc(0,Time,50);
glutMainLoop();
}
int main()
{
short a=0;
__asm
{
mov ax, a
inc ax
mov a, ax
}
cout<<a; //1
}
аналог push/pop
#include<stdio.h>
int main(int n, char** args)
{
printf(args[0]);
}
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
notifyIcon1.Visible = !notifyIcon1.Visible;
}
private void button2_Click(object sender, EventArgs e)
{
Form2 a = new Form2(notifyIcon1);
Visible = false;
a.ShowDialog();
Visible = true;
}
}
}
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
NotifyIcon ico;
public Form2(NotifyIcon ico)
{
this.ico = ico;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ico.Visible = !ico.Visible;
}
}
}