Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Why would a GL circle, be rendered as a cross/clover?

$
0
0

@sdaau wrote:

In my application, I draw some circles (a combo of a filled circle, and outline/stroke circle) using ofDrawCircle, but for some reason, while the filled circle looks OK, the outline circle is rendered as a "clover" form, like this:

Notice how the white outline has "cuts" in it, making it look almost as a cross. Btw, this is on Ubuntu 14.04, OF from git slightly before 0.9.0.

I tried to isolate the exact drawing commands in the code below, but unfortunately, I cannot reconstruct the problem - the example below results with:

... which looks more like a circle. What's more, both applications output exactly the same log notice at the respective places in the code:

[notice ] current renderer type: GL circres: 20 smoothing: 0 bFill: 0

So, provided I cannot really reconstruct the problem, and it obviously isn't due to differing circle resolution/smoothing - what could possibly be the reason for the cross/clover-like rendering of what is supposed to be the white circle outline - and how could I get it to render properly?

The minimal example code:

main.cpp:

#include "ofMain.h"
#include "ofApp.h"

//========================================================================
int main( ){

    ofSetupOpenGL(1024,768, OF_WINDOW);            // <-------- setup the GL context

    // this kicks off the running of my app
    // can be OF_WINDOW or OF_FULLSCREEN
    // pass in width and height too:
    ofRunApp( new ofApp());

}

ofApp.h:

#pragma once

#include "ofMain.h"

class ofApp : public ofBaseApp{
  public:

    void setup();
    void update();
    void draw();

    void mousePressed(int x, int y, int button);
};

ofApp.cpp:

#include "ofApp.h"

//--------------------------------------------------------------
void ofApp::setup(){
  ofSetFrameRate(60);
}

//--------------------------------------------------------------
void ofApp::update(){
}

//--------------------------------------------------------------
void ofApp::draw(){
  ofLogNotice() << "current renderer type: " << ofGetCurrentRenderer()->getType() << " circres: " << ofGetCurrentRenderer()->getStyle().circleResolution << " smoothing: " << ofGetCurrentRenderer()->getStyle().smoothing << " bFill: " << ofGetCurrentRenderer()->getStyle().bFill;
  float x = 216.205, y=338.066, radius = 13.3953, strokewidth = 9;
  ofFill();
  ofSetColor(ofColor::red, 200);
  ofDrawCircle(x, y, 0, radius);
  ofNoFill(); //stroke
  ofSetLineWidth(static_cast<int>(strokewidth));
  ofSetColor(ofColor::white);
  ofDrawCircle(x, y, 0, radius); // x,y,z,rad
}

//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles