ajstarks/openvg

how to init a fixed graphic screen size window (e.g., 480x320)

Closed this issue · 10 comments

hey,
how to init a fixed graphic screen size (e.g., 480x320),
side to side of the Terminal stdout window,
not full screen?

As it states in the documentation:

void Start(int width, int height)

On Oct 25, 2015, at 1:04 PM, VogonJeltz notifications@github.com wrote:

hey,
how to init a fixed graphic screen size (e.g., 480x320),
side to side of the Terminal stdout window,
not full screen?


Reply to this email directly or view it on GitHub #30.

aah, I see, no init but start!
Thank you!

you still need Init().

On Oct 25, 2015, at 1:35 PM, VogonJeltz notifications@github.com wrote:

aah, I see, no init but start!
Thank you!


Reply to this email directly or view it on GitHub #30 (comment).

ok sorry my questions surely seem to be very stupid :/

I tried it by my code which generates both stdout messages and graphic output.
So I wanted to have both windows side to side - but I still seem to miss something.



#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <fcntl.h>
#include <string.h>
#include <sys/ioctl.h>
#include <stdint.h>
#include <time.h>
#include <sys/time.h>

#include "VG/openvg.h"
#include "VG/vgu.h"
#include "fontinfo.h"
#include "shapes.h"

long test_graphics(){
  int x=88, y=77; // debug  

  for(y=0;y<100;++y) {

    Background(0, 0, 0);                    // Black background

    Fill(255,255,255, 1);
    Circle(50, 40, 10);
    Circle(30, 24, 10);
    Fill(255,255,255, 1);

    Line(10, 10, 60, 60);
    Line(50, 20, 90, 70);
    Rect(20, 20, 40, 40);
    Rect(65, 25, 20, 30);
    Ellipse(70, 30, 15, 20);

  }

  return y;
}


int main(){

  unsigned long time0, x, y;
  float s;
  char  buf[120];
  int width, height;
  char str[3];

  printf("hw brickbench"); printf("\n");
  printf("initializing..."); printf("\n");
  //...
  init(&width, &height);                  // Graphics initialization
  Start(480, 320);                        // Start the picture
  Background(0, 0, 0);                    // Black background
  //...
  s=(float)test_graphics();
  printf("%f", s);  // # debug
  //..
  End();                                  // End the picture
  fgets(str, 2, stdin);                   // look at the pic, end with [RETURN]
  finish();                               // Graphics cleanup
  exit(0);
}

I don't see the both screens side by side though - what did I miss?

one thing to remember is that:

  1. you always need Init() and Finish()
  2. you can have Start(), it must be paired with End().

It may be useful to look at the shapedemo.c for examples.

On Oct 25, 2015, at 1:49 PM, VogonJeltz notifications@github.com wrote:

ok sorry my questions surely seem to be very stupid :/

I tried it by my code which generateds both stdout messages and graphic output.
So I wanted to have both windows side to side - but I still seem to miss something.

long test_graphics(){
int x=88, y=99;

for(y=0;y<100;++y) {

Background(0, 0, 0);                    // Black background

Fill(255,255,255, 1);
Circle(50, 40, 10);
Circle(30, 24, 10);
Fill(255,255,255, 1);

Line(10, 10, 60, 60);
Line(50, 20, 90, 70);
Rect(20, 20, 40, 40);
Rect(65, 25, 20, 30);
Ellipse(70, 30, 15, 20);

}

return y;
}

int main(){

unsigned long time0, x, y;
float s;
char buf[120];
int width, height;
char str[3];

printf("hw brickbench"); printf("\n");
printf("initializing..."); printf("\n");
//...
init(&width, &height); // Graphics initialization
Start(480, 320); // Start the picture
Background(0, 0, 0); // Black background
//...
s=test_graphics();
//..
End(); // End the picture
fgets(str, 2, stdin); // look at the pic, end with [RETURN]
finish(); // Graphics cleanup
exit(0);
}

I don't see the both screens side by side though - what did I miss?


Reply to this email directly or view it on GitHub #30 (comment).

I get no small graphic window -
by shapedemo I see no graphic window at all,
and in my own example(above) only full screen,
but in both cases not a small seperate graphic window.

It would be useful to

  1. explain exactly the effect you are going for
  2. post the entire code

On Oct 25, 2015, at 2:08 PM, VogonJeltz notifications@github.com wrote:

I get no small graphic window -
by shapedemo I see no graphic window at all,
and in my own example(above) only full screen,
but in both cases not a small seperate graphic window.


Reply to this email directly or view it on GitHub #30 (comment).

the small entire test code is the one above,
the whole entire test code is this one:
http://www.mindstormsforum.de/viewtopic.php?f=71&t=8095&p=67795#p67795

On my HDMI screen (1080x620) I wanted to have simultaneously
1 scaled window for stdout (generated automatically)
1 scaled window (canvas) 480x320 for the performed graphic functions
both side by side on my desktop, scaled smaller single windows, no fullscreen.

was this explanation understandable ? (sorry , my English is very poor)
(of course these test-codes are just a preliminary exercise for a completely different project.)

See revision d0e60d3